MATLAB Answers

How do I find built in sounds?

511 views (last 30 days)
Jarred
Jarred on 12 Dec 2014
Answered: Adam Danz on 16 Apr 2021
I need to load two built in matlab sound files, store them, and concatenate the sounds so they play one immediately followed by the other. I cannot figure out how to even find built in sound files so I am stuck. Can anyone help me figure out the sound file codes?
  1 Comment
Chad Greene
Chad Greene on 15 Dec 2014
Many times I've wished for a clear list of sample data, perhaps in a simple table given with data type, toolbox, and in which Matlab release(s) you'll find each sample data file. Good documentation of code often requires sample data, and requires confidence that users will be able to follow along with an example, no matter what release of Matlab they're using or what toolboxes they have. I've contacted TMW with this request before and I got a friendly, but non-committal response.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 16 Apr 2021
See Example Audio Data toward the bottom of this list.
help audiovideo
Audio and Video support. Audio input/output objects. audioplayer - Audio player object. audiorecorder - Audio recorder object. Audio Device utilities audiodevinfo - Audio device information. audiodevreset - Reset the list of audio devices. Audio hardware drivers. sound - Play vector as sound. soundsc - Autoscale and play vector as sound. Audio file import and export. audioread - Read audio samples from an audio file. audiowrite - Write audio samples to an audio file. audioinfo - Return information about an audio file. Video file import/export. VideoReader - Read video frames from a video file. VideoWriter - Write video frames to a video file. mmfileinfo - Return information for a multimedia file. Utilities. lin2mu - Convert linear signal to mu-law encoding. mu2lin - Convert mu-law encoding to linear signal. Example audio data (MAT files). chirp - Frequency sweeps (1.6 sec, 8192 Hz) gong - Gong (5.1 sec, 8192 Hz) handel - Hallelujah chorus (8.9 sec, 8192 Hz) laughter - Laughter from a crowd (6.4 sec, 8192 Hz) splat - Chirp followed by a splat (1.2 sec, 8192 Hz) train - Train whistle (1.5 sec, 8192 Hz) See also IMAGESCI, IOFUN.
To find the location of a file,
which chirp.mat
/MATLAB/toolbox/matlab/audiovideo/chirp.mat

More Answers (3)

Sean de Wolski
Sean de Wolski on 12 Dec 2014
S(1) = load('gong');
S(2) = load('handel');
sound(S(1).y,S(1).Fs)
sound(S(2).y,S(2).Fs)
And more help: audioread, audiowrite.


Chad Greene
Chad Greene on 12 Dec 2014
also load laughter and load train.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by