Created
August 28, 2015 14:51
-
-
Save grejppi/9baa691e10496ece0509 to your computer and use it in GitHub Desktop.
swap high frequencies with lows and vice versa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using WAV | |
name = ARGS[1] | |
y, rate = wavread(name) | |
spectrum = fft(y) | |
quarter = int(length(spectrum) / 4) | |
newspectrum = zeros(Complex{Float64}, length(spectrum)) | |
for (i, v) in enumerate(spectrum[1:quarter]) | |
newspectrum[quarter - i + 1] = v | |
end | |
ifft!(newspectrum) | |
out = wavwrite(real(newspectrum), "out_$name", Fs=rate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment