Skip to content

Instantly share code, notes, and snippets.

@matael
Created August 14, 2017 13:20
Show Gist options
  • Save matael/61a7cdbc4752fbfd439c45ffea8cc324 to your computer and use it in GitHub Desktop.
Save matael/61a7cdbc4752fbfd439c45ffea8cc324 to your computer and use it in GitHub Desktop.
Test fluidsynth
import time
import fluidsynth
fs = fluidsynth.Synth()
fs.start(driver='alsa', midi_driver='alsa_seq')
sfid = fs.sfload(b"/usr/share/soundfonts/FluidR3_GM.sf2")
fs.program_select(0, sfid, 0, 0)
fs.noteon(0, 60, 30)
fs.noteon(0, 67, 30)
fs.noteon(0, 76, 30)
time.sleep(1.0)
fs.noteoff(0, 60)
fs.noteoff(0, 67)
fs.noteoff(0, 76)
time.sleep(1.0)
fs.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment