[go: up one dir, main page]

0% found this document useful (0 votes)
19 views11 pages

Audiosignalprocessing

udio signal processing is a subfield of signal processing focused on manipulating and analyzing audio signals. It involves techniques used to enhance, analyze, synthesize, and transform audio data for various purposes, such as music production, speech processing, telecommunications, and more. Key Concepts in Audio Signal Processing Audio Signals: Represent sound in the form of a continuous waveform or a digital sampling of that waveform. Can be mono (one channel), stereo (two channels), or sur

Uploaded by

roserred9090
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views11 pages

Audiosignalprocessing

udio signal processing is a subfield of signal processing focused on manipulating and analyzing audio signals. It involves techniques used to enhance, analyze, synthesize, and transform audio data for various purposes, such as music production, speech processing, telecommunications, and more. Key Concepts in Audio Signal Processing Audio Signals: Represent sound in the form of a continuous waveform or a digital sampling of that waveform. Can be mono (one channel), stereo (two channels), or sur

Uploaded by

roserred9090
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/362667853

Audio Signal Processing using matlab

Technical Report · August 2022


DOI: 10.13140/RG.2.2.19169.79202

CITATION READS
1 2,905

1 author:

Yash Sanghani
Nirma University
1 PUBLICATION 1 CITATION

SEE PROFILE

All content following this page was uploaded by Yash Sanghani on 13 August 2022.

The user has requested enhancement of the downloaded file.


Audio Signal Processing

By
Yash Sanghani (20BEC509)
Shivam vaykar (20BEC512)
Electronic and Communication Department
Institute Of Technology
Introduction
Audio Signal processing is a method where intensive algorithms, techniques are applied to audio signals. Audio
signals are the representation of sound, which is in the form of digital and analog signals. Their frequencies
range between 20 to 20,000 Hz, and this is the lower and upper limit of our ears. Analog signals occur in
electrical signals, while digital signals occur in binary representations. This process encompasses removing
unwanted noise and balancing the time-frequency ranges by converting digital and analog signals. It focuses on
computational methods for altering the sounds. It removes or minimizes the over modulation, echo, unwanted
noise by applying various techniques into it.

Remote communication, such as virtual video conferencing, is becoming the preferred method of
communication over face-to-face meetings. But, acoustic noise, distortion, and echo are inevitable in any
communication process. Suppose a person is talking over the phone or walking around the streets. His speech
would be hampered by the traffic noise, noise caused by people around him, wind sound, etc. It becomes
imperative to remove such distortion to have smooth and flawless sound quality.

Audio Effects- Audio Pre/post Processing Techniques


Post-processing algorithms are used to suppress the noise and any artifacts created in the first stage of
processing. It is primarily focused on echo, distortion removal, and speech enhancement. Equalization and
filtering are popular post-processing techniques to add reverberation and noise control.

a. Data Compression/ Decompression

Compression is one of the most powerful mixing tools which is a process to reduce the dynamic range of audio
signals. Dynamic range is the difference between the highest and lowest range of an audio signal.

For example, while screaming or whispering pitch is either too high or too low and, in this case, if we record it
without compression, then the resulting sound will be distorted. The compressor fixes this problem by
attenuating the loudest sound and boosting the slowest sound. It helps us find the perfect balance of audio track
and gives us more natural sound without distortion. It also reduces the bandwidth of digital audio streams and
storage size of the file to save storage space and faster transmission.

There are 2 types of audio compression exist, i.e., lossless and lossy compression. The most widely used audio
compressions are lossy methods due to their much larger compression ratios than their original data. It can
eliminate the information that is not very relevant and any decline in the quality. The most popular audio
compressions are MP3 and AAC Compression.
b. Automatic Echo Cancellation (AEC)
Acoustic Echo Canceller plays an important role in audio signal processing. It removes the echo, reverberation
and unwanted noise caused by acoustic coupling between the microphone and loudspeaker. Microphones
capture the far-end speech due to the acoustic coupling.

Suppose you are in a voice call talking with someone over a phone. The speech of the other person you are
talking to referred to as far-end speech, which would be played through loudspeaker and your voice, referred to
as near-end speech which would be captured by microphone. If the far-end speech gets transmitted back to the
other side of the call, the other person would hear their voice after some delay (network + processing delay).
AEC blocks the transmission of far-end back to the other party in the call.

c. Resampling
Resampling is defined as the total no. of samples generated per second. These samples are measured in
kilohertz (kHz), where one unit is equal to 1000 times per second. Different audio systems use different
sampling rates and frame rates. It measures the frequency of the audio signals. It works on the principle of
oversampling and transcoding which results in less noise and distortion. The higher sampling rate is more
advantageous as it gives the more accurate details of rising and falls in the signals, which improve the sound
quality.

d. Filtering
Filters are considered the most basic circuit in any signal processing used in almost every process. It removes
the unwanted noise, echo, distortion, and allows the filtered data to pass through it. We will be discussing pass
filters that allow only specific frequencies while rejecting others.

 Low-pass filter

Low-pass filters allow the frequencies below the selected cut-off frequency level and cut the frequencies
above the cut-off range.

 High-pass filter
A high-pass filter is the opposite of a low-pass filter. It filters and passes the frequency, which is higher
than the cut-off frequency range and attenuates the frequency lower than the cut-off range.

 Bandpass Filter

After resampling of signals, band pass filter is applied to remove the extra noise and be considered the
most ideal filter in signal processing. It attenuates the frequencies which are higher or lower than the cut
off frequencies range and only passes the frequencies which fall within the cut-off range.

 Band-rejection/stop filter

It is also known as a notch filter and opposite of band-pass filter. It leaves most of the frequencies
unaltered and attenuates those within a specified range to very low levels.
e. Equalization
Equalizers are used to alter or adjust the frequency so that the sound spectrum frequency at the transmitter
should match the sound spectrum’s frequency at the receiver. Frequency ranges are being adjusted to high or
low using low-pass filter, high-pass filter, band-pass filter. It removes the delay between different frequency
components and gets the desired output.

f. Automatic gain control (AGC) or Loudness Control


It gives a constant output despite having various input signals. It shows the amount of gain or attenuation
applied to the input signals to get the target input signal. If the input signal is higher than the target input, then
AGC subtracts the gain, and if it is lower than the target input level then AGC adds the gain. Gain shows the
loudness of the input of the channel, which controls the tone.

g. Beamforming
Beamforming, also known as Spatial Filtering, is a signal processing technique used in microphone array
processing. Beamforming exploits the microphones’ spatial diversity in the array to detect and extract desired
source signals and suppress unwanted interference. Beamforming is used to direct and steer the composite
microphones’ directivity beam in a particular direction based on the signal source direction. This technique
helps to boost the composite range of microphones and increases the signal-to-noise (SNR) ratio.
Audio Processing with Matlab
The following functions that will be used in this lab are:

audioread() sound() soundsc() flipud() audiowrite()

Read and Store an Audio File in MatLab


To read and store an audio file, you can use one of two different command lines. The following stores the file
into variable y.

y = audioread(‘filename');
The command line below stores the audio file into variable y and the sampling frequency in variable Fs.

[y,Fs] = audioread(‘filename');

Play the Audio File


To play an audio file in MatLab you use the sound() function. The following function plays the sound. If the Fs
variable is not defined or included in the command, it will assume the default sample rate of 8192 Hz.

sound(y,Fs);

Audio Scaling
To scale an audio file the soundsc() command is used. This allows for the modification of an audio signal’s
amplitude or frequency.

soundsc(y,Fs);
To increase the volume of the audio track you can multiple the variable it is stored in by a scalar. To slow down
or speed up the track played you can adjust the sampling rate. Comment on your observations using different
values.
Now experiment with different bit values (1,2,..,16) in the following command:

soundsc(y,Fs,bits);
Comment on your observations.

Playing a Track Backwards


The command to reverse the order of the samples in a matrix is

flipud()
Create Music with MatLab
This section of the lab will teach you how to create songs using different tones created in MatLab. First we are
going to code a sine wave of amplitude A = 1, with at an audio frequency of 523.25 Hz (corresponds to C).

cnote = sin(2*pi*523.25*(0:0.000125:0.5));
This vector cnote now contains simples of the sine wave from t = 0s to t = 0.5s, in samples that are spaced
0.000125s apart (this is the sampling interval Ts). Note that this sampling interval corresponds to a sampling
frequency of 8 kHz (1/Ts = fs). This is standard for voice grade audio channels.
Now to write this sound to a wave file we have the following command.

Audiowrite (cnote, ‘c.wav’);


Now to play the sound, same as before use the sound() function. That is the single note that you just created.
Now that you’ve got one down… only several more to go!!
Using this information create a few different notes in MatLab.
Note that there are different octaves as you go through the different keys on a piano. To get you started here are
a few:
f = sin(2*pi*174.61*(0:0.000125:0.5));
g = sin(2*pi*195.99*(0:0.000125:0.5));
a = sin(2*pi*220*(0:0.000125:0.5));
b = sin(2*pi*246.94*(0:0.000125:0.5));
Now to create a line of music use the following command:
line1 = [a,b,c,d,e,f];
line2 = [a,b,c,d,e,f];
The letters should represent the notes that you have created in MatLab. Put the notes in the order you want them
to play.
To create your song use: song = [line1, line2];
Add as many lines as you like. Now write your song, read and store it into a new variable, and listen to it.
Comment on your musical abilities. If you’re musically challenged, check out Google for some songs that you
can create
Practical exercise
Exercise 1. Read to audios and mix them and play it.
clc;
clear all;
close all;
[audio1,fs] = audioread('onmv.mp3');
[m,n]=size(audio1);
plot(audio1);
title("song 1")
% if n==1
% error('the music is not stereo');
% elseif n>2
% error('the audio has more than 2 channels');
% end

[audio2,fs1] = audioread('onmi.mp3');
[m1,n1]=size(audio2);
plot(audio2);
title("song 2")
% if n==1
% error('the music is not stereo');
% elseif n>2
% error('the audio has more than 2 channels');
% end

%processing
if m==m1
song = audio1+audio2;
elseif m<m1
yd=m1-m
d = zeros(yd,n);
d1 =[audio1;d]
song = audio2+d1
elseif m>m1
yd=m-m1
d = zeros(yd,n);
d1 =[audio2;d]
song = audio1+d1;
end
sound(song,fs);
plot(sound);
title("mixed song")
output
Exercise 2. Read an audio and remove vocal part from it.

A. read audio signal and plot it.


clc;
clear all;
close all;
[y,fs] = audioread('stay.mp3');
plot(y); title('normal music');

B. read audio and remove vocal part form audio


clc;
clear all;
close all;
[y,fs] = audioread('stay.mp3');
[m,n]=size(y);
if n==1
error('the music is not stereo');
elseif n>2
error('the audio has more than 2 channels');
end
%processing
left_channel = y(:,1);
right_channel = y(:,2);
unvoiced_music = right_channel-left_channel;
%plot
subplot(2,2,1)
plot(y); title('normal music');
subplot(2,2,2)
plot(left_channel); title('left');
subplot(2,2,3)
plot(right_channel); title('right');
subplot(2,2,4)
plot(unvoiced_music); title('unvoiced music');
sound(unvoiced_music,fs);
Conclusion
Advancements in digital audio technology have propelled us to have very efficient and high-quality speech
processing algorithms in place. These algorithms are applied in the process of recording, storing, and
transmitting the audio content. Audio content brings lots of unwanted echo, interference and distortions that
need to be removed to get the desired results in audio quality. It works on the principle of converting the audio
signals between analog and digital formats, adjusting the frequency ranges, removal of unwanted noise and
adding audio effects to get the smooth and flawless speech quality.

View publication stats

You might also like