-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.html
More file actions
108 lines (98 loc) · 3.18 KB
/
app.html
File metadata and controls
108 lines (98 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html>
<head>
<title>Aoide</title>
<link rel="stylesheet" type="text/css" href="./aoide.css">
<script src="https://use.fontawesome.com/1d9fd679b6.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"></script>
</head>
<body>
<div id="source"></div>
<div id="aoide">
Aoide transforms your code into music. <a href="javascript:openInfo()" id="open-info">How?</a>
</div>
<div id="info">
<div id="info-inner">
<a href="javascript:closeInfo()" id="close-info">Close</a>
<h1>How does Aoide work?</h1>
<p>Aoide converts your code to music by following basic principles of chord progression.</p>
<h3>JavaScript Code Execution</h3>
<p>Chords and progressions are generated from the interpreter stack after each execution step.</p>
<h3>Java Source Analysis</h3>
<p>We use an abstract syntax tree generated from the source code to produce chords and variations.</p>
<h1>Samples</h1>
<h3>Hello World (Java)</h3>
<textarea style="width: 100%; height: 150px;">
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}</textarea>
<h3>Bubble sort (JS)</h3>
<textarea style="width: 100%; height: 300px;">
var array = [9, 2, 5, 6, 4, 3, 7, 10, 1, 8];
function swap(array, i, j) {
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
function bubbleSort(array) {
var swapped;
do {
swapped = false;
for(var i = 0; i < array.length; i++) {
if(array[i] && array[i + 1] && array[i] > array[i + 1]) {
swap(array, i, i + 1);
swapped = true;
}
}
} while(swapped);
return array;
}
bubbleSort(array.slice());</textarea>
<h3>Merge sort (JS)</h3>
<textarea style="width: 100%; height: 300px;">
var a = [34, 203, 3, 746, 200, 984, 198, 764, 9];
function mergeSort(arr) {
if (arr.length < 2)
return arr;
var middle = parseInt(arr.length / 2);
var left = arr.slice(0, middle);
var right = arr.slice(middle, arr.length);
return merge(mergeSort(left), mergeSort(right));
}
function merge(left, right) {
var result = [];
while (left.length && right.length) {
if (left[0] <= right[0]) {
result.push(left.shift());
} else {
result.push(right.shift());
}
}
while (left.length)
result.push(left.shift());
while (right.length)
result.push(right.shift());
return result;
}
mergeSort(a);</textarea>
<h1>Licenses</h1>
</div>
</div>
<div id="controls">
<div id="progress"></div>
<i id="play" class="fa fa-play control" aria-hidden="true"></i>
<span style="float: right; font-size: 12px;">
Speed:
<input type="number" id="speed" min="0.5" max="3" step="0.25" value="1">
Language:
<select id="lang">
<option value="JavaScript">JavaScript (Code execution)</option>
<option value="Java8">Java8 (Source analysis)</option>
</select>
</span>
</div>
</body>
<script type="text/javascript" src="./aoide.js"></script>
</html>