Tuesday, June 18, 2013

Non-blocking Playback

Non-blocking playback is now working as well. See example below.

signal1 = sin(linspace(0.0, 440.0 * 10.0 * 2.0 * pi, 441000)) * 0.2;
signal2 = sin(linspace(0.0, 442.0 * 10.0 * 2.0 * pi, 441000)) * 0.2;
signal = [signal1; signal2];
player = audioplayer(signal, 44100);

This example will play a 440Hz sine wave in the left speaker and 442Hz sine wave in the right speaker for 5 seconds, pause, wait 5 seconds and then resume playing again. The difference between blocking and non-blocking modes is that when using non-blocking mode, after issuing the play command the control returns to the octave interpreter.

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.       

Sunday, June 2, 2013


This blog is dedicated to my Google Summer of Code 2013 project of implementing MATLAB like audio playback and recording classes in Octave. The source repository for the project is here. Stay tuned.