jiaaro / pydub

Manipulate audio with a simple and easy high level interface
http://pydub.com
MIT License
8.96k stars 1.05k forks source link

Pydub AudioSegment.from_file cut my audio by int16 value #752

Open Sitcebelly opened 1 year ago

Sitcebelly commented 1 year ago

When i read the file with audioSegment it cut my audio by int16 value in most of the cases, how can I avoid this?

Read code

from pydub import AudioSegment
import numpy as np
import soundfile as sf

audio_path = "audio.mp3"
audio = AudioSegment.from_file(audio_path)
waveform = np.array(audio.get_array_of_samples())

sf_wav, sr = sf.read(audio_path)

Pydub audio Screenshot 2023-09-07 at 20 28 58

Soundfile audio Screenshot 2023-09-07 at 20 29 20

As you can see pydub cutted me audio by value 32767 - int16, How can i avoid it?