FFT and IFFT: Random Phases
Mostrar comentarios más antiguos
I imported a single audio file to MATLAB workspace.
After I apply the FFT:
Y = fft(signal)
How can I random change the audio phases before apply the Inverse FFT and get the 'new_signal'?
new_signal = ifft(Y)
How can I do it?
Respuesta aceptada
Más respuestas (1)
David Goodmanson
el 22 de Mzo. de 2019
1 voto
Hi Nycholas,
Assuming signal is real and of length n, n even, then
Y(1) is for frequency 0, the DC contribution, and it's real. Don't mess with that point.
Y(2) and Y(n) are complex conjugates. You can multiply one of that pair by exp(i*theta) and the other by exp(-i*theta), where theta is a random angle with 0 <= theta < 2*pi. the new Y(2) and Y(n) remain complex conugates.
In general from k = 2 to n/2, Y(k) and Y(n+2-k) form a complex conjugate pair. For each of those pairs, do the same kind of multiplcation as above, with a different random angle. Each pair remain complex conjugates.
Y(n/2+1) is real. Don't mess with that point either.
ifft back.
Here the random phases are totally uncorrelated from frequency to frequency, which may or may not be physically realistic.
3 comentarios
Nycholas Maia
el 22 de Mzo. de 2019
Editada: Nycholas Maia
el 22 de Mzo. de 2019
David Goodmanson
el 23 de Mzo. de 2019
Hi NM, what have you tried so far?
David Daminelli
el 1 de Jun. de 2019
Hello NM and DG! I'm working on a project that needs this same function, and I've done an algorithm that does that. It is here https://www.mathworks.com/matlabcentral/answers/465112-help-with-sound-function, followed by a question I had during the project, if they can help it would be usefull!
Categorías
Más información sobre Transforms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!