Namespaces

Variants
Actions

MSP Sampling Tutorial 3: Playback with Loops

From Cycling '74 Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "Click here to open the tutorial patch: 03sSamplePlaybackWithLoops.maxpat As we've seen in the last two sampling tutorials, there are a variety of objects for accessing da...")
 
(Play some loops)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
Click here to open the tutorial patch: [[03sSamplePlaybackWithLoops.maxpat]]
+
Click here to open the tutorial patch: [[Media:03sSamplePlaybackWithLoops.maxpat]]
  
As we've seen in the last two sampling tutorials, there
+
As we've seen in the last two sampling tutorials, there are a variety of objects for accessing data from an MSP {{maxword|name=buffer~}} object. This tutorial looks at another one which is specialized for working with looping sounds: {{maxword|name=groove~}}.
are a variety of objects for accessing data from an MSP {{maxword|name=buffer~}}
+
object. This tutorial looks at another one which is specialized for
+
working with looping sounds: {{maxword|name=groove~}}.
+
  
===Playing samples with {{maxword|name=groove~}}===
+
===Playing samples with groove~===
  
The {{maxword|name=groove~}} object is one of the most versatile
+
The {{maxword|name=groove~}} object is one of the most versatile objects for playing sound from a {{maxword|name=buffer~}}. You can specify the {{maxword|name=buffer~}} to read, the starting point, the playback speed (either forward or backward), and start and end points for a repeating loop within the sample. As with other objects that read from a {{maxword|name=buffer~}}, {{maxword|name=groove~}} accesses the {{maxword|name=buffer~}} remotely, without patch cords, by sharing its name.
objects for playing sound from a {{maxword|name=buffer~}}. You can
+
specify the {{maxword|name=buffer~}} to read, the starting point,
+
the playback speed (either forward or backward), and
+
start and end points for a repeating loop within the
+
sample. As with other objects that read from a {{maxword|name=buffer~}},
+
{{maxword|name=groove~}} accesses the {{maxword|name=buffer~}} remotely,
+
without patch cords, by sharing its name.
+
  
Take a look at {{maxword|name=groove~}} object in the tutorial patcher.
+
Take a look at {{maxword|name=groove~}} object in the tutorial patcher. The {{maxword|name=groove~}} object has three inlets which take both signals and standard Max messages. The left-hand inlet interprets a signal as its playback ''speed'', and a Max floating-point numeric message as its playback ''position''. This allows for event-level control of the playback point (to jump to an area of the sample) as well as a time-varying signal controlling the playback rate of the sound. The second and third inlets allow you to specify start and end points in the {{maxword|name=buffer~}} to be used as loops.
The {{maxword|name=groove~}} object has three inlets which take both
+
signals and standard Max messages. The left-hand inlet
+
interprets a signal as its playback ''speed'', and a Max
+
floating-point numeric message as its playback ''position''.
+
This allows for event-level control of the playback point (to
+
jump to an area of the sample) as well as a time-varying signal
+
controlling the playback rate of the sound. The second and
+
third inlets allow you to specify start and end points in the
+
{{maxword|name=buffer~}} to be used as loops.
+
  
The {{maxword|name=sig~}} object is an MSP object that outputs a constant
+
The {{maxword|name=sig~}} object is an MSP object that outputs a constant signal based on a floating-point numeric input. This signal drives the playback speed of the {{maxword|name=groove~}}. A signal of <code>1</code> causes normal-speed forward playback; a signal of <code>0.5</code> halves the speed (and drops the pitch of the sample by an octave); a signal of <code>-2</code> plays the sample at double-speed in reverse, and so on. While our tutorial uses constant-value signals for playback speed (supplied by the {{maxword|name=sig~}} object), there is no reason why we couldn't use a {{maxword|name=line~}}, {{maxword|name=cycle~}} or other MSP object as a control signal for the speed of the playback.
signal based on a floating-point numeric input. This signal
+
drives the playback speed of the {{maxword|name=groove~}}. A signal
+
of <code>1</code> causes normal-speed forward playback; a signal
+
of <code>0.5</code> halves the speed (and drops the pitch of the
+
sample by an octave); a signal of <code>-2</code> plays the sample
+
at double-speed in reverse, and so on. While our tutorial
+
uses constant-value signals for playback speed (supplied
+
by the {{maxword|name=sig~}} object), there is no reason why we couldn't
+
use a {{maxword|name=line~}}, {{maxword|name=cycle~}} or other MSP object as a
+
control signal for the speed of the playback.
+
  
The {{maxword|name=groove~}} object also understands a number of
+
The {{maxword|name=groove~}} object also understands a number of messages in its left inlet to control its behavior. The message <code>loop 1</code> turns looping on, which is to say that when the {{maxword|name=groove~}} object reaches the end of the sample (or the time specified in the third inlet) it will return instantly to the beginning of the sample (or the point specified in the second inlet). In addition, you can change which {{maxword|name=buffer~}} the {{maxword|name=groove~}} object accesses as its sample memory at any time by sending the message <code>set</code> followed by the name of a valid {{maxword|name=buffer~}} object --- in fact, you can do this with any {{maxword|name=buffer~}}-accessing MSP object, including {{maxword|name=index~}} and {{maxword|name=play~}}. In the tutorial patcher, a {{maxword|name=umenu}} object is loaded with the names of the three {{maxword|name=buffer~}} objects we've got in our patcher.
messages in its left inlet to control its behavior. The
+
message <code>loop 1</code> turns looping on, which is to say
+
that when the {{maxword|name=groove~}} object reaches the end of the
+
sample (or the time specified in the third inlet) it will
+
return instantly to the beginning of the sample (or the point
+
specified in the second inlet). In addition, you can change
+
which {{maxword|name=buffer~}} the {{maxword|name=groove~}} object accesses as its
+
sample memory at any time by sending the message <code>set</code>
+
followed by the name of a valid {{maxword|name=buffer~}} object --- in fact,
+
you can do this with any {{maxword|name=buffer~}}-accessing MSP object,
+
including {{maxword|name=index~}} and {{maxword|name=play~}}. In the tutorial patcher,
+
a {{maxword|name=umenu}} object is loaded with the names of the three {{maxword|name=buffer~}}
+
objects we've got in our patcher.
+
  
 
===Play some loops===
 
===Play some loops===
  
* Turn on the audio by clicking the {{maxword|name=ezdac~}} object and adjust the output
+
* Turn on the audio by clicking the {{maxword|name=ezdac~}} object and adjust the output volume of the patch using the floating-point {{maxword|name=number}} box on the right of the tutorial (labeled <code>Amplitude</code>). Click on the different circles in the {{maxword|name=preset}} object to play the samples in different ways.
volume of the patch using the floating-point {{maxword|name=number}} box on the
+
right of the tutorial (labeled <code>Amplitude</code>). Click on the different
+
circles in the {{maxword|name=preset}} object to play the samples in different ways.
+
  
The first preset just functions as an ‘Off’ button. The next three presets
+
The first preset just functions as an ‘Off’ button. The next three presets play the three {{maxword|name=buffer~}} objects at normal speed without looping. The rest of the presets demonstrate a variety of sound possibilities using different playback speeds on different excerpts of the buffered files, with or without looping.
play the three {{maxword|name=buffer~}} objects at normal speed without looping.
+
The rest of the presets demonstrate a variety of sound possibilities using
+
different playback speeds on different excerpts of the buffered files, with
+
or without looping.
+
  
* You may want to experiment with your own settings by changing the user
+
* You may want to experiment with your own settings by changing the user interface objects directly.
interface objects directly.
+
 
 +
----
 +
 
 +
'''Technical detail:''' In traditional sampler design, the system that plays back the samples is very similar in operation to a {{maxword|name=groove~}} object. Typically (for instrumental samples that are meant to loop) the sampler contains a handful of recorded samples of a few seconds duration, each of which is bound to a specific ''root key'', a note value at which it plays normally. Note values without samples play the nearest note that has a sample assigned to it either slightly fast or slightly slow by adjusting its playback rate. For notes that are meant to sustain (e.g. violins or synthesizer pads), the sample has metadata stored with it setting loop points within the sample which the synthesizer loops inside during sustained notes. Upon releasing the note, the sample plays out to the end.  
  
 
----
 
----
'''Technical detail:''' In traditional sampler design, the system that
 
plays back the samples is very similar in operation to a {{maxword|name=groove~}} object.
 
Typically (for instrumental samples that are meant to loop) the
 
sampler contains a handful of recorded samples of a few seconds
 
duration, each of which is bound to a specific ''root key'',
 
a note value at which it plays normally. Note values without samples
 
play the nearest note that has a sample assigned to it either slightly
 
fast or slightly slow by adjusting its playback rate. For notes that are
 
meant to sustain (e.g. violins or synthesizer pads), the sample has
 
metadata stored with it setting loop points within the sample which
 
the synthesizer loops inside during sustained notes. Upon releasing the
 
note, the sample plays out to the end.
 
----
 
  
If you want to create smooth undetectable loops with {{maxword|name=groove~}},
+
If you want to create smooth undetectable loops with {{maxword|name=groove~}}, you can use the <code>loopinterp</code> message to enable crossfades between the end of a loop and the beginning of the next pass through the loop to smooth out the transition back to the start point (see the {{maxword|name=groove~}} <link type="vignette" module="core" name="docrefpages">Object reference page</link> for more information on this message). If the {{maxword|name=buffer~}} contains an AIFF file that has its own loop points - points established in a separate audio editing program - there is a way to use those loop points to set the loop points of {{maxword|name=groove~}}.
you can use the <code>loopinterp</code> message to enable crossfades between
+
 
the end of a loop and the beginning of the next pass through the loop
+
The {{maxword|name=info~}} object can report the loop points of an AIFF file contained in a {{maxword|name=buffer~}}, and you can send those loop start and end times directly into {{maxword|name=groove~}}. You can also use the the {{maxword|name=info~}} object to find out the length (in milliseconds) of any file you load into a buffer.
to smooth out the transition back to the start point (see the {{maxword|name=groove~}}
+
<link type="vignette" module="core" name="docrefpages">Object reference page</link>
+
for more information on this message). If the {{maxword|name=buffer~}}
+
contains an AIFF file that has its own loop points - points established
+
in a separate audio editing program - there is a way to use those loop
+
points to set the loop points of {{maxword|name=groove~}}.
+
  
The {{maxword|name=info~}} object can report the loop points of an AIFF file
+
[[Image:Samplingchapter03a.png|border]]
contained in a {{maxword|name=buffer~}}, and you can send those loop start and
+
end times directly into {{maxword|name=groove~}}. You can also use the the {{maxword|name=info~}}
+
object to find out the length (in milliseconds) of any file you load into a buffer.
+
  
[[Image:Samplingchapter03a.png|border]]
 
 
''Using info~ to get loop point information from an AIFF file''
 
''Using info~ to get loop point information from an AIFF file''
  
 
===Summary===
 
===Summary===
  
The {{maxword|name=groove~}} object is the most versatile way to play sound
+
The {{maxword|name=groove~}} object is the most versatile way to play sound from a {{maxword|name=buffer~}}. You can specify the {{maxword|name=buffer~}} to read, the starting point, the playback speed (either forward or backward), and starting and ending points for a repeating loop within the sample. If the {{maxword|name=buffer~}} contains an AIFF file that has its own pre-established loop points, you can use the {{maxword|name=info~}} object to get those loop times and send them to {{maxword|name=groove~}}. The playback speed of {{maxword|name=groove~}} is determined by the value of the signal coming in its left inlet. You can set the current buffer position of {{maxword|name=groove~}} by sending a <code>float</code> time value in the left inlet.
from a {{maxword|name=buffer~}}. You can specify the {{maxword|name=buffer~}} to read, the
+
starting point, the playback speed (either forward or backward), and
+
starting and ending points for a repeating loop within the sample. If
+
the {{maxword|name=buffer~}} contains an AIFF file that has its own pre-established
+
loop points, you can use the {{maxword|name=info~}} object to get those loop times
+
and send them to {{maxword|name=groove~}}. The playback speed of {{maxword|name=groove~}} is
+
determined by the value of the signal coming in its left inlet. You can
+
set the current buffer position of {{maxword|name=groove~}} by sending a <code>float</code>
+
time value in the left inlet.
+
  
 
===See Also===
 
===See Also===

Latest revision as of 21:27, 28 June 2012

Click here to open the tutorial patch: Media:03sSamplePlaybackWithLoops.maxpat

As we've seen in the last two sampling tutorials, there are a variety of objects for accessing data from an MSP buffer~ object. This tutorial looks at another one which is specialized for working with looping sounds: groove~.

Contents

[edit] Playing samples with groove~

The groove~ object is one of the most versatile objects for playing sound from a buffer~. You can specify the buffer~ to read, the starting point, the playback speed (either forward or backward), and start and end points for a repeating loop within the sample. As with other objects that read from a buffer~, groove~ accesses the buffer~ remotely, without patch cords, by sharing its name.

Take a look at groove~ object in the tutorial patcher. The groove~ object has three inlets which take both signals and standard Max messages. The left-hand inlet interprets a signal as its playback speed, and a Max floating-point numeric message as its playback position. This allows for event-level control of the playback point (to jump to an area of the sample) as well as a time-varying signal controlling the playback rate of the sound. The second and third inlets allow you to specify start and end points in the buffer~ to be used as loops.

The sig~ object is an MSP object that outputs a constant signal based on a floating-point numeric input. This signal drives the playback speed of the groove~. A signal of 1 causes normal-speed forward playback; a signal of 0.5 halves the speed (and drops the pitch of the sample by an octave); a signal of -2 plays the sample at double-speed in reverse, and so on. While our tutorial uses constant-value signals for playback speed (supplied by the sig~ object), there is no reason why we couldn't use a line~, cycle~ or other MSP object as a control signal for the speed of the playback.

The groove~ object also understands a number of messages in its left inlet to control its behavior. The message loop 1 turns looping on, which is to say that when the groove~ object reaches the end of the sample (or the time specified in the third inlet) it will return instantly to the beginning of the sample (or the point specified in the second inlet). In addition, you can change which buffer~ the groove~ object accesses as its sample memory at any time by sending the message set followed by the name of a valid buffer~ object --- in fact, you can do this with any buffer~-accessing MSP object, including index~ and play~. In the tutorial patcher, a umenu object is loaded with the names of the three buffer~ objects we've got in our patcher.

[edit] Play some loops

  • Turn on the audio by clicking the ezdac~ object and adjust the output volume of the patch using the floating-point number box on the right of the tutorial (labeled Amplitude). Click on the different circles in the preset object to play the samples in different ways.

The first preset just functions as an ‘Off’ button. The next three presets play the three buffer~ objects at normal speed without looping. The rest of the presets demonstrate a variety of sound possibilities using different playback speeds on different excerpts of the buffered files, with or without looping.

  • You may want to experiment with your own settings by changing the user interface objects directly.

Technical detail: In traditional sampler design, the system that plays back the samples is very similar in operation to a groove~ object. Typically (for instrumental samples that are meant to loop) the sampler contains a handful of recorded samples of a few seconds duration, each of which is bound to a specific root key, a note value at which it plays normally. Note values without samples play the nearest note that has a sample assigned to it either slightly fast or slightly slow by adjusting its playback rate. For notes that are meant to sustain (e.g. violins or synthesizer pads), the sample has metadata stored with it setting loop points within the sample which the synthesizer loops inside during sustained notes. Upon releasing the note, the sample plays out to the end.


If you want to create smooth undetectable loops with groove~, you can use the loopinterp message to enable crossfades between the end of a loop and the beginning of the next pass through the loop to smooth out the transition back to the start point (see the groove~ <link type="vignette" module="core" name="docrefpages">Object reference page</link> for more information on this message). If the buffer~ contains an AIFF file that has its own loop points - points established in a separate audio editing program - there is a way to use those loop points to set the loop points of groove~.

The info~ object can report the loop points of an AIFF file contained in a buffer~, and you can send those loop start and end times directly into groove~. You can also use the the info~ object to find out the length (in milliseconds) of any file you load into a buffer.

Samplingchapter03a.png

Using info~ to get loop point information from an AIFF file

[edit] Summary

The groove~ object is the most versatile way to play sound from a buffer~. You can specify the buffer~ to read, the starting point, the playback speed (either forward or backward), and starting and ending points for a repeating loop within the sample. If the buffer~ contains an AIFF file that has its own pre-established loop points, you can use the info~ object to get those loop times and send them to groove~. The playback speed of groove~ is determined by the value of the signal coming in its left inlet. You can set the current buffer position of groove~ by sending a float time value in the left inlet.

[edit] See Also

buffer~ - Store audio samples

groove~ - Variable-rate looping sample playback

sig~ - Constant signal of a number