Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Matlab assignments to understand how to process an audio signal (e.g. music) using digital signal processing. For the following questions, please refer to the

2. Matlab assignments to understand how to process an audio signal (e.g. music) using digital signal processing. For the following questions, please refer to the corresponding Matlabs exemplary codes. What you need to do is to COMPLETE the codes and GENERATE all results (either figures or audio outputs).

(a) Read the music (2-channel stereo music) using Matlab' audioread. For simplicity, we will process ONE channel only (i.e., the first channel. The first row in the raw data. This is MONO tone).

(i) PLOT the time waveform and its frequency-domain representation using FFT. Please also indicate the correct time and frequency index based on the sampling rate and data length. (Paste your plots here)

(b) Noise the music (To test your hearing sensitivity).

(i) Add a Gaussian white noise (using randn, See HW#1) to the original signal such that the signal-to-noise ratio is 30 dB. The maximum signal amplitude is assumed to be 1. PLOT and compare the frequency-domain representation with and without adding noise. (Paste your plots here)

(c) Watermark the music (To test your hearing frequency band or generate inaudible signals). Add a single tone (i.e., a single frequency, cosine signal) to the original data so that you CANNOT hear this single tone. That is, you hear exactly the same as the original music.

(i) How to add this single tone and what is the frequency of it? PLOT and compare the frequency-domain representation with and without adding noise. (Paste your plots here). Note that aliasing might be present when the frequency is higher than half of the sampling rate.

%%%% (a) Read the data (2-channel stereo music) using Matlab' audioread. %%%% Show the time waveform and its Frequency-domain representations %%%% using FFT. For simplicity, we will process one channel ONLY %%%% (i.e., mono tone). %%%% (b) Effects of noise on the music. Add a Guassian white noise to the %%%% original signal such that the signal-to-noise ratio is 30 dB. The maximum signal amplitude is assumed to be 1. %%%% (c) Test your hearing frequency band. Add a single tone (i.e., a %%%% single frequency, cosine signal) to the original data such that %%%% you CANNOT hear this single tone. That is, you hear the same as %%%% the original music. How to add this single tone?

**************************************************code********************************************************

clear all

%%% Load audio file filen = 'abc.mp3'; audioinfo(filen)

[y,Fs] = audioread(filen); % y has two channels, Fs is the sampling rate

N = size(y,1); % Length of the audio signal t = [0:1/Fs:(N-1)/Fs]; % Time index f = ([0:1:N-1]/N-0.5)*Fs; % Frequency index (from -fs/2:1/(Nfs):(N-1)/(Nfs)-fs/2) ys = y(:,1); % we only process one of two channels between both are very similar. plot(t);

%%% Add noise (Gaussian white noise) SNR = 30; noise_var = 10^(-SNR/10); ys_noise = ys + sqrt(noise_var)*randn(N,1); % add noise

%%% Add an inaudible signal with single frequency. fc = 40*10^3; % The frequency of this cosine wave (you CAN change this value) amp = 0.1; % amplitude of the cosine wave (DON'T CHANGE this value for your hearing safty)

ys_inau = ys + amp*cos(2*pi*fc*[0:1:N-1]'/Fs); % Add this cosine signal to the orignal music.

% Play the sound sound(ys,Fs)

%%% Export the prcoessed audio with .ogg format filename = 'org.ogg'; audiowrite(filename,ys,Fs)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Treasury Financial Manual Volume II III And IV

Authors: US Treasury

1st Edition

1790321824, 978-1790321827

More Books

Students also viewed these Accounting questions