floriangardin commited on
Commit
171b8d5
1 Parent(s): feef1b0

choose chord progression

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,7 +3,7 @@ from musiclang_predict import MusicLangPredictor # Assuming this is the correct
3
  from midi2audio import FluidSynth
4
  import os
5
 
6
- def musiclang(nb_tokens, temperature, chord_progression):
7
  top_p = 1.0
8
  seed = 0
9
 
@@ -32,7 +32,7 @@ def musiclang(nb_tokens, temperature, chord_progression):
32
 
33
  # Save the score as a MIDI file
34
  midi_path = 'test.mid'
35
- score.to_midi(midi_path)
36
 
37
  # Convert MIDI to WAV then WAV to MP3
38
  wav_path = 'result.wav'
@@ -60,9 +60,9 @@ iface = gr.Interface(
60
  gr.Audio(label="Generated Music"),
61
  gr.File(label="Download MIDI")
62
  ],
63
- title="Music Generation with MusicLang",
64
  description="""Customize the music generation by specifying the number of tokens, temperature, chord progression, and tempo.
65
- \nChord qualities: M, m, 7, m7b5, sus2, sus4, m7, M7, dim, dim7. You can also specify the bass if it belongs to the chord (e.g., Bm/D).
66
  \nIf no chord progression is given, it generates a free sample with the specified number of tokens."""
67
  )
68
 
 
3
  from midi2audio import FluidSynth
4
  import os
5
 
6
+ def musiclang(nb_tokens, temperature, chord_progression, tempo):
7
  top_p = 1.0
8
  seed = 0
9
 
 
32
 
33
  # Save the score as a MIDI file
34
  midi_path = 'test.mid'
35
+ score.to_midi(midi_path, tempo=tempo, time_signature=(4, 4))
36
 
37
  # Convert MIDI to WAV then WAV to MP3
38
  wav_path = 'result.wav'
 
60
  gr.Audio(label="Generated Music"),
61
  gr.File(label="Download MIDI")
62
  ],
63
+ title="Controllable Symbolic Music Generation with MusicLang Predict",
64
  description="""Customize the music generation by specifying the number of tokens, temperature, chord progression, and tempo.
65
+ \nChord qualities: M, m, 7, m7, m7b5, sus2, sus4, M7, dim, dim7. You can also specify the bass if it belongs to the chord (e.g., Bm/D).
66
  \nIf no chord progression is given, it generates a free sample with the specified number of tokens."""
67
  )
68