Fm1i Class Reference
[Frequency Modulation Synthesis]

FM with arbitrary waveforms for carrier and modulator and an interpolating oscillator for the carrier. More...

#import <Fm1i.h>

Inheritance diagram for Fm1i:

MKSynthPatch MKPatch Fm1 Fm1vi DBFm1vi Fm1v

List of all members.

Public Member Functions

(id) - init
 Sent by the MKOrchestra only when a new MKSynthPatch has just been created and before its MKUnitGenerator connections have been made, as defined by the MKPatchTemplate.
(id) - controllerValues:
 Sent by the MKSynthInstrument to a MKSynthPatch when a new tag stream begins, before the noteOn: message is sent.
(id) - noteOnSelf:
 aNote is assumed to be a noteOn or noteDur.
(id) - preemptFor:
 Preempts envelope, if any.
(id) - noteUpdateSelf:
 aNote is assumed to be a noteUpdate and the receiver is assumed to be currently playing a Note.
(double) - noteOffSelf:
 aNote is assumed to be a noteOff.
(id) - noteEndSelf
 Resest instance variables to default values.

Static Public Member Functions

(id) + patchTemplateFor:
 Returns a default template.


Detailed Description

FM with arbitrary waveforms for carrier and modulator and an interpolating oscillator for the carrier.

Fm1i is an FM (frequency modulation) MKSynthPatch that uses an arbitrary-wavetable oscillator to modulate the frequency of another arbitrary-wavetable oscillator. Fm1i uses an interpolating oscillator for the carrier, while Fm1 uses a non-interpolating oscillator (lower quality, but uses less DSP computation.) Fm1i is used as the root class for a number of FM MKSynthPatches. It supports a wide variety of parameters, including many MIDI parameters. It supports a wide variety of parameters, including many MIDI parameters.

See the FM literature for details of FM synthesis. (Note that the implementation here is "frequency modulation" rather than "phase modulation" and that the deviation scaling does not follow the frequency envelope -- it is exactly as defined in the literature only when the frequency envelope is at 1.

When using this MKSynthPatch in an interactive real-time context, such as playing from a MIDI keyboard, call MKUseRealTimeEnvelopes() before allocating the MKSynthPatch.

Parameter Interpretation

afterTouch - MIDI afterTouch (also called channel pressure) attenuates the amount of frequency modulation. In the range 0:127. A value of 127 (the default) produces no attenuation.

afterTouchSensitivity - Controls the amount of attenuation caused by afterTouch. If afterTouchSensitivity is 1.0 and afterTouch is 0, modulation is 0. If afterTouchSensitivity is .5 and afterTouch is 0, modulation is half the normal amount. Default sensitivity is 0.5.

ampEnv - Amplitude envelope. Default is an envelope that is always a constant 1.0.

amp - Amplitude. In the range 0.0:1.0. amp1 is a synonym for amp. Default is 0.1.

amp0 - Amplitude when the envelope is at 0.0. amp is amplitude when the envelope is at 1.0. amp1 is a synonym for amp. Default is 0.0.

ampAtt - Time of attack portion of envelope in seconds. If this parameter is not present, the times in the envelope are used verbatim.

ampRel - Time of release portion of envelope in seconds. If this parameter is not present, the times in the envelope are used verbatim.

bearing - Left/right panning of signal. In range -45.0:45.0. -45.0 is far left. Default is 0.0.

bright - Brightness, a multiplier on fm index. Defaults to 1.0.

controlChange - This parameter is the MIDI controller number to be affected. It is used in conjunction with the parameter controlVal, which provides the value the controller is set to. This SynthPatch uses MIDI volume (controller 7) to adjust output volume as an attenuation of the final output signal. The default for MIDI volume is 127.

controlVal - See controlChange.

cRatio - Carrier frequency scaler. The resulting carrier frequency is cRatio multiplied by the freq parameter (or the frequency derived from the keyNum parameter). c1Ratio is a synonym. Default is 1.0.

freq - Frequency in Hz. freq1 is a synonym for freq. Default is A440.

freqEnv - Frequency envelope. Default is an envelope that is always a constant 1.0.

freq0 - Fundamental frequency when the envelope is at 0. freq is frequency when the envelope is at 1. freq1 is a synonym for freq. Default is 0.0.

freqAtt - Time of attack portion of envelope in seconds. If this parameter is not present, the times in the envelope are used verbatim.

freqRel - Time of release portion of envelope in seconds. If this parameter is not present, the times in the envelope are used verbatim.

keyNum - The MIDI key number, an alternative to freq. If both freq and keyNum are present, freq, takes precedence. In the range 0:127.

m1Ind - Modulation index. If an envelope, is specified, this is the index when the envelope is at 1. m1Ind1 is synonym for m1Ind. Default is 2.0.

m1IndEnv - Modulation index envelope. Default is a constant value of 1.0.

m1Ind0 - Modulation index when envelope is at 0.0. m1Ind is index when envelope is at 1.0. Default is 0.0.

m1IndAtt -Time of attack portion of envelope in seconds. If this parameter is not present, the times in the envelope are used verbatim.

m1IndRel - Time of release portion of envelope in seconds. If this parameter is not present, the times in the envelope are used verbatim.

m1Ratio - Modulator frequency scaler. The resulting modulator frequency is m1Ratio multiplied by the freq parameter. Default is 1.0.

m1Phase - Initial phase in degrees of modulator wavetable. Rarely needed. Default is 0.0.

m1Waveform - Modulator wave table. Default produces a sine wave. If you specify a MKSamples object to an FM MKSynthPatch, the length may be any power of 2.

phase - Initial phase of wavetable in degrees. Rarely needed. Default is 0.0.

pitchBend - Modifies frequency (or keyNum) as a 14 bit integer. A value of MIDI_ZEROBEND (defined as 0x2000 in <mididriver/midi_spec.h>) gives no bend. 0 is maximum negative bend. 0x3fff is maximum positive bend. See MKTuningSystem class for details. May give unexpected results when combined with frequency envelopes. Default is MIDI_ZEROBEND.

portamento - Portamento time. In a phrase, the transition time to a note from the immediately preceding note. Overrides the time values of the first segment of the envelopes. Note that portamento is applied after the attack-time parameters.

velocity - A MIDI parameter. In range 0:127. The default is 64. Velocity scales amplitude by an amount deteremined by velocitySensitivity. Some SynthPatches also scale brightness or FM index based on velocity.

velocitySensitivity - In range 0.0:1.0. Default is 0.5. When velocitySensitivity is 0, velocity has no effect. pitchBendSensitivity - A value of 0.0 means pitchBend has no effect. A value of 1.0 means pitch bend corresponds to plus or minus a semitone. Larger values give larger pitch deviation. Default is 3.0.

waveform - WaveTable used for the oscillator (only the carrier, in the case of FM). Defaults to sine. Note that the WaveTable you supply is normalized so that its peak amplitude is 1.0.

waveLen - Length of wavetable. Defaults to an optimal value. May only be set at the start of a phrase or with a noteUpdate that has no noteTag.


Member Function Documentation

+ (id) patchTemplateFor: (id)  currentNote  

Returns a default template.

Parameters:
currentNote is an id.
Returns:
Returns an id. currentNote is ignored.

- (id) init  

Sent by the MKOrchestra only when a new MKSynthPatch has just been created and before its MKUnitGenerator connections have been made, as defined by the MKPatchTemplate.

Returns:
Returns an id. A subclass may override the init method to provide additional initialization. A return of nil aborts the creation and frees the new MKSynthPatch. The default implementation does nothing and returns the receiver.

Reimplemented from MKSynthPatch.

- (id) controllerValues: (id)  controllers  

Sent by the MKSynthInstrument to a MKSynthPatch when a new tag stream begins, before the noteOn: message is sent.

The default implementation does nothing. You may override it in a subclass as desired.

Note that the sustain pedal controller is handled automatically by the MKSynthPatch class. Note that pitchbend is not a controller in MIDI. Thus the current pitchbend is included in the MKNote passed to noteOn:, not in the HashTable. See the HashTable spec sheet for details on how to access the values in controllers. The table should not be altered by the receiver.

Parameters:
controllers is a HashTable that describes the state of the MIDI controllers by mapping integer controller numbers to integer controller values.
Returns:
Returns an id.

Reimplemented from MKSynthPatch.

- (id) noteOnSelf: (MKNote *)  aNote  

aNote is assumed to be a noteOn or noteDur.

Parameters:
aNote is an id.
Returns:
Returns an id. This method triggers (or retriggers) the Note's envelopes, if any. If this is a new phrase, all instance variables are set to default values, then the values are read from the Note.

Reimplemented from MKSynthPatch.

- (id) preemptFor: (MKNote *)  aNote  

Preempts envelope, if any.

Parameters:
aNote is an id.
Returns:
Returns an id.

Reimplemented from MKSynthPatch.

- (id) noteUpdateSelf: (MKNote *)  aNote  

aNote is assumed to be a noteUpdate and the receiver is assumed to be currently playing a Note.

Parameters:
aNote is an id.
Returns:
Returns an id. Sets parameters as specified in aNote.

Reimplemented from MKSynthPatch.

- (double) noteOffSelf: (MKNote *)  aNote  

aNote is assumed to be a noteOff.

Parameters:
aNote is an id.
Returns:
Returns a double. This method causes the Note's envelopes (if any) to begin its release portion and returns the time for the envelopes to finish. Also sets any parameters present in aNote.

Reimplemented from MKSynthPatch.

- (id) noteEndSelf  

Resest instance variables to default values.

Returns:
Returns an id.

Reimplemented from MKSynthPatch.


The documentation for this class was generated from the following file:

Generated on Sat Dec 5 17:01:14 2009 for MusicKit by  doxygen 1.5.6