To play a sound file with Matlab commands, type:
>> [y, fs] = audioread('filename.wav');
>> sound(y, fs)
>> plot([1:size(y)]/fs,y); %Plot waveform
>> xlabel('sec');
Information about Electrical, Electronic, Communication and Computer Engineering 電機、電子、通訊、電腦資訊工程的學習筆記
相關資訊~生醫工程:StudyBME
聽力科技相關資訊:電子耳資訊小站
iOS程式語言:Study Swift
樹莓派和Python:Study Raspberry Pi
2018/01/04
2018/01/02
Matlab: record and play sound
To record sound with matlab, use audiorecorder() and getaudiodata()
In this example,
sample rate Fs = 8000
number of bits NBITS = 8
number of channels NCHANS = 1 = Mono
>> recorder = audiorecorder(8000,8,1);
>> record(recorder); //Say something
>> stop(recorder);
>> play(recorder);
>> data = getaudiodata(recorder, 'double');
>> sound(data, 8000);
>> plot([1:size(data)]/8000,data); %Plot waveform
>> xlabel('sec');
Waveform of Mandarin Chinese '1 2 3' (中文「一、二、三」的波形)
Reference:
McLoughlin, I. (2009). Applied speech and audio processing: with Matlab examples. Cambridge University Press. pp 7-10.
In this example,
sample rate Fs = 8000
number of bits NBITS = 8
number of channels NCHANS = 1 = Mono
>> recorder = audiorecorder(8000,8,1);
>> record(recorder); //Say something
>> stop(recorder);
>> play(recorder);
>> data = getaudiodata(recorder, 'double');
>> sound(data, 8000);
>> plot([1:size(data)]/8000,data); %Plot waveform
>> xlabel('sec');
Waveform of Mandarin Chinese '1 2 3' (中文「一、二、三」的波形)
Reference:
McLoughlin, I. (2009). Applied speech and audio processing: with Matlab examples. Cambridge University Press. pp 7-10.
2017/03/12
PCM, DPCM, ADPCM
訂閱:
文章 (Atom)