Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
load handel.mat
The workspace now contains a matrix of audio data, y, and a sample rate, Fs.
Use the audiowrite function to write the data to a WAVE file named handel.wav in the current folder.
audiowrite('handel.wav',y,Fs)
clear y Fs
The audiowrite function also can write to other audio file formats such as OGG, FLAC, and MPEG-4
AAC.
info = audioinfo('handel.wav')
info =
Filename: 'pwd\handel.wav'
CompressionMethod: 'Uncompressed'
NumChannels: 1
SampleRate: 8192
TotalSamples: 73113
Duration: 8.9249
Title: []
Comment: []
Artist: []
BitsPerSample: 16
audioinfo returns a 1-by-1 structure array. The SampleRate field indicates the sample rate of the audio
data, in hertz. The Duration field indicates the duration of the file, in seconds.
[y,Fs] = audioread('handel.wav');
sound(y,Fs)
You also can read WAV, AU, or SND files interactively. Select Import Data or double-click the file name
in the Current Folder browser.
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
plot(t,y)
xlabel('Time')
ylabel('Audio Signal')
See Also
audioinfo | audioread | audiowrite
Related Topics
Import Images, Audio, and Video Interactively