Functions | |
double | MKdB (double dB) |
Convert decibels to amplitude. | |
double | MKMidiToAmp (int midiValue) |
Translate loudness from the MusicKit to MIDI. Maps MIDI value (such as velocity) onto an amplitude scaler such that 64->1.0, 127->10.0, and 0->0. | |
double | MKMidiToAmpWithSensitivity (int midiValue, double sensitivity) |
Translate loudness from the MusicKit to MIDI. Same as MKMidiToAmp, but uses sensitivity to control how much effect midiValue has. | |
int | MKAmpToMidi (double amp) |
Translate loudness from the MusicKit to MIDI. Maps an amplitude scaler onto velocity such that MKAmpToMidi(MKMidiToAmp(x)) == x. | |
double | MKMidiToAmpAttenuation (int midiValue) |
Translate loudness from the MusicKit to MIDI. Maps MIDI controller values (e.g. volume pedal) onto an amplitude scaler such that 64->0.1, 127->1.0, and 0->0. | |
double | MKMidiToAmpAttenuationWithSensitivity (int midiValue, double sensitivity) |
Translate loudness from the MusicKit to MIDI. Maps MIDI controller values (e.g. volume pedal) onto an amplitude scaler such that 64->0.1, 127->1.0, and 0->0. Uses sensitivity to control how much effect midiValue has. | |
int | MKAmpAttenuationToMidi (double amp) |
Translate loudness from the MusicKit to MIDI. Maps an amplitude scaler onto velocity such that MKAmpAttenuationToMidi(MKMidiToAmpAttenuation(x)) == x. |
int MKAmpAttenuationToMidi | ( | double | amp | ) |
Translate loudness from the MusicKit to MIDI. Maps an amplitude scaler onto velocity such that MKAmpAttenuationToMidi(MKMidiToAmpAttenuation(x)) == x.
These functions help you convert MusicKit amplitude values to MIDI values and vice versa.
MKAmpToMidi() and MKMidiToAmp() are complementary functions that provide a non-linear mapping of amplitude to MIDI values, as described below:
MKAmpToMidi(double amp) returns 64 + (64 * log10 amp) MKMidiToAmp(int midiValue) returns 10.0(midiValue-64)/64
This provides a scale in which an amp of 0.0 yields a MIDI value of 0, 1.0 produces 64, and 10.0 gives 127.
MKAmpAttenuationToMidi() and MKMidiToAmpAttenuation() are similarly complementary, and the curve of the mapping is the same as in the foregoing, but the scale is attenuated by a factor of ten: 0.0 maps to 0, 0.1 to 64, and 1.0 to 127.
MKMidiToAmpWithSensitivity() and MKMidiToAmpAttenuationWithSensitivity() are modifications of the similarly named MKMidiToAmp and MKMidiToAmpAttenuation functions in which an additional sensitivity value, nominally in the range 0.0 to 1.0, is used to scale the product of the conversion.
The multiplicity of conversion functions is provided in deference to the nature of MIDI volume computation: Unlike DSP-bound amplitude values (specifically, the value of the MK_amp parameter), effective MIDI volume is a combination of a number of parameters, the primary ones being velocity, main volume control, and foot pedal control. While the velocity value generated by a MIDI instrument is almost never at the maximum, the other values often are. In general, you use MKAmpToMidi() and MKMidiToAmp() (or MKMidiToAmpWithSensitivy()) to convert between amplitude and velocity. The amp attenuation functions are used to generate a value from or to be applied to one of MIDI controller parameters.
amp | is a double. |
int MKAmpToMidi | ( | double | amp | ) |
Translate loudness from the MusicKit to MIDI. Maps an amplitude scaler onto velocity such that MKAmpToMidi(MKMidiToAmp(x)) == x.
These functions help you convert MusicKit amplitude values to MIDI values and vice versa.
MKAmpToMidi() and MKMidiToAmp() are complementary functions that provide a non-linear mapping of amplitude to MIDI values, as described below:
MKAmpToMidi(double amp) returns 64 + (64 * log10 amp) MKMidiToAmp(int midiValue) returns 10.0 (midiValue - 64) / 64
This provides a scale in which an amp of 0.0 yields a MIDI value of 0, 1.0 produces 64, and 10.0 gives 127.
The multiplicity of conversion functions is provided in deference to the nature of MIDI volume computation: Unlike DSP-bound amplitude values (specifically, the value of the MK_amp parameter), effective MIDI volume is a combination of a number of parameters, the primary ones being velocity, main volume control, and foot pedal control. While the velocity value generated by a MIDI instrument is almost never at the maximum, the other values often are. In general, you use MKAmpToMidi() and MKMidiToAmp() (or MKMidiToAmpWithSensitivy()) to convert between amplitude and velocity. The amp attenuation functions are used to generate a value from or to be applied to one of MIDI controller parameters.
amp | is a double. |
double MKdB | ( | double | dB | ) |
Convert decibels to amplitude.
MKdB() returns an amplitude value (within the range [0.0, 1.0]) converted from its argument specified as decibels. The returned value can be used to set a MKUnitGenerator's amplitude, for example. The value is converted using the following formula:
amplitude = 10.0 dB / 20.0
For example, MKdB(-60) returns ca. .001 and MKdB(0.0) returns 1.0.
dB | is a double. |
double MKMidiToAmp | ( | int | midiValue | ) |
Translate loudness from the MusicKit to MIDI. Maps MIDI value (such as velocity) onto an amplitude scaler such that 64->1.0, 127->10.0, and 0->0.
These functions help you convert MusicKit amplitude values to MIDI values and vice versa. This is primarily designed for scaling amplitude by a value derived from MIDI velocity.
MKAmpToMidi() and MKMidiToAmp() are complementary functions that provide a non-linear mapping of amplitude to MIDI values, as described below:
MKAmpToMidi(double amp) returns 64 + (64 * log10 amp) MKMidiToAmp(int midiValue) returns 10.0 (midiValue - 64) / 64
This provides a scale in which an amp of 0.0 yields a MIDI value of 0, 1.0 produces 64, and 10.0 gives 127.
MKAmpAttenuationToMidi() and MKMidiToAmpAttenuation() are similarly complementary, and the curve of the mapping is the same as in the foregoing, but the scale is attenuated by a factor of ten: 0.0 maps to 0, 0.1 to 64, and 1.0 to 127.
The multiplicity of conversion functions is provided in deference to the nature of MIDI volume computation: Unlike DSP-bound amplitude values (specifically, the value of the MK_amp parameter), effective MIDI volume is a combination of a number of parameters, the primary ones being velocity, main volume control, and foot pedal control. While the velocity value generated by a MIDI instrument is almost never at the maximum, the other values often are. In general, you use MKAmpToMidi() and MKMidiToAmp() (or MKMidiToAmpWithSensitivy()) to convert between amplitude and velocity. The amp attenuation functions are used to generate a value from or to be applied to one of MIDI controller parameters.
midiValue | is an int. |
double MKMidiToAmpAttenuation | ( | int | midiValue | ) |
Translate loudness from the MusicKit to MIDI. Maps MIDI controller values (e.g. volume pedal) onto an amplitude scaler such that 64->0.1, 127->1.0, and 0->0.
These functions help you convert MusicKit amplitude values to MIDI values and vice versa.
MKAmpAttenuationToMidi() and MKMidiToAmpAttenuation() are similarly complementary, and the curve of the mapping is the same as MKAmpToMidi() and MKMidiToAmp, but the scale is attenuated by a factor of ten: 0.0 maps to 0, 0.1 to 64, and 1.0 to 127.
The multiplicity of conversion functions is provided in deference to the nature of MIDI volume computation: Unlike DSP-bound amplitude values (specifically, the value of the MK_amp parameter), effective MIDI volume is a combination of a number of parameters, the primary ones being velocity, main volume control, and foot pedal control. While the velocity value generated by a MIDI instrument is almost never at the maximum, the other values often are. In general, you use MKAmpToMidi() and MKMidiToAmp() (or MKMidiToAmpWithSensitivy()) to convert between amplitude and velocity. The amp attenuation functions are used to generate a value from or to be applied to one of MIDI controller parameters.
midiValue | is an int. |
double MKMidiToAmpAttenuationWithSensitivity | ( | int | midiValue, | |
double | sensitivity | |||
) |
Translate loudness from the MusicKit to MIDI. Maps MIDI controller values (e.g. volume pedal) onto an amplitude scaler such that 64->0.1, 127->1.0, and 0->0. Uses sensitivity to control how much effect midiValue has.
These functions help you convert MusicKit amplitude values to MIDI values and vice versa.
MKAmpToMidi() and MKMidiToAmp() are complementary functions that provide a non-linear mapping of amplitude to MIDI values, as described below:
MKAmpToMidi(double amp) returns 64 + (64 * log10 amp) MKMidiToAmp(int midiValue) returns 10.0(midiValue-64)/64
This provides a scale in which an amp of 0.0 yields a MIDI value of 0, 1.0 produces 64, and 10.0 gives 127.
MKMidiToAmpWithSensitivity() and MKMidiToAmpAttenuationWithSensitivity() are modifications of the similarly named MKMidiToAmp and MKMidiToAmpAttenuation functions in which an additional sensitivity value, nominally in the range 0.0 to 1.0, is used to scale the product of the conversion.
The multiplicity of conversion functions is provided in deference to the nature of MIDI volume computation: Unlike DSP-bound amplitude values (specifically, the value of the MK_amp parameter), effective MIDI volume is a combination of a number of parameters, the primary ones being velocity, main volume control, and foot pedal control. While the velocity value generated by a MIDI instrument is almost never at the maximum, the other values often are. In general, you use MKAmpToMidi() and MKMidiToAmp() (or MKMidiToAmpWithSensitivy()) to convert between amplitude and velocity. The amp attenuation functions are used to generate a value from or to be applied to one of MIDI controller parameters.
midiValue | is an int. | |
sensitivity | is a double. |
double MKMidiToAmpWithSensitivity | ( | int | midiValue, | |
double | sensitivity | |||
) |
Translate loudness from the MusicKit to MIDI. Same as MKMidiToAmp, but uses sensitivity to control how much effect midiValue has.
These functions help you convert MusicKit amplitude values to MIDI values and vice versa.
MKMidiToAmpWithSensitivity() and MKMidiToAmpAttenuationWithSensitivity() are modifications of the similarly named MKMidiToAmp and MKMidiToAmpAttenuation functions in which an additional sensitivity value, nominally in the range 0.0 to 1.0, is used to scale the product of the conversion.
The multiplicity of conversion functions is provided in deference to the nature of MIDI volume computation: Unlike DSP-bound amplitude values (specifically, the value of the MK_amp parameter), effective MIDI volume is a combination of a number of parameters, the primary ones being velocity, main volume control, and foot pedal control. While the velocity value generated by a MIDI instrument is almost never at the maximum, the other values often are. In general, you use MKAmpToMidi() and MKMidiToAmp() (or MKMidiToAmpWithSensitivy()) to convert between amplitude and velocity. The amp attenuation functions are used to generate a value from or to be applied to one of MIDI controller parameters.
midiValue | is an int. | |
sensitivity | is a double. |