フィルターのクリア

Help with sound function

2 ビュー (過去 30 日間)
David Daminelli
David Daminelli 2019 年 6 月 1 日
コメント済み: Walter Roberson 2019 年 6 月 2 日
Hello!
I'm working on a project, and my ideia is shows that human ear cannot differentiate phase. I've alreay seen someone making this using matlab, and I'm tryng to replicate it, But somehow it's not working as I expected.
Here is my code:
load train;
X = y; % X is now the traun sound
Fs = 8192; %Sampling frequency, same as the loaded sound
T = 1/Fs; %Sampling period
L = length(X); %Lenght of signal
t = (0:L-1)*T; %Time vector
Y = fft(X); %
randY = rand_angle(Y); %Here i use a function that i have created to randomly change the angle, but not change the absolute
Y1 = ifft(Y);
Y2 = ifft(randY);
Here is the rand_angle function:
function y = rand_angle(x)
vetor = x;
n = length(vetor);
vetor1 = zeros([n,1]);
for j = 1:(n/2)
if j == 1
vetor1(j) = vetor(j);
vetor1(n/2 + 1) = vetor(n/2 + 1);
else
k = rand * 2 * pi;
vetor1(j) = abs( vetor(j) )* exp( 1i * k );
vetor1(n + 2 - j) = abs( vetor(j) ) * exp(-1i * k );
end
end
y = vetor1;
Ok, now when I try
sound(Y)
sound(Y1)
sound(Y2)
I expected that the 3 functions results on the same sound, but its not what is happening. I dont know if my premise that "human ear cant differenciate phase" is wrong, or if there is something wrong on my code. Hope someone can help. Thanks!
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 2 日
http://www.earlevel.com/main/1996/10/21/a-question-of-phase/

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by