Hi vladimir,

>jChannel is the midi channel number(1-16).

No, in fluidsynth API MIDI channel parameter are zero based (0 to 15).

 

>Notice these 2 lines: I'm not really sure whether I'm doing it right.
>(1) fluid_synth_reset_basic_channel(synth, -1);
>(2) fluid_synth_set_basic_channel(synth, jChannel, 
>FLUID_CHANNEL_MODE_OMNION_MONO, 1);

1)The first line remove any basic channels groups. So all MIDI channels are 
disabled. That means that any MIDI messages received will be ignored.
2)The second line "says" to the synthesizer that only one channel from basic 
channel jChannel should be played monophonic.This is not what you expected!. 
What you need is only one channel enabled regardless the polyphonic/monophonic 
behaviour of this channel. You could think using 
fluid_synth_set_basic_channel(synth, jChannel, FLUID_CHANNEL_MODE_OMNIOFF_POLY, 
1), but attention, this will work only if you are sure that the MIDI file 
currently played never change the MIDI mode (omni on/off poly/mono) by sending 
MIDI CC messages (124d to 127d). Unfortunately most MIDI file usually contain 
those CC.
So, to be sure of the result, the proper solution is to remove these 2 lines 
and edit the MIDIFILE by removing all tracks except the one that contain the 
instrument on the channel jChannel.

Before using your code, consider using the fluidsynth application console: 
fluidsynth  -F  your_audio_file  your_soundfont.sf2  your_midifile.mid.

Then you could use your code that look fine. Dont forget to test the result 
value (FLUID_OK/FLUID_FAILED) returned by API functions.

jjc

 
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to