Convert matrix of signal data to sound
Load the example file
gong.mat, which contains sample data
y and rate
Fs, and listen to the audio.
load gong.mat; sound(y);
Play an excerpt from Handel's “Hallelujah Chorus” at twice the recorded sample rate.
load handel.mat; sound(y, 2*Fs);
load handel.mat; nBits = 16; sound(y,Fs,nBits);
MATLAB® plays the audio with a bit depth of 16 bits per sample, if this is supported on your system.
sound function supports sound
devices on all Windows® and most UNIX® platforms.
Most sound cards support sample rates between 5 and 48 kilohertz. Specifying a sample rate outside this range might produce unexpected results.