Normalize audio using pydub and load it on streamlit audio player

Hi guys,

I am trying to normalize audio data and then load it on streamlit audio player. I am using pydub for this. The following code is not working for me and I cannot figure out why!

from pydub.effects import normalize
from pydub import AudioSegment

sound = AudioSegment.from_wav(filename)
norm = normalize(sound)
st.audio(norm.raw_data)

When I run this code, the audio player does not function. “.raw_data” basically passes the data in bytes to st.audio() method, which is the same format that it requires! Can anyone help me with this? I want to normalize each audio before it plays on the app.