- when you design a DSP that following the polyphonic instrument conventions, 
the MIDI key to freq conversion is done for you. Read again the "MIDI Polyphony 
Support » in https://faustdoc.grame.fr/manual/midi/

- then you need to activate the polyphonic mode in the Faust IDE, that is « 
Poly Voices » on the left, and chose the number of voices you want. You’ll se 
that the GUI then will take a different layout.

- then connect the MIDI keyboard by selecting the proper input in then MIDI 
Input section on the top right. 

Stéphane

> Le 25 sept. 2020 à 02:42, Bob Bobsled <thebobbobs...@gmail.com> a écrit :
> 
> Hi,
> 
> Yes this is all very good information.  I haven't used the Web IDE before, so 
> that was nice to see.  
> 
> Using the .dsp code from the ex. tutorial 
> https://faust.grame.fr/doc/tutorials/#adding-an-envelope-generator , in the 
> Web IDE it sees my midi keyboard, and shows the midi note number.
> 
> import("stdfaust.lib");
> declare options "[midi:on]";
> declare options "nvoices:12]";
> decimalpart(x) = x-int(x);
> phase(f) = f/ma.SR : (+ : decimalpart) ~ _ ;
> timbre(f) = phase(f)*0.5 + phase(f*2)*0.25 + phase(f*3)*0.125;
> 
> process = timbre(hslider("freq", 440, 20, 10000, 1))
> * hslider("gain", 0.5, 0, 1, 0.01)
> * (button("gate") : en.adsr(0.1,0.1,0.98,0.1));
> 
> effect = dm.zita_light;
> 
> 
> However the result is the same as always when I hit run.  I get a gui with 
> the ubiquitous gate button.  What I'm searching for is to play a key on the  
> external usb midi keyboard and have it play the corresponding frequency.  
> 
> I can make a single midi key control the gate button, but that's still not 
> quite I'm searching for because I still need to change frequency using a 
> slider.  There must be a way to set frequency to the midi keys in the .dsp, 
> but this bit of code model seems hard to locate.
> 
> It might look roughly something like this, but not sure how to pass note 
> numbers # to the midi key.
> 
> freq = midikey2hz([midi:key #]);
> ...
> process = gate* freq;
> 
> Regards,
> Bob
> 
> On Wed, Sep 23, 2020 at 4:06 PM Thadeus Reed <t...@creativecontrol.cc> wrote:
> Hi Bob,
> 
> I'm not sure what your development setup is but I found it very helpful to 
> use the Web IDE when developing https://faust.grame.fr/ide/ . This has a 
> dropdown menu that lets you choose the MIDI input that controls your .dsp. I 
> believe this only works in Chrome because of the WebMIDI implementation. 
> 
> If you look at the tutorial 
> https://faust.grame.fr/doc/tutorials/#adding-an-envelope-generator it shows 
> the basic setup for a MIDI controlled synthesizer. The "gate", "freq", and 
> "gain" variables will be connected automatically to incoming MIDI "gate", 
> "midinote", and "velocity" respectively.
> 
> If you are outside of the IDE I believe you have to have MIDI enabled with 
> declare options "[midi:on]";
> and if you need polyphony
> declare options "[nvoices:12]";
> at the top of your .dsp file. There are more options explained in 
> https://faust.grame.fr/doc/manual/#midi-and-polyphony-support .
> 
> How you connect different MIDI controllers outside of the Web IDE will depend 
> a lot on which platform you are compiling the DSP for.
> 
> I hope that helps,
> Thadeus
> 
> http://www.creativecontrol.cc
> 
> 
> On Wed, Sep 23, 2020 at 5:43 PM Bob Bobsled <thebobbobs...@gmail.com> wrote:
> How does one play a .dsp instrument using an external usb midi keyboard?
> I would like to play the midi keyboard keys and hear the frequency associated 
> with the
> midi key being played.  Not a virtual keyboard, not a smartphone, but an 
> external usb keyboard.
> 
> I have tried various faust2scripts, but nothing seems to work.  I thought 
> perhaps faust doesn't do it; since the gate button is ubiquitous, and there 
> is next to nothing available for help using an external midi keyboard to 
> trigger frequencies.  A simple .dsp example would suffice, if someone is 
> willing to share.
> 
> 
> _______________________________________________
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
> _______________________________________________
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to