Suppose you have the following float32 audio representation loaded from any wav file using the librosa package:
import librosa wav_x_path = "any_wav_filepath.wav" wav_source, _ = librosa.load(wav_x_path, sr=16000)
If you then will try to play this audio using, for example, a jupyter notebook, the following snippets sounds in the same way:
from IPython.display import display, Audio display(Audio(wav_source * 2, rate=sampling_rate)) display(Audio(wav_source * 200, rate=sampling_rate)) display(Audio(wav_source / 200, rate=sampling_rate))
Why does it happen that changing audio aptitude (if I correctly understand what wav_source contains audio amplitude), doesn’t affect how the audio sounds?
Advertisement
Answer
As per the documentation of IPython.display.Audio there is an argument normalize
which decides whether to apply automatic scaling of the volume. The default is normalize=True
, which is why different amplitude scales is played back at the same level.
Use display(Audio(wav_source * 2, rate=sampling_rate, normalize=False))
and you should be able to hear the difference.