Some simple questions of Fluidsynth about implying samplers

Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Some simple questions of Fluidsynth about implying samplers

Hak Lin
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
林季伯
+886 937626316

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

simple_sample.cpp (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Some simple questions of Fluidsynth about implying samplers

Ceresa Jean-Jacques

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" <[hidden email]>
> A : [hidden email]
> 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
林季伯
+886 937626316


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

>
> [ simple_sample.cpp (5.2 Ko) ]

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Some simple questions of Fluidsynth about implying samplers

Ceresa Jean-Jacques

Hi,

I forgot to mention a good example in the Wiki: http://www.fluidsynth.org/api/example_8c-example.html#a3

jjc

> Message du 21/05/20 13:24

> De : "Ceresa Jean-Jacques" <[hidden email]>
> A : "FluidSynth mailing list" <[hidden email]>
> Copie à :
> Objet : Re: [fluid-dev] Some simple questions of Fluidsynth about implying samplers
>
>

> 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" <[hidden email]>
> A : [hidden email]
> 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
林季伯
+886 937626316


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

>
> [ simple_sample.cpp (5.2 Ko) ]



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Some simple questions of Fluidsynth about implying samplers

Hak Lin
Hi Ceresa,
Thanks for the reply, it helps a lot. We will try to follow the steps that you mentioned.
It seems that we have misunderstood  the pipeline and each component's relationship. 

>Interresting. Is it an optical to MIDI tranducers dedicated to plugged/bowed instruments ?
Yes, we made a wireless optical pickup for  plugged/bowed instruments.

We have a website, but not much information on it.
https://thehcmusic.com/licap.html  
If you are interested in what we are making, it's a great pleasure to make friends with and keep in touch! 

Really grateful for your reply 

Best regards,
Hak.

Ceresa Jean-Jacques <[hidden email]> 於 2020年5月21日 週四 下午9:38寫道:

Hi,

I forgot to mention a good example in the Wiki: http://www.fluidsynth.org/api/example_8c-example.html#a3

jjc

> Message du 21/05/20 13:24

> De : "Ceresa Jean-Jacques" <[hidden email]>
> A : "FluidSynth mailing list" <[hidden email]>
> Copie à :
> Objet : Re: [fluid-dev] Some simple questions of Fluidsynth about implying samplers
>
>

> 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" <[hidden email]>
> A : [hidden email]
> 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
林季伯
+886 937626316


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

>
> [ simple_sample.cpp (5.2 Ko) ]



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev


--
駭音科技有限公司

Founder/CEO
林季伯
+886 937626316

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Some simple questions of Fluidsynth about implying samplers

Ceresa Jean-Jacques

Hi, Hak

 

>It seems that we have misunderstood  the pipeline and each component's relationship.

Please be aware that the relationship discribed in previous message isn't specific

to fluidsynth. Just to say that any MIDI synthesizer should behave this way accordling

to MIDI protocol.

So, in your case, you have to build a small SF2 Soundfont  which should contain just 1 preset

for MIDI program number x and MIDI bank number y.

According to SF2 soundfont terminology the structure of this preset should be:

- The preset should have only one preset zone (PZ).

- This PZ should have only one Instrument.

- This Instrument should have only one instrument zone (IZ)

- This IZ should contain the sample of interest (i.e a dog bark)

You can build this Soundfont using a SF2 editor (i.e Polyphone, and more recently Swami).

This can be done quickly, starting from an existing soundfont preset and substitute the actual preset's sample by your dog bark sample(.wav).

 

>If you are interested in what we are making, it's a great pleasure to make friends with and keep in touch!

I am interested by any kind of sensors technology able to capture musician expressiveness similarly to those

who play on real instrument using their 10 fingers. I am really interested by the bowed and plugged instrument case.

jjc.

 

> Message du 22/05/20 18:42

> De : "Hak Lin" <[hidden email]>
> A : "Ceresa Jean-Jacques" <[hidden email]>, "FluidSynth mailing list" <[hidden email]>
> Copie à :
> Objet : Re: [fluid-dev] Some simple questions of Fluidsynth about implying samplers
>
>
Hi Ceresa,
> Thanks for the reply, it helps a lot. We will try to follow the steps that you mentioned.
It seems that we have misunderstood  the pipeline and each component's relationship. 

>
>Interresting. Is it an optical to MIDI tranducers dedicated to plugged/bowed instruments ?
Yes, we made a wireless optical pickup for  plugged/bowed instruments.

> We have a website, but not much information on it.
> https://thehcmusic.com/licap.html  
>
If you are interested in what we are making, it's a great pleasure to make friends with and keep in touch! 

>
Really grateful for your reply 

>
Best regards,
Hak.

>
Ceresa Jean-Jacques <[hidden email]> 於 2020年5月21日 週四 下午9:38寫道:
>

> Hi,

> I forgot to mention a good example in the Wiki: http://www.fluidsynth.org/api/example_8c-example.html#a3

> jjc

> Message du 21/05/20 13:24
> > De : "Ceresa Jean-Jacques" <[hidden email]>
> > A : "FluidSynth mailing list" <[hidden email]>
> > Copie à :
> > Objet : Re: [fluid-dev] Some simple questions of Fluidsynth about implying samplers
> >
> >

> > 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" <[hidden email]>
> > A : [hidden email]
> > 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
林季伯
+886 937626316

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

>
>
> _______________________________________________
> fluid-dev mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>
>
_______________________________________________
> fluid-dev mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>

>
--
>
駭音科技有限公司

>
Founder/CEO
林季伯
+886 937626316

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev