(max) record and play

example patcher

recording to a buffer~

Recording to a [buffer~] object is pretty straightforward. You need an audio input (I’m using [ezadc~] in the example), connected to a [record~] object. A non-zero number to [record~] starts recording; zero turns recording off. A [toggle] objects provides easy control, but for remote control purposes it might make more sense to use something like a sustain pedal to start and stop recording ([ctlin 64]). It’s handy to have a signal level meter to make sure your input audio is at an appropriate level (such as [meter~] or [levelmeter~]). You need to make sure your [buffer~] object has enough space (time specified in ms) to record whatever your might need. I err on the large size when specifying buffers for recording.

playing back, with looping immediately after recording

If you want to emulate the functionality of a looping pedal you can do that as well. You just need to keep track of time. A looping pedal is a device that allows you to input audio for a specified or user-controlled period of time and then immediately playback the recorded material as a loop.

You can use [timer] to keep track of the actual length of your recorded audio segment. A bang in the left inlet of [timer] clears and starts the interval to be timed. A bang in the right inlet causes the current time to be reported. The example patcher has a [select 0] object connected to the output of the [toggle]. I’m looking for “off” and anything else, rather than a specific “on” and “off” messages because of the different number values that toggle can report. If I click on the toggle, it outputs a 1. If the toggle is turned on by some other message, such as a sustain pedal on message, it is receiving and outputting something different from 1. Most sustain pedals send a 127 value when pressed, and 0 when released. I can’t always predict what will turn on the toggle, but I can be sure of what will turn it off. So I look for off messages as 0, and consider anything else from the toggle to be an on message.

The [timer] reports the time of recording when recording stops, and it sends that information to [waveform~] as the selection times. Selections in [waveform~] are then sent as loop points to [groove~].

The full control process for recording on/off and timing:

  • start recording with either the toggle of the sustain pedal.
  • starting a recording sends a message to clear the [buffer~] and start the [timer].
  • stopping recording triggers the following events/messages:
    • sends recordOff message to [timer]
    • sends recordOff message to set [groove~] playback ratio/speed to 1.
    • sends recordOff message to set [groove~] location to 0. ( to start at the beginning of the loop)
    • [timer] outputs the duration of the recording to [t f b].
    • [t f b] sends a bang to set the start of the selection in [waveform~] to 0., and the sends a float to [waveform~] as the selection end time.
    • [waveform~] sends its selection start and end times to [groove~] as the loop start and end points.

Comments

Leave a Reply