Monday, June 17, 2013

Basic Blocking Playback

The new audio system now supports basic blocking playback.

player = audioplayer(rand(2, 44100), 44100);

The code above will play one second of white noise on both speakers at 44100 sampling rate. The signals in the different speakers will be different. Mono playback is also supported.

player = audioplayer(rand(1, 44100), 44100);

Will play the same signal on both channels.

Different audioplayer parameters will result in different player settings. For example:

player = audioplayer(signal, 44100, 16);

Will result in a player that expects signals to be 16 bit integer values.

player = audioplayer(signal, 44100, 16, id);

Will result in a player that tries to write to audio output device with the specified id. If no id is specified then the player will use the default audio device on that system.       

No comments:

Post a Comment