Hello Hak,

 

After reading the simple_sample.cpp provided. Here some tips.

 

1)The best for you should be to use the fluidsynth console application. It 
allows to test anything without writting any line of code.

2.1.1) new_fluid_audio_driver() must be called after new_fluid_synth() but 
BEFORE any noteon/noteoff, otherwise we cannot hear something.

2.1.2) similarly fluid_synth_sfload() must be called before any noteon/noteoff.

2.2) always check returned status after calling 
(new_fluid_settings(),new_fluid_synth(), new_fluid_audio(), 
fluid_synth_sfload()).

 

3)In your use case, as far you intend to work with a SoundFont, things are 
simpler.

3.1)The note played by fluid_synth_noteon(synth, 0 //MIDI Channel 0, 60 //C4, 
127//maximum velocity) will

use information coming from the soundfont (i.e {Preset{Instrument{sample}}}).

Consequently, we don't need to provide an external sample (i.e calling 
readDataFromWav() is useless).

Also as far you need a simple demo (i.e playing one note) , you don't need of 
internal sequencer

(i.e calling fluid_sequencer_register() is useless).

 

3.2) However, before fluid_synth_noteon(), we just need to tell fluidsynth that 
channel 0

must bet set to the right MIDI program/bank number corresponding to the 
intended preset number.

For example assuming the intended soundfont preset is x in bank y. This leads 
to:

 

/* call new_fluid_settings(),new_fluid_synth(), new_fluid_audio(), 
fluid_synth_sfload() */

 

/* Set program number x to MIDI channel 0 */

fluid_synth_prog_change(synth, 0 , x);

 

/* Set bank number y to MIDI channel 0 */

fluid_bank_select(synth, 0, y);

 

/* play note A4 on MIDI channel 0 at full velocity during 2 second */

fluid_synth_noteon(synth,0, 69, 127);

 

Sleep(2000);

fluid_synth_noteoff(synth,0, 69);

 

/* call delete_fluid_audio_driver(a),  delete_fluid_synth(synth), 
delete_fluid_settings */

 

>We are making some optical pickups for string instruments(i.e. guitar, 
>violins) to do the midi stuf.

Interresting. Is it an optical to MIDI tranducers dedicated to plugged/bowed 
instruments ?

Regards.

jjc

> Message du 21/05/20 04:37
> De : "Hak Lin" 

> A : fluid-dev@nongnu.org
> Copie à : 
> Objet : [fluid-dev] Some simple questions of Fluidsynth about implying 
> samplers
> 
>
Hi Fluidsynth developers,
I'm Hak from HcMusic, Taiwan.
We are making some optical pickups for string instruments(i.e. guitar, violins) 
to do the midi stuff by installing our product, which is still in the early 
stage.

>
We want to make a simple sampler to demo our product. Something like playing an 
A4 note that will make a dog bark sample. We found that fluidsynth is a great 
project that helps us to work out with prototyping demo.

>
We had some problems with implying fluidsynth. We had tried functions like 
new_fluid_sample(), readDataFromWav(), fluid_sample_set_sound_data(). After 
that, we thought there should be sample sound when we ran the function 
fluid_synth_noteon(). But not a noise came out.
> 
> Is there some simple example of how to make a simple sampler that just loads 
> a wavefile and assign to a note, and makes a sound when notion().
> 
> Below's attachment is a simple code that we tried, there might be plenty of 
> mistaken function calls. Hope this indicates what we had done wrong.

>
Thanks for your help.

>
Best regards,
Hak.

>
-- 
>



駭音科技有限公司

>
Founder/CEO
林季伯
ps2...@thehcmusic.com
+886 937626316








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

>
> [ simple_sample.cpp (5.2 Ko) ]
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to