Sunday, 11 April 2010

8 - Polyphonic and MIDI

My FM synth is now polyphonic. It has been achieved with the use of the 'poly~' object. Poly~ is similar to a subpatch object in the way that it contains a patcher, although doesn't serve the same purpose. I have created a new patch which contains the internals of my FM synth voice, it is loaded into my main patch via poly~ with the argument '16', which means 16 instances of the voice are loaded. Poly~ can be utilized to trigger voices only when they are needed and set to a 'busy' state when not in use to prevent unnecessary processing.

Note that in this patch the QWERTY input has been replaced by MIDI input, and for demonstration purposes Virtual MIDI Keyboard has been used because right now I don't have MIDI hardware to hand.

The note and velocity messages are input from 'notein' and trigger the 'midinote $1 $2' message which tells the poly~ object to assign them to the first available instance of FMSynth that isn't busy. 'Target 0' message is sent to all other inputs of poly~ because the changes made in the number boxes do not always register in every instance, it is sent when the patch is loaded by the 'loadbang' object.

Inside the poly~ object (my FMSynth instance) 'thispoly~' recieves 'mute' messages from the 'adsr~' whenever the envelope reaches 0, which means the voice will be set to busy as soon as there is silence. The MIDI velocity messages are divided by 127 to keep the amp signal between 0 and 1.

My self built volume control for the master amp has been replaced by 'gain~', a slider that automaticly scales signals. By default its values range from 0 to 158, 0 being the equivalent to a zero signal and 128 is the equivalent to 1.0, giving us a little extra headroom to boost weak signals if needed.

A preset control has also been added to the main patch that can store and recall all parameter values in the patch (click to recall, shift-click to store).

1 comment:

  1. This post is a few days old..dont anything recentley? i hope so dont forget to update your blog!! your fucking immense! i love you :) xxx