I am trying to emulate a piano in python using mingus as suggested in this question. I am running Ubuntu 14.04, and have already created an audio group and added myself to it. I am using alsa.
I ran the code given in one of the answers to the aforementioned question and it ran fine in shell mode. However, when I wrote a python script and tried to run it, I did not get any sound whatsoever. Here is my code:
#!/usr/bin/env python
from mingus.midi import fluidsynth
DEF_FONT_PATH = '/usr/share/sounds/sf2/FluidR3_GM.sf2'
def main():
fluidsynth.init(DEF_FONT_PATH, 'alsa')
fluidsynth.play_Note(80, 0, 80)
if __name__ == '__main__':
main()
I have checked many other answers, and I cannot seem to find a solution.