This is where navigation should be.

BLOCK - Initialize block stream

Usage

block(source);

Input parameters

source Block stream input.

Output parameters

fs Sampling rate.
classid Data type.

Description

block(source) initializes block data stream from source which can be one of the following (the letter-case is ignored for strings):

'file.wav'
name of a wav file
'dialog'
shows the file dialog to choose a wav file.
data
input data as columns of a matrix for each input channel
'rec'
input is taken from a microphone/auxilary input;
{'rec','file.wav'} or {'rec','dialog'} or {'rec',data}
does the same as 'rec' but plays a chosen audio data simultaneously.
'playrec'
loopbacks the input to the output. In this case, the block size (in blockread) cannot change during the playback.

block accepts the following optional key-value pairs

'fs',fs

Required sampling rate - Some devices might support only a limited range of samp. frequencies. Use blockdevices to list supported sampling rates of individual devices. When the target device does not support the chosen sampling rate, on-the-fly resampling will be performed in the background. This option overrides sampling rate read from a wav file.

The default value is 44100 Hz, min. 4000 Hz, max. 96000 Hz

'L',L

Block length - Specifying L fixes the buffer length, which cannot be changed in the loop.

The default is 1024. In the online mode the minimum is 32.

'devid',dev
Whenever more input/output devices are present in your system, 'devid' can be used to specify one. For the 'playrec' option the devId should be a two element vector [playDevid, recDevid]. List of the installed devices and their IDs can be obtained by blockdevices.
'playch',playch
If device supports more output channels, 'playch' can be used to specify which ones should be used. E.g. for two channel device, [1,2] can be used to specify channels.
'recch',recch
If device supports more input channels, 'recch' can be used to specify which ones should be used.
'outfile','file.wav'
Creates a wav file header for on-the-fly storing of block data using blockwrite. Existing file will be overwritten. Only 16bit fixed point precision is supported in the files.
'nbuf',nbuf
Max number of buffers to be preloaded. Helps avoiding glitches but increases delay.
'loadind',loadind

How to show the load indicator. loadind can be the following:

'nobar'
Suppresses any load display.
'bar'
Displays ascii load bar in command line (Does not work in Octave).
obj
Java object which has a public method updateBar(double).

Optional flag groups (first is default)

'noloop', 'loop'
Plays the input in a loop.
'single', 'double'
Data type to be used. In the offline mode (see below) the flag is ignored and everything is cast do double.
'online', 'offline'
Use offline flag for offline blockwise processing of data input or a wav file without initializing and using the playrec MEX.