-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_music.html
257 lines (245 loc) · 10.5 KB
/
generate_music.html
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<html>
<head>
<title>Magenta - multitrack chords</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta
name="viewport"
content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"
/>
<link
id="favicon"
rel="icon"
href="https://magenta.tensorflow.org/favicon.ico"
type="image/x-icon"
/>
<link
href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,700"
rel="stylesheet"
/>
<script src="https://cdn.jsdelivr.net/npm/@magenta/music@1.16.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@tonaljs/tonal/browser/tonal.min.js"></script>
<script>
// const currentSong = <%- JSON.stringify(locals.song) || 'undefined' %>
const currentSong = "undefined";
</script>
<link rel="stylesheet" href="generate_music.css" />
<link rel="stylesheet" href="piano.css" />
</head>
<body>
<section id="home">
<p class="title">Interactive Music Generator</p>
<div class="signContainer">
<div class="glowsign"><b>about</b></div>
<div class="rules">
Welcome to Building Interactive Music! We are so excited to have you
here. This app allows you to build your own melody using Magenta's
MusicRNN model.<br /><br />
On Step #1, you will create an input melody by either choosing a
preloaded note sequence or by inputting your own custom note sequence
through our keyboard. <br /><br />
On Step #2, you will have the option to condition the generator on a
chord progression of your choice. By default, no chord progression is
used. <br /><br />
When you are satisfied with your input melody and chord progression,
you can press the glowing "Ready" button. Then, our generator will
extend your melody and provide two generated music options for you to
visualize, listen, and select.<br />
After you select an option, our generator will continuously use your
selection to generate more music and provide another two options.<br /><br />
Enjoy listening! <br />
<br />
</div>
<button id="continue1" class="continue">Get Started</button>
</div>
</section>
<section id="settings">
<div>
<!-- <p class="desc"> description here </p> -->
<div class="dContainer">
<div class="signContainer">
<div class="glowsign"><b># 1</b></div>
<div class="selectorContainer glowBox">
<div class="buttons">
<button id="preloadedNS">
Choose a Preloaded Note Sequence
</button>
<button id="customNS">
Create your Own Custom Note Sequence
</button>
</div>
<div>
<div id="NSoptions">
<div id="preloadedOptions" class="" hidden>
<button id="twinkle" class="thin">Twinkle</button>
<button id="arpeggiated" class="thin">Arpeggiated</button>
<button id="sparse" class="thin">Sparse</button>
<div id="preloadedOptionsMessage" class="desc"></div>
</div>
<div id="pianoContainer" class="" hidden>
<div class="piano">
<div data-note="C" class="key white">
<span class="white_key_name">a</span>
</div>
<div data-note="Db" class="key black">
<span class="black_key_name">w</span>
</div>
<div data-note="D" class="key white">
<span class="white_key_name">s</span>
</div>
<div data-note="Eb" class="key black">
<span class="black_key_name">e</span>
</div>
<div data-note="E" class="key white">
<span class="white_key_name">d</span>
</div>
<div data-note="F" class="key white">
<span class="white_key_name">f</span>
</div>
<div data-note="Gb" class="key black">
<span class="black_key_name">t</span>
</div>
<div data-note="G" class="key white">
<span class="white_key_name">g</span>
</div>
<div data-note="Ab" class="key black">
<span class="black_key_name">y</span>
</div>
<div data-note="A" class="key white">
<span class="white_key_name">h</span>
</div>
<div data-note="Bb" class="key black">
<span class="black_key_name">u</span>
</div>
<div data-note="B" class="key white">
<span class="white_key_name">j</span>
</div>
</div>
<div class="dContainer">
<button id="record-button" class="btn thin">
Record
</button>
<button id="play-button" class="btn thin">Play</button>
</div>
<audio id="C" src="notes/c4_louder10.mp3"></audio>
<audio id="Db" src="notes/c-4_louder10.mp3"></audio>
<audio id="D" src="notes/d4_louder10.mp3"></audio>
<audio id="Eb" src="notes/d-4_louder10.mp3"></audio>
<audio id="E" src="notes/e4_louder10.mp3"></audio>
<audio id="F" src="notes/f4_louder10.mp3"></audio>
<audio id="Gb" src="notes/f-4_louder10.mp3"></audio>
<audio id="G" src="notes/g4_louder10.mp3"></audio>
<audio id="Ab" src="notes/g-4_louder10.mp3"></audio>
<audio id="A" src="notes/a5_louder10.mp3"></audio>
<audio id="Bb" src="notes/a-5_louder10.mp3"></audio>
<audio id="B" src="notes/b5_louder10.mp3"></audio>
</div>
</div>
</div>
</div>
</div>
<!-- -->
<div class="signContainer">
<div class="glowsign"><b># 2</b></div>
<div class="selectorContainer glowBox">
<div class="buttons">
<button id="inputChords">Input a Chord Sequence</button>
<button id="noChords">No Chord Sequence</button>
</div>
<div>
<div id="chordSelector" class="" hidden>
<div>
<p class="desc">Chord progression:</p>
<div id="status" class="loading"></div>
<div id="changeChordsPopup"></div>
<span id="chordsContainer" disabled>
<span class="chordDisplay"
>#1 <input id="chord1" type="text" value="Dm"
/></span>
<span class="chordDisplay"
>#2 <input id="chord2" type="text" value="F"
/></span>
<span class="chordDisplay"
>#3 <input id="chord3" type="text" value="Am"
/></span>
<span class="chordDisplay"
>#4 <input id="chord4" type="text" value="G"
/></span>
</span>
<button id="changeChords" class="thin">Change</button>
</div>
</div>
<div id="noChordsSelector" class="">
<p class="desc">No Chord Progression</p>
</div>
</div>
</div>
<!-- <button id="finishedPlaying" class="thin">
Done!
</button> -->
<div class="glowsign ready" id="finishedPlaying">
<b>ready ✓</b>
</div>
</div>
</div>
</div>
<!-- <button id="finishedPlaying" class="continue">
Done!
</button> -->
</section>
<section id="create">
<div class="tVerticalContainer">
<div id="generateMusicContainer">
<!-- visualize melody with Visualizer on top -->
<div class="signContainer">
<div class="glowsign"><b>your current sequence</b></div>
<div>
<div class="visualizer-container top-vc">
<svg id="topVisualizer"></svg>
</div>
<button id="playCompleteNoteSequenceButton" class="thin options">
Play Sequence
</button>
<!-- play current sequence up until now -->
</div>
<!-- continue building the sequence -->
<div id="melodyBuilderContainer" class="dContainer">
<!-- options for next sequences -->
<div class="signContainer">
<div class="glowsign"><b>option # 1</b></div>
<div id="nextSequence1">
<div class="visualizer-container">
<svg id="svg1"></svg>
</div>
<button id="nextSequence1PlayButton" class="thin options">
Play Option 1
</button>
<button id="nextSequence1SelectButton" class="thin options">
Select Option 1
</button>
</div>
</div>
<div class="signContainer">
<div class="glowsign"><b>option # 2</b></div>
<div id="nextSequence2">
<div class="visualizer-container">
<svg id="svg2"></svg>
</div>
<button id="nextSequence2PlayButton" class="thin options">
Play Option 2
</button>
<button id="nextSequence2SelectButton" class="thin options">
Select Option 2
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="generate_music.js"></script>
<script src="display.js"></script>
<script src="mousesparkles.js"></script>
</body>
</html>