[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Percussion Channel

From: dave
Subject: Re: [fluid-dev] Percussion Channel
Date: Fri, 11 Dec 2020 16:02:48 -0000

Thanks again for your help Tom.  It's all working now!

For the benefit of anyone else wanting to set a percussion channel other than 
9, and have 9 as melodic, the following seems to be the minimum number of 
steps.  (For clarity I'm omitting the checks on the success of the various 

        // I want 65 channels:

        settings = new_fluid_settings();   
        fluid_settings_setint( settings, "synth.midi-channels", 65 );

        // create the synthesizer
        // with percussion channel = 64
        // and set the traditional MIDI percussion channel (9) to melodic:

        synth = new_fluid_synth( settings );
        fluid_synth_set_channel_type( synth, 64, CHANNEL_TYPE_DRUM );
        fluid_synth_set_channel_type( synth,  9, CHANNEL_TYPE_MELODIC );

        // create the audio driver

        adriver = new_fluid_audio_driver( settings, synth );                    

        // Load the sound font:
        int nSfId = fluid_synth_sfload( synth, pszSoundFontPath, TRUE );

        // Set voice 0 on channel 9, which should now be melodic

        fluid_synth_program_select( synth, 9, nSfId, 0, 0);


The last step, after loading the sound font,  turns out to be the crucial one I 
was missing from the start.  Before any NoteOn's are sent to channel 9 it will 
receive a program change with

        fluid_synth_program_change( ... );

to set the voice which is actually wanted.  Nevertheless the initial 
fluid_synth_program_select() seems to be crucial.   Thanks again for the 
excellent support!


David Webber
Mozart Music Software

reply via email to

[Prev in Thread] Current Thread [Next in Thread]