Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to deal with audio signal by Matlab

Shulou Source: shulou.com Published: 2022-06-01 06:28:13 10月03日 Update

This article mainly introduces how Matlab processes audio signals, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

Basic Processing and Analysis of Matlab Audio Signal

1 Audio signal reading and time domain analysis

close allclear allclc % read audio file info =audioinfo ('sample_origin.mp3');% Get information about audio files [audio,Fs] = audioread ('sample_origin.mp3');% read audio file sound (audio,Fs);% Play audio file audiolength = length(audio);% Get data length of audio file t = 1:1:audiolength; figure(1),plot (t,audio(1:audiolength));xlabel ('Time ');ylabel ('Audio Signal');title ('Original Audio File Signal Amplitude Map');

The details of this audio include data bit width, sampling rate, etc.

2 Frequency domain analysis of audio

% Audio frequency domain y =fft(audio);y=20*log(abs(y))/log(10); % converted to dBW unit f=[0:(Fs/audiolength):Fs/2]; y=y(1:length(f)); figure(2),plot(f,y);xlabel ('frequency (Hz)',' fontsize', 8,'position',[180,-34.38,0]);ylabel ('power (dBW)');title ('original audio file signal spectrogram ');legend ('Audio');

This shows that the main frequency of this audio is concentrated in the low frequency band.

3 Superposition and writing of audio

% superposition of audio signals [audio1,Fs1] = audioread ('test.wav ');% reading audio files audio2 = audio1 (1: audio length); audio3 = audio2 +0.1*audio;sound(audio3,Fs);% playing audio files audiowrite ('test1.wav', audio3,Fs)% writing new audio files

4 Splicing of audio signals

% splice audio4 = [audio;audio1];sound(audio4,Fs);% play audio file audiowrite ('test2.wav', audio3,Fs)% write new audio file

Thank you for reading this article carefully. I hope that the article "How does Matlab process audio signals" shared by Xiaobian will help everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Tags: Audio files signals articles processing analysis original information units data frequency overlay for this value interest power simultaneously amplitude time domain more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS vpn Linux Huawei