Basically, the title is self-explanatory. I am trying to make an equalizer in python, I want to process each audio channel separately, but I cant get even a mono to work, changing the n_fft in the stft distorts the audio more and more as i play with it. I think Im missing an important step somewhere but i just figure it out
import librosa
import numpy as np
import sounddevice as sd
def change_magnitude(mp3_file_path):
audio, sample_rate = librosa.load(mp3_file_path, sr=44100, mono=False)
print(f'original audio shape: {audio.shape}')
stft = librosa.stft(audio[0], n_fft=4096) # Choose an appropriate value for n_fft
print(f'stft shape: {stft.shape}')
magnitudes = librosa.amplitude_to_db(np.abs(stft))
audio_new = librosa.istft(librosa.db_to_amplitude(magnitudes))
sd.play(audio_new, samplerate=44100, blocking=True)
mp3_file_path = '02. It\'s So Creamy.mp3'
change_magnitude(mp3_file_path)
I tried changing the magnitudes directly before this but even this doesn't work