In the following example, A and B have the setados instruments, but both A and B using only the last object to be set, it is as if rewrite.
from mingus.midi import fluidsynth as a
from mingus.midi import fluidsynth as b
from mingus.containers import Note
a.init('/usr/share/sounds/sf2/FluidR3_GM.sf2',"alsa")
a.set_instrument(0, 34, 0)
b.set_instrument(0, 35, 0)
a.play_Note(26, 0, 127)
a.sleep(0.5)
b.play_Note(26, 0, 127)
b.sleep(0.5)
How can I set a tool for A and B to another instrument in the same script, or some other way?
First of all if you write:
from mingus.midi import fluidsynth as a
from mingus.midi import fluidsynth as b
then a
and b
as the same identical object. So writing b.set_instrument(0, 35, 0)
is the same as a.set_instrument(0, 35, 0)
. As far as I understand fluidsynth
you should use two different channels for each instruments:
a.set_instrument(0, 34)
a.set_instrument(1, 35)
a.play_Note(26, 0, 127)
a.sleep(0.5)
a.play_Note(26, 1, 127)
a.sleep(0.5)