Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,17 +2,22 @@ from midiutil import MIDIFile
|
|
2 |
import gradio as gr
|
3 |
|
4 |
|
5 |
-
|
6 |
-
track = 0
|
7 |
-
channel = 0
|
8 |
-
time = 0 # In beats
|
9 |
-
duration = 1 # In beats
|
10 |
-
tempo = 60 # In BPM
|
11 |
-
volume = 100 # 0-127, as per the MIDI standard
|
12 |
-
MyMIDI = MIDIFile(1) # One track, defaults to format 1 (tempo track
|
13 |
-
# automatically created)
|
14 |
|
15 |
def make_mid():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
MyMIDI.addTempo(track,time, tempo)
|
17 |
for pitch in degrees:
|
18 |
MyMIDI.addNote(track, channel, pitch, time, duration, volume)
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
|
5 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def make_mid():
|
8 |
+
|
9 |
+
degrees = [60, 62, 64, 65, 67, 69, 71, 72] # MIDI note number
|
10 |
+
track = 0
|
11 |
+
channel = 0
|
12 |
+
time = 0 # In beats
|
13 |
+
duration = 1 # In beats
|
14 |
+
tempo = 60 # In BPM
|
15 |
+
volume = 100 # 0-127, as per the MIDI standard
|
16 |
+
MyMIDI = MIDIFile(1) # One track, defaults to format 1 (tempo track
|
17 |
+
# automatically created)
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
MyMIDI.addTempo(track,time, tempo)
|
22 |
for pitch in degrees:
|
23 |
MyMIDI.addNote(track, channel, pitch, time, duration, volume)
|