Skip to content

Instantly share code, notes, and snippets.

@grejppi
Created August 28, 2015 14:51
Show Gist options
  • Save grejppi/9baa691e10496ece0509 to your computer and use it in GitHub Desktop.
Save grejppi/9baa691e10496ece0509 to your computer and use it in GitHub Desktop.
swap high frequencies with lows and vice versa
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