-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could export mp3 file with waveform data and sample rate? #352
Comments
In order to do it properly you'lll need the number of channels and the sample width (in bytes). Generally the sample width will be an 16 bit, which is two bytes long, but can vary. audio = pydub.AudioSegment.from_raw('file.raw', sample_width=2, frame_rate=44100, channels=1) |
Dear, |
# vo is a int array of samples
a = AudioSegment(vo, frame_rate=32000, sample_width=2, channels=1)
a.export('a.mp3', format='mp3') This may help? |
thanks, Note: Thx |
Because load returns an ndarray, we can convert y by multipy its bit depth, for example 2**16。Then convert to int like following code yint = (y * (2**16)).astype(np.int16)
audio = pydub.AudioSegment(yint, ...) |
Dear,
Could the project export mp3 file,using waveform data and sample rate?
Any advice and suggestion will be good.
Thx
The text was updated successfully, but these errors were encountered: