How do I time shift an audio signal?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ahmed Elaraby
le 22 Juin 2021
Réponse apportée : Asvin Kumar
le 24 Juin 2021
So I've got this audio signal I've wanted to shift to the right but I can't seem to reach it.
I've tried adding zeros but no shifting occured.
load handel.mat
filename = 'handel.wav';
audiowrite(filename,y,Fs);
clear y Fs
[y,Fs] = audioread('handel.wav');
N = length(y);
t = (0:N-1)/Fs;
Z = zeros(N,1);
subplot(2,1,1);
plot(t,y);
xlabel 'Time'
ylabel 'Audio signal'
grid on
subplot(2,1,2);
Ynew = [Z;Fs];
0 commentaires
Réponse acceptée
Asvin Kumar
le 24 Juin 2021
When you select the second subplot, you need to use the plot command again to plot the audio signal.
Here's a modified version of the code.
load handel.mat
filename = 'handel.wav';
audiowrite(filename,y,Fs);
clear y Fs
[y,Fs] = audioread('handel.wav');
N = length(y);
t = (0:N-1)/Fs;
delay2 = 3*Fs;
Z = zeros(delay2,1);
subplot(2,1,1);
plot(t,y);
xlabel 'Time'
ylabel 'Audio signal'
grid on
subplot(2,1,2);
Ynew = [Z;y(1:end-delay2)];
plot(t,Ynew);
xlabel 'Time'
ylabel 'Delayed Audio signal'
grid on
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Measurements and Spatial Audio 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!