Filter löschen
Filter löschen

given a speech signal(.wav) file, we are required to plot cosine waves over it like cos(k1*x),cos(k2*x).I tried using dct function but to unable to proceedd

6 Ansichten (letzte 30 Tage)
clc; clear;
syms m;
syms n;
[x, fs] = audioread('sample.wav');
x = x(:, 1);
xlen = length(x);
subplot(311)
plot(x)
subplot(312)
t=[-xlen:0.01:xlen];
plot(cos(2*pi*t/xlen));
y=dct(x);
y1=y*cos(2*pi/xlen);
y2=idct(y1);
subplot(313)
plot(y2) % i am required to plot cos waves around the .wav file but unable to proceed

Antworten (1)

Chandra
Chandra am 4 Apr. 2022
Hi,
By multiplying the cosine signal over the sound signal we can get the required signal
Use the following code to generate the plot
//Matlab code
>>[x, fs] = audioread('sample.wav');
>>t = linspace(0,length(x),length(x)); % or we can use t =0:length(x)-1;
>>n = x'.*cos(2*pi*fs*t);%multiplication is done using dot multiplication, the frequency value
%can be used depending on user values
>>plot(n);

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by