RedSamp:
Filter:
Classes (extension) | Red > redSampler

RedSamp
ExtensionExtension

playing buffers
Location: NOT INSTALLED!

Description

This class uses PlayBuf to play back parts of a buffer. With overlap one can set the number of voices. It uses the same interface as RedDiskInSampler and RedSampler.

Class Methods

Inherited class methods

Instance Methods

.prepareForPlay

Attach a soundfile to a key (number or symbol) and create buffers - one for each overlapping voice. This method is also has the alias preload for backward compatibility.

Arguments:

key

A number or a symbol.

buffer

A Buffer instance.

startFrame

In samples.

numFrames

How much of the file to load in samples. Leave as nil to load the complete file.

.play

Play the sample preloaded at key.

Arguments:

key

A number or a symbol.

attack

In seconds.

sustain

In seconds. If this is nil then the total length of the soundfile will be used (-attack-release). So the default: attack 0, sustain nil, release 0 will play the soundfile in its full length without an envelope.

release

In seconds.

amp

Amplitude.

out

Sets outbus and defaults to 0.

group

If nil it will use Server.defaultGroup.

loop

Should be either 0 (default), 1 or 2.

0Loop off. Play once through with finite duration (using attack+sustain+release).
1Loop on. Loop infinite until it receives a .stop (ignoring sustain).
2Loop on. Loop with finite duration (using attack+sustain+release).

.stop

Stops one voice currently playing at this key.

Arguments:

key

A number or a symbol.

release

Release time is in seconds. The voice is stolen when the sound is fully released.

.flush

Stop all currently playing voices for all keys.

.free

Clear all keys, close files, free synths and buffers.

.freeKey

Clear a key, close its file and free its synth and buffer.

.loadedKeys

Report which keys have been preloaded with soundfiles.

.playingKeys

Report which keys that currently have one or more voices playing.

.overlaps

Get or set number of overlaps or voices allowed to play per key at once. The default is 2. You will need to -prepareForPlay again after setting this.

.length

Report the length in seconds of the soundfile loaded at this key.

.channels

Report the number of channels of the soundfile loaded at this key.

.buffers

Return an array of buffer for this key. The number of buffers depend on how many overlaps you had when preloading.

.voicesLeft

Return number of free voices for this key i.e. the number of non-playing voices.

.isPlaying

Return boolean if more than one voice is playing.

.amp

Set the amplitude for a running synth.

Inherited instance methods

Examples