Within its built-in looping modes a SNSamplePlayer lets you loop an array of consecutive buffers in such a way that all buffers are spread in the stereo or multichannel panorama. The built-in looping modes basically provide different ways of sequencing - either as audio grains within a Pbind or non-granular within a Pmono or Ndef. All these modes will create different output characteristics. However, to make playing most convenient and flexible, they all make use of the wonderful JITLib library, that allows an extremely flexible way of combining different concepts of sequencing and signal processing.
Create a new SNSampleLooper instance
name |
Optional - a Symbol or String, denoting the name of the new instance. If not given this willdefault to |
bufLength |
Optional - the maximum length of a single loop in seconds. If not given this will default to |
mode |
Optional - a Symbol or String, denoting the mode in which to play the looper. As of currently this may be one of the following: |
numOutChannels |
Optional - a Integer, denoting the number of output channels. The looped buffers will automatically be spread accross all channels. Spreading the output is handled either by a Splay (if |
server |
Optional - the Server on which to play the looper. If not set this will default to |
touchOSC |
Optional - a NetAddr under which an installation of the popular TouchOSC OSC controller is running. NOTE: The address will be used to send feedback to TouchOSC, so you must provide the port under which TouchOSC expects to receive OSC messages! Also, some of the widgets in CVCenter will automatically be connected, based on the IP address provided with the NetAddress. For this to work properly all elements in the TouchOSC interface (provided as layout file with SNSamplePlayer) need to be normalized, i.e. their output range must be 0.0-1.0. |
touchOSCPanel |
Optional - TouchOSC's user interface can be organized in a number of panels. Panels are numbered, beginning from |
an SNSamplePlayer instance
an Event, holding all current SNSamplePlayer instances
Set up the SNSamplePlayer before it can actually be played: Add an Array of buffers and define a node for an over-all volume control - setting the volume will be handled in a filter synth (more precisely: a NodeProxy role added to the end of an Ndef). If not given explicitely the volume control will be created with an ID 1000
.
bufferArray |
An Array of buffers that will be looped in the instance. Often this will be identical with an array of buffers created when setting up an SNSampler |
volumeControlNode |
Optional - an Integer, denoting the position of the volume control in the chain of synths and filters (defined in an Ndef or NodeProxy). NOTE: This ID is not a regular node ID in the server tree! |
Initialize or switch the mode in which the player will play. Available modes will be the ones described in *new.
argMode |
A Symbol - either |
bufferArray |
Optional - an array of buffers, initialized with Buffer: *allocConsecutive. NOTE: The number of buffers must be the same as the number of buffers for which the player was initialized! |
Start playing the SNSamplePlayer. Internally this will start playing the Ndef that keeps the loopers for all buffers. You may inspect the Ndef using an NdefMixer.
Pause the player. Internally this will pause the Ndef that keeps the loopers for all buffers.
Resume a paused player. Internally this will resume the Ndef that keeps the loopers for all buffers.
Quit the player. This will clear the loopers and all effects that have been chained to the output of the player. Once an SNSamplePlayer has been quit it can not be restarted but you can initialize a new one under the same name.
fadeTime |
A Float or Integer, determining the fade-out time of the player in seconds. |
When using mode \grain
(the default) it may happen under certain circumstances that grains are not freed properly (they remain on the server, consuming memory). In these cases calling this method will clear all nodes and free memory. Though this may have an audible effect new grains should build up automatically and it will often be preferable to have a short moment of silence than running out of memory.
SNSamplePlayer has originally been designed to be used in combination with SNSampler, allowing you to record sound sequences up to a specified length on the fly. However, sound sequences won't necessarily fill up a whole buffer which means, when looping over the buffer, silence at the end of the buffer will be part of the loop. This method tells the looper how much of the buffer should be used for looping.
The method especially makes sense in combination with the doneAction of an SNSampler. The doneAction
can be passed a numerical index
(the index of the buffer in the array of consecutive buffers for which the maximum loop length shall be set) and the length
of the loop in seconds.
index |
An Integer or a whole-numbered Float, denoting the index of the buffer in the array of consecutive buffers. |
length |
A Float, denoting the length of the loop in seconds. |
If set to true
the player will post information on the just played loops to the console.
bool |
A Boolean (either |
Set the NetAddr under which an installation of TouchOSC will be communicating with the sampler.
TouchOSC's graphical user interface is typically organized in panels. A toggle button on the first panel may be addressed through the following command name: /1/toggle1
. The touchOSCPanel
should allow you to specify the panel under which buttons connected to the SNSamplePlayer live.
The number of output channels. This is not the same as the number of buffers. Internally each buffers plays to its own channel(s). All buffer channels will then be spread over the panorama either using Splay (stereo) or SplayAz (numOutChannels
> 2).
As eplained in -setLoopMaxLength a buffer may be larger than the actual audio that it contains, leaving silence at the end of the buffer. This variable contains the lengths of actually recorded audio in seconds for all buffers as set by -setLoopMaxLength.
The name of the instance as assigned in *new (internally converted to a Symbol if given as String).
A Symbol
The full length of the buffers as given in *new. This will not be the same as actual length of audio written to them (see -loopLengths).
The Ndef that holds the looper as its source. The looper can basically be a Function or a Pattern. If desired the output can be further processed by hooking up NodeProxy roles.
An Ndef
The Ndef that's actually playing to the out channels. The number of channels will be determined by the numOutChannels
argument in *new. If desired the output can be further processed by hooking up NodeProxy roles.
An Ndef
The Group, respectively ParGroup in which the Ndef returned by *out will play. If scsynth is set engine this will resolve to Group. If supernova is used (multicore virtualistaion) a ParGroup will be returned. Setting the Ndef to explicit a group allows you to free all contained nodes contained in the group without stopping the player. See -freeHangingNodes for further explanation.