Frequency Modulation & Max / MSP

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).

Wednesday 7 April 2010

7 - Filter

Another brief update. A filter has been added which has many different modes, it can define and modify a sound very simply and effectively. The filter object itself is 'biquad~', a two-pole, two-zero filter. By using a 'umenu' object (a user created drop list menu), different filter types can be enabled and selected. 'filtergraph~' is a very useful object that serves as a graphical display of cut-off and resonance values and can also be used as a user interface to input changes.

The signal from the oscillators has simply been connected directly to biquad~ and out of, straight into amplitude scaling multipliers (*~).

Monday 5 April 2010

6 - ADSR & Modulation

A second modulator has been added, which allows the modulating signal to be modulated as well. This allows more complex tones to be created by adding even more harmonics and or in-harmonics.
Both modulators are now contained inside subpatches, to make them more manageable and to create a more logical layout which avoids clutter.

The amp envelope has been replaced by an 'adsr~' object, which enables control of attack, decay, sustain and release in relation to note on and off triggers.

The envelope is triggered by a '1' message, sent whenever a note is played and deactivated by a '0' message when a note is lifted.
A 'preset' object has also been inserted within the 'QWERTY' subpatch, which can now be used to alter the octave of which the QWERTY keys control.


Saturday 3 April 2010

5 - Amp Envelope

Amplitude now follows an envelope. It is placed before the volume control so that the overall output of the voice can be controlled after the envelope.

The envelope is a 'function' object, connected to its input is a number which is passed through a message box. The message contains the argument, 'setdomain $1' which will set the length of the envelope to the time specified in the number box in milliseconds. The output of the envelope can be viewed in the number box below it, observe as the note duration is changed.

To trigger the envelope, a bang message is sent to it from the QWERTY patcher whenever a note is played.


Friday 19 March 2010

4 - FM Synth with QWERTY control

The FM patch can now be controlled via a QWERTY keyboard for experimentation purposes. The patch also allows control of the harmonicity relationship between the carrier and modulating frequency.

A subpatch was created to contain the QWERTY elements. A 'key' object accepts key inputs from a QWERTY keyboard. The number box connected directly is used to identify the ASCI code of a key that has been pressed. It is then passed through to a series of 'select' objects, which will send a 'bang' message whenever it receives the ASCI key identified in its argument. The bang messages are sent to a particular number box (which has been set to display MIDI notes) so that each key press is assigned to its own musical note. The notes are then received by the 'mtof' object which automaticly converts MIDI notes to the correct frequencies, which will be received by the oscillators.
The bang message from the select objects is also sent to a message argument (0.8), which when received will set the volume to 0.8 (or 80%).
The 'keyup' object sends a bang message whenever a key is lifted and is sent to a message argument (0) also connected to the volume control which resets it back to 0.

The turquoise '1' and '2' outlets correspond to the two outputs of the subpatch in the main patcher window.
sig~
The harmonicity ratio is set via a number box, it is connected though a 'sig~' object, which converts its input into a signal. Basically this is done so that it sends a constant signal rather than just a message whenever the number is changed.


Saturday 6 March 2010

3 - FM Synthesis

Just a minor update from the previous patch. This time the method of Frequency Modulation has been incorporated.
This patch includes two more 'flonum' objects, one which defines the value of the modulation frequency and another which defines the intensity of which the modulator will effect the carrier signal. The modulator is added to the carrier signal via use of a '+~' addition object.

Wednesday 3 March 2010

2 - More Synthesis

More synthesis here including some new objects. Number boxes have been added to allow modification of the oscillator frequency and amplitude level, they are 'flonum' objects which allow decimal points, as opposed to 'number' objects which will only support whole integers. Also in this patch there is a message combiner 'pack' object, 'line~' signal ramp generator and '*~' multiplier objects.

The purpose of the 'line~' object is to create smooth changes when the volume is adjusted, as without these audible artefacts (clicks) are present as the volume jumps from one value to another. The 'pack' object combines the value entered via the 'volume box' with a value which determines the time, in milliseconds, for the envelope of the 'line~' object to change between the volume values. To demonstrate, the number box below the line object displays the current value of the amplitude level and I have entered an envelope time of 1000 milliseconds so it is at a speed at which is visible.

The multiplier object simply calculates the oscillator signal and the signal controlling amplitude to enable volume changes.

Monday 30 November 2009

1 - Basic Synthesis

Finally got an educational licence for Max. So far I've built a 'test tone' oscillator.
Below is a video of my first patch, in which the 'cycle~' object is the oscillator, its output is connected to a 'dac~' object which is the audio output module, also connected to the 'dac~' is a toggle button. When the toggle button is crossed, it sends a bang message which when recieved by the 'dac~', switches on or off depending on its current state, making the toggle button an 'on/off switch' for the audio generated by the oscillator.

Remember to check volume before playing video!


Friday 23 October 2009

Intro

I'm writing this blog because I'm creating an FM synthesizer in Max 5 for a BSC degree project. I think posting as I learn about Max / MSP will be a good way to record my development. The material might also be interesting to anyone who cares about audio, modular synthesis or whatever. I'm new to Max so the first posts will probably involve some real basic stuff.
FM, or Frequency Modulation is a method of audio synthesis, where by a carrier signal is modified by another signal which has been added to it, creating a completely new signal. The method works very well in recreating complex and percussive sounds that occur in the real world, with electronic equipment.


P.S. This is not a guide to Max or tutorial on synth building (that's what the built in lessons are for right?), I will not be explaining in depth just stating the development and changes I have made so that I can look back if I need to remember something or reference in my report.