(max) theremin fun, part 2

Continuing with the description of patchers from part 1

ThereminInProgressLCD

ThereminInProgressLCD starts to convert ThereminInProgress from mousestate control to LCD drawing control. No data is being fed to saw~, so audio is not in use for this patcher. The main focus is the LCD and sprite control within it.

On the right of the LCD are drawing commands, some of which are new. Moving from the top down, a loadmess is used to turn on idle for the LCD, which will send mouse location out the second outlet when the mouse is moved over the LCD without any buttons pressed.

Next, you find that X/Y position is being received from a send object (s idleMouse). The X/Y data feeds into the prepend object, outputting <drawsprite circle x y>. A sprite is a graphic image that draws on top of an object. in this case, it is a thick circle that follows the mouse when the LCD is in idle mode. When you press the mouse button down, the sprite stops moving and a line is drawn that follows the mouse position.

Below the prepend object you have a loadbang. It triggers a message to enablesprites (allowing for sprites to appear in the LCD), and then it records a sprite for later use. All of the sprite commands and messages are found in the LCD help patcher. The message starts recording a sprite, changes the pen size, then gives a command to paint a frameoval with a startX startY endX endY R G B values. (-12 = equals 12 pixels to left and above current mouse location to 12 pixels to the right and below current mouse location.)

ThereminInProgressLCD2

ThereminInProgressLCD2 is a fully functional Theremin, that outputs mouse X/Y position when the mouse button is down, scales it to pitch and amplitude, and uses it for oscillator playback.

Some issues were initially encountered with drawing and only creating sound when the mouse button is down. In the previous patcher, the sprite would remain visible even when the mouse button was down. It would be better to not have the idle sprite display when the mouse was drawing. To accomplish this task I used the third outlet of LCD to track whether the mouse button was pressed. Pressing the mouse button (the message 1) caused a hidesprite circle message to be sent to the LCD. Releasing the mouse button (message 0) was used to trigger a clear message to the LCD. It seemed aesthetically pleasing to have the drawn line remain on screen for a very short time, so I routed the bang through a delay message.

To only have audio playing when the mouse was drawing in the LCD, I again used the mouse button state from the third outlet. After the amplitude value from mouse Y was applied to the oscillator signal, another audio multiply was added. At this point in the audio chain the signal is being multiplied by the mouse state, either 1 for down or 0 for up.

One final note is that the two meter~ objects have different settings for the number of light segments.

ThereminLCDCleaner

ThereminLCDCleaner is functionally the same as LCD2. The drawing functions have been incorporated into a patcher object, as has the oscillator selection section. A loadmess has been added to select the sawtooth wave upon loading, and a live.gain~ has been added to allow for final output volume control (separate from mouse tracking) and metering.

I will revisit the ThereminLCD when we start to talk about audio effects.


Comments

Leave a Reply