mc.midiplayer~
Generate MIDI Events from Audio Signals
Description
The mc.midiplayer~ object generates note-on and note-off messages from audio signals representing triggers, note numbers, and velocity values. Typically you'll connect mc.midiplayer~ to vst~ which allows sample-accurate MIDI events at audio rates (assuming the hosted plug-in supports it).
Arguments
None.
Attributes
chanmod[int]
Each incoming audio channel to mc.midiplayer~ can only generate one MIDI event at a time. The chanmod attribute determines how multiple audio channels map to MIDI channels. The minimum value of chanmod is 1, which means all audio channels generate note events on MIDI channel 1. The maximum value of chanmod is 16, where mc.midiplayer~ uses all 16 available MIDI channels. When mpemode is enabled, the maximum value of chanmod is 15, since MPE uses channel 1 for global MIDI events.
defaultdur[float]
When triggermode is set to Phasor, mc.midiplayer~ sends a note-on at the beginning of a phasor ramp and a note-off when the phasor resets. The defaultdur sets the point in the ramp that triggers the note-off event. For example, if defaultdur is set to 0.5, a note-off is sent when the input phasor reaches 0.5. To set a duration proportion for each channel, use the message with the selector. When defaultdur is changed, it does not override any channel-specific duration values set. To cause a channel to use the value of defaultdur for note durations, set its channel-specific dutation to zero.
defaultnote[int]
Sets the note number to use for all future note events. It has the same effect as sending a number to the middle inlet of the object. This setting is ignored if a signal is connected to the middle (note number) inlet of mc.midiplayer~. To set a note number for each channel, send the message with a number argument to the middle inlet. When defaultnote is changed, it does not override any channel-specific note number values set. To cause a channel to use the value of defaultnote for note number, set its channel-specific note number to zero.
defaultvelocity[int]
Sets the velocity to use for all future note-on events. It has the same effect as sending a number to the middle inlet of the object. This setting is ignored if a signal is connected to the right (velocity) inlet of mc.midiplayer~. To set a velocity value for each channel, send the message with a number argument to the right inlet. When defaultvelocity is changed, it does not override any channel-specific note number values set. To cause a channel to use the value of defaultvelocity for its velocity, set its channel-specific velocity to zero.
mpemode[int]
When mpemode is enabled, note events are not sent on MIDI channel 1 and the chanmod attribute has a maximum value of 15.
playzero[int]
When playzero is enabled, MIDI note events play even if the note number is zero. Disabling playzero is useful when using the same signal for triggering and assigning note numbers when triggermode is set to Edge or Change. Note: input velocity values of 0 disable note events irrespective of the setting of playzero.
triggermode[int]
Determines how the input trigger signal (connected to the left inlet) generates note events
Possible values:
0 = 'Phasor'
(
Trigger notes based on phasor ramps
)
When triggermode is set to Phasor, the first rising sample value of the ramp triggers a note-on and the first descending (reset) sample triggers a note-off. If the duration proportion (via the message or defaaultdur attribute) is less than 1.0, the note-off will be triggered when the ramp value reaches the specified value.
1 = 'Edge'
(
Trigger notes based on logical sample value transitions
)
When triggermode is set to Edge, a note-on is triggered by a zero to non-zero transition in the input signal, and a note-off is triggered by a non-zero to zero transition.
2 = 'Change'
(
Trigger notes based on sample value changes
)
When triggermode is set to Change, a note-on is triggered whenever the sample value changes. If a note is already playing, the note-off for the playing event is sent first. If you don't want notes playing continuously, disabling the playzero attribute is useful, since a note number value of zero will trigger a note-off (if necessary) without playing another note.
velcurve[float]
The velcurve attribute introduces a non-linearity into the velocity values of MIDI events. For a more traditional curve, use a negative value (the default is -0.75). A value of 0 means there is no non-linearity, and positive values introduce a less traditional non-linearity where lower input values rise more quickly relative to higher input values. The built-in non-linear function is based on a simple Bezier curve; for more options scaling the input before it arrives at the right inlet of mc.midiplayer~ refer to the Ease package.
Common Box Attributes
annotation[symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background[int]: 0
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.
color[4 floats]
Sets the color for the object box outline.
fontface[int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname[symbol]
Sets the object's font.
fontsize[float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hint[symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick[int]: 0
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile[symbol]
You can override the default appearance of a user interface object by assigning a JavaScript file with code for painting the object. The file must be in the search path.
patching_rect[4 floats]: 0. 0. 100. 0.
Sets the position and size of the object in the patcher window.
position[2 floats]
write-only
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation[int]: 0
Sets whether an object belongs to the patcher's presentation.
presentation_rect[4 floats]: 0. 0. 0. 0.
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect[4 floats]
write-only
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size[2 floats]
write-only
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor[4 floats]
Sets the color for the object's text in RGBA format.
textjustification[int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname[symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Messages
int
A number in the middle inlet sets a note number for future note events. A number in the right inlet sets a velocity value for future note events. This sets values globally for all MIDI channels. To set note numbers, velocities, or durations per channel, use the
message. These values are ignored if a signal is connected to the corresponding inlet.
float
See the
message.
setvalue
The triggermode is set to Phasor. See the defaultdur attribute for more details.
message assigns note numbers, velocities or durations for future note-events to individual challenge. A channel number always follows the word . Following the channel number, if the message is sent to the middle inlet, a number sets the note number for the specified channel. If the message is sent to the right inlet, a number sets the velocity for the specified channel. In any inlet, channel value assigns a duration proportion to the channel when the
signal
If a signal is connected to the middle inlet, it sets the note number used when triggering a new note. If a signal is connected to the right inlet, it sets the velocity value used when triggering a new note-on.
See Also
Name | Description |
---|---|
phasor~ | Generate sawtooth signals |
vst~ | Host VST, VST3 and Audio Unit plug-ins |