Skip to content

Instantly share code, notes, and snippets.

View Ravarcheon's full-sized avatar
🍋
!~

Ravarcheon Ravarcheon

🍋
!~
View GitHub Profile
@Ravarcheon
Ravarcheon / spectralRotation.py
Last active May 29, 2024 19:08
rotates an audio file by 90 degrees in the spectrum while being a reversible process with minimal loss (only floating point errors which are like -150 dB but thats literally silence ahaha~)
import numpy as np
import soundfile as sf
from scipy.fftpack import fft, ifft
def rotateSignal(signal,flip):
if flip:
signal = signal[::-1]
x = np.concatenate((signal, signal[1:][::-1])) # concatenating the array with a reverse of itself makes it such that the fourier transform doesn't layer over a reversed version of itself in the inverse fft
rotSig = ifft(x)