TIme shifting an audio in a frequency domain

42 ビュー (過去 30 日間)
chung kuan ren
chung kuan ren 2019 年 10 月 7 日
コメント済み: Yvonne Haesevoets 2023 年 6 月 13 日
Hi guys, newbie here. Needed to help on this, not sure if it is possible to acheive.
I am trying to do a time shift in freq domain on one of the audio so this part of the code i did so far. reading an audio can put into window frame form.
[data,fs] = audioread('audio.wav');
no_frame = 10;
datalength = length(data);
framesize = floor(datalength/no_frame);
temp = 0
for i = 1 : no_frame
frames(i,:) = data(temp + 1 : temp + framesize);
temp = temp + framesize;
end
tried doing this line but seem to have problem:
y(i,:) = yp(i,:).*exp(-j*2*pi*f*(1/fs));
Appreatiate any suggestion. Thank you.

回答 (1 件)

Prabhan Purwar
Prabhan Purwar 2019 年 11 月 18 日
Hey,
The following code illustrates the Time-shifting of a signal in the frequency domain.
[data,fs] = audioread('FemaleSpeech-16-8-mono-3secs.wav');
no_frame = 10;
datalength = length(data);
N = floor(datalength/no_frame); %Framesize
temp = 0;
for i = 1 : no_frame
frames(i,:) = data(temp + 1 : temp + N);
temp = temp + N;
end
i=1; %for 1st frame
t=400;
yi=frames(i,:);
yp(i,:)=fft(yi);
y(i,:) = exp(-1i*2*pi/N*(0:N-1)*t).*yp(i,:);
rslt(i,:)=ifft(y(i,:),'symmetric');
plot(yi);
figure
plot(rslt(i,:));
Output:Capture.JPG
Refer to the following links for further information:
  1 件のコメント
Yvonne Haesevoets
Yvonne Haesevoets 2023 年 6 月 13 日
I tried applying --like you did-- this property of the DTFT to operate a shift in time by a non-integer number of samples, but I was missing one element : 'symmetric'. It makes perfect sense.
It works like a charm now --thank you !

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by