Application of audio signal in MATLAB

R=audiorecorder(44100,16,1); 

        Create an object that holds audio information , including sample rate, time, and recorded audio information. 44100 means sampled as

44100Hz (can be changed to 8000, 11025, 22050, etc., the higher the sampling frequency, the better the recorded sound quality, and the corresponding memory

The larger the storage space), 16 means 16bits storage, 1 means mono, and it can also be changed to 2 means two channels).

record(R);         %  Start recording , after inputting this command in the command window, speak into the microphone to start recording

pause(R);         % pause recording

play(R);            play the recorded sound

resume(R);        % Continue recording if necessary

stop(R);             % stop recording , recording ends


getaudiodata(obj) returns the recorded audio data as an array of doubles

% 画出语音的时域波形
myspeech=getaudiodata(R);    % 得到刚录制的音频信号矢量
plot(myspeech);    % 画出语音波形
xlabel('时域样值'),ylabel('幅度'),title('语音波形');

audiowrite(Y, Fs, NBITS, WAVEFILE) Writes data Y to the windows wave file specified by filename WAVEFILE. A windows wave file has a sampling rate of FS Hz and a number of bits of NBITS. NBITS must be 8, 16, 24 or 32.
Y=audioread(FILE) Read the WAVE file specified by the string FILE, and return the sampling data in Y format.
% 写入和读取声音文件
audiowrite('myspeech.wav',myspeech,44100);    % 语音存储
[x,Fs]=audioread('myspeech.wav');

wavwrite(myspeech,44100,'myspeech.wav')  % for older versions of Matlab

[x,Fs]=wavread('myspeech.wav')   % for older versions of Matlab

Guess you like

Origin blog.csdn.net/weixin_58351753/article/details/128331587