
To keep a constant watch on the mouse position, use a fast-paced metro. The mousestate object reports the location of the mouse (its horizontal and vertical offset, in pixels, from the top-left corner of the screen area) out its second and third outlets every time it receives a bang in its inlet.
MIDI NOTE NUMBER TO NOTE PATCH
The central (green) portion of the patch shows one way you could use the position of the mouse to play notes. (Pop quiz: By inserting just one object, can you make it play a whole-tone scale instead?) The result is a one-octave upward chromatic scale. We use a select 72 object to detect when the count reaches 72, and when that number is detected we trigger a message of 0 to the toggle to turn it off. (See the counter reference page for details.) In this case, we used typed-in arguments to specify a minimum of 60 and a maximum of 72. The exact numbers in the count depend on the specified minimum, maximum, and direction values that have been provided to the counter. In the lower-right (purple) part of the patch, we use a metro to send out repeated triggers at a specified time interval, and we use a counter to count the events as they occur. Drag on the slider to play some notes.Īs demonstrated in the upper-right (yellow) portion of the patch, you can change the timbre of the synthesized sound by sending a MIDI program change number via the pgmout object.

Any numbers that come in faster than that will be suppressed. That object refuses to send out more than one number per time interval (specified by a typed-in argument or a number received in its right inlet). To limit the speed of such a rapid stream of numbers to something more like a human note speed, we use the speedlim object. It's often quite fast, say, 50 messages per second. The speed with which those messages come in is determined by the source device. The range of the slider, by default, is 0-127 just like the range of a MIDI controller value. You can also generate such values just by dragging on the slider with your mouse. The value of each controller 1 message comes out the left outlet of ctlin and is displayed graphically by the slider.

(You can double-click on the object to select the MIDI source.) Controller 1, by convention, designates the modulation wheel of most controllers.
.jpg)
The simplest thing is to send the notes to the built-in DLS synthesizer of your operating system.Īt the upper-left, in the blue portion of the patch, the ctlin object looks only for MIDI continuous controller messages with a controller number of 1 coming from an external source. You can double-click on noteout to choose the destination device. The outputs of makenote are designed to go directly to the pitch and velocity inlets of noteout, which formats a MIDI note message and sends the MIDI to an external destination. Using the duration value (supplied either as the second argument typed into the object box or as a number received in the right inlet), it schedules a corresponding note-off message to be sent that many milliseconds in the future at that time it sends out the same pitch with a velocity of 0. Admittedly they don't result in very interesting music, but they show ways how numbers can be converted for usage as pitch information.Īt the bottom-left, in the pink portion of the patch, the makenote object receives numbers in its left inlet, considers them to be MIDI pitch numbers, combines them with a velocity value (supplied either as the first argument typed into the object box or as a number received in the middle inlet) and sends them both out. Here are three ways of generating MIDI notes.
