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
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Chandra
le 4 Avr 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);
0 commentaires
Voir également
Catégories
En savoir plus sur Audio I/O and Waveform Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!