On Tue, Jan 12, 2016 at 3:43 AM, Nycholas Maia <nyckm...@gmail.com> wrote:
> I'm studying the FaustLive examples and trying to understand *how a MIDI > information is received by the VSTi plugin *to be possible create a MIDI > synth. > Ok, I'll bite once again -- but then I'll have to go back teaching my own students... Faust itself doesn't know or care about MIDI. It only knows about control data (embodied by its "user interface" elements). Everything else is in the architecture (faustvst.cpp if you're using faust-vst). If you have a look at faustvst.cpp, you can find all the usual VST callbacks there, which receive the MIDI data and perform the necessary mapping to the UI elements of the Faust dsp. The Faust dsp itself only implements a single voice (i.e., a monophonic synth) driven by the "freq", "gain" and "gate" parameters (special label names), which have the following meaning: - freq is the frequency in Hz corresponding to the MIDI note number; this is normally used to set the (fundamental) frequency of the synth's oscillator - gain is a linear gain value in the range 0-1, corresponding to the MIDI note velocity; this is normally used to set the amplitude of the oscillator - gate is a 0-1 value (1 means on, 0 off), this is normally used to drive the envelop of the synth NB: By default, the freq value is computed using equal temperament, but the faustvst.cpp architecture allows you to adjust the tuning, e.g., by sending a MIDI tuning sysex message, please check the faust-vst and faust-lv2 READMEs for details. So, to create a minimal synth, you basically implement an oscillator as the `process` function of your Faust program, which uses these three control parameters. I've attached a minimal example sine.dsp which can be compiled with the faust2fausvst script included in faust-vst. (NOTE: The faust2fausvst script had a bug which caused the `nvoices` meta data to be ignored, which I fixed this morning, so make sure to pull the latest faust-vst from git and reinstall the script before trying the example. You can also use faust2faustvst's `-nvoices` option instead of the meta key, this will also work with the previous version of the script. Also note that the `nvoices` key currently only works with faust-vst, the other AU and VST architectures use a zero number of audio inputs as indication that the programmer wants an instrument. faust-vst does it differently in order to allow for instruments with audio inputs.) Back to the minimal example: It just uses `gate` as an amplitude factor, which of course creates clicks when the instrument is played. For a more practical but still quite minimal example, see the attached sineadsr.dsp which adds an ADSR envelop driven by the `gate` value, which has a controllable attack time and a master volume control. (One interesting detail here is the `smooth` filter from filter.lib on the latter, this is needed to avoid zipper noise when the volume control changes rapidly). The example also illustrates how to assign the attack and volume controls to corresponding MIDI controls. I've used CC1 - modulation - and CC7 - volume - in the example because these two are readily available on most MIDI keyboards, but of course you can assign them to anything you want. For Sibelius you might also want to implement CC11 (expression). Pitch bends are left as an exercise. ;-) Ok, I hope that this, together with the available documentation, gets you started. If not then I'm afraid that you'll have to attend one of the available Faust courses at CCRMA/Stanford, JMU/France or JGU/Germany. ;-) Albert -- Dr. Albert Gr"af Computer Music Research Group, JGU Mainz, Germany Email: aggr...@gmail.com WWW: https://plus.google.com/+AlbertGraef
sine.dsp
Description: Binary data
sineadsr.dsp
Description: Binary data
------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users