ganeshkumar383's picture
Update utils.py
5435591 verified
raw
history blame contribute delete
595 Bytes
import numpy as np
import librosa
def apply_equalizer(y, bass_gain, mid_gain, treble_gain, sr):
# Simple EQ logic using band filters (can be improved)
y_bass = librosa.effects.preemphasis(y) * (1 + bass_gain / 10)
y_mid = y * (1 + mid_gain / 10)
y_treble = librosa.effects.preemphasis(y[::-1])[::-1] * (1 + treble_gain / 10)
return (y_bass + y_mid + y_treble) / 3
def apply_pitch_shift(y, sr, n_steps):
return librosa.effects.pitch_shift(y, sr=sr, n_steps=n_steps)
def extract_lyrics(file):
content = file.read().decode('utf-8')
return f"<pre>{content}</pre>"