Recorder:
Filter:
Classes | Server > Abstractions

Recorder : Object

Write Audio to Harddisk
Source: Recorder.sc

Description

A Recorder allows you to write audio to harddisk, reading from a given bus and a certain number of channels, relative to a given node. A Server has one instance, which is accessible also through the ScIDE. You can use the server directly to record its output

This functionality is also available through the recording button on the server windows. Pressing it once calls record, and pressing it again calls stopRecording (see below). When doing so the file created will be in your recordings folder and be named for the current date and time. The default location of the recordings folder varies from platform to platform. Setting this variable allows you to change the default.

NOTE: By default, record creates the recording synth after the Server's default group and uses In.ar. Thus if you add nodes after the recording synth their output will not be captured. To avoid this, either use Node objects (which use the default node as their target) or (when using messaging style) use a target nodeID of 1.

For more detail on this subject see Order of execution, Default Group, and Node Messaging.

See SoundFile for information on the various sample and header formats. Not all sample and header formats are compatible. Note that the sampling rate of the output file will be the same as that of the server app. This can be set using the Server's ServerOptions.

Class Methods

Recorder.new(server)

Create a new instance for a given server.

Arguments:

server

Inherited class methods

Instance Methods

.prepareForRecord(path, numChannels)

Allocates the necessary buffer, etc. for recording the server's output. (See record below.)

Arguments:

path

a String representing the path and name of the output file. If the directory does not exist, it will be created for you. (Note, however, that if this fails for any reason, recording will also fail.)

numChannels

The number of output channels to record.

Discussion:

If you do not specify a path than a file will be created in your recordings folder (see the note above on this) called SC_thisDateAndTime. Changes to the header or sample format, or to the number of channels must be made before calling this.

.record(path, bus, numChannels, node, duration)

Starts or resumes recording the output.

Arguments:

path

this is optional, and is passed to prepareForRecord (above).

bus

The bus (Bus object or integer bus index), the offset at which to start to count the number of channels. You can record any adjacent number of bus channels.

numChannels

The number of output channels to record.

node

The Node to record immediately after. By default, this is the default group 1.

duration

If set, this limits recording to a given time in seconds.

NOTE: The recording starts when the buffer has been allocated, and after the usually very short network latency. It will last for the duration exactly down to one server block size (64 samples). For scheduling the starting point of a recording precisely, call -prepareForRecord first, and then call -record a bundle (see Server: -bind and Server: -sync).

Discussion:

If you have not called prepareForRecord first (see above) then it will be invoked for you (but that adds a slight delay before recording starts for real).

.pauseRecording

Pauses recording. Can be resumed by executing record again, or by calling resumeRecording.

.resumeRecording

Start recording again.

.stopRecording

Stops recording, closes the file, and frees the associated resources.

Discussion:

You must call this when finished recording or the output file will be unusable. Cmd-. while recording has the same effect.

.filePrefix

.filePrefix = value

a string used as prefix for the path when recording. This can be used to separate the outputs of several recorders. The default is "SC_".

.numChannels

.numChannels = value

a number of sound file channels that is used always when using this recorder, unless a different one is specified in the -record method. When not set, we use Server: -recChannels.

.recHeaderFormat

.recHeaderFormat = value

Get/set the header format (string) of the output file. The default is "wav". Must be called before prepareForRecord.

.recSampleFormat

.recSampleFormat = value

Get/set the sample format (string) of the output file. The default is "float". Must be called before prepareForRecord.

.recBufSize

.recBufSize = value

Get/set the size of the Buffer to use with the DiskOut UGen. This must be a power of two. The default is the sampleRate.nextPowerOfTwo or the first power of two number of samples longer than one second. Must be called before prepareForRecord.

.isRecording

returns true if we are in the process of recording

.paused

returns true if recording is paused

.duration

returns the number of seconds we have been recording so far

.path

returns the path of the current recording

.numFrames

returns the number of frames of the recording buffer

.notifyServer

.notifyServer = value

if set to true, it will send changed notifications to the server instance. This is used internally by the Server class.

.server

server to record from

Inherited instance methods

Undocumented instance methods

.recordBus(bus, duration, path, numChannels, node)

Examples