Questions tagged [pydub]

Pydub is a Python library for audio manipulation.

Pydub is a Python library for manipulating audio.

Quick links:

325 questions
24
votes
3 answers

How to create a numpy array from a pydub AudioSegment?

I'm aware of the following question: How to create a pydub AudioSegment using an numpy array? My question is the right opposite. If I have a pydub AudioSegment how can I convert it to a numpy array? I would like to use scipy filters and so on. It…
J_Zar
  • 1,334
  • 1
  • 15
  • 27
20
votes
3 answers

Python convert mp3 to wav with Pydub

Ok, now I am stuck up in converting mp3 to wav. I have seen different answers but i think i would to go for the one of pydub, which i already did using these few lines from pydub import…
phourxx
  • 523
  • 1
  • 4
  • 15
14
votes
1 answer

How to create a pydub AudioSegment using an numpy array?

I have the following code in python from scipy.io.wavfile import read rate, signal = read('./data/input.wav') # get only one channel signal = signal[:,0] # do a bunch of processing here Now I want to create an pydub segment using 'signal' and…
Dayvid Oliveira
  • 917
  • 11
  • 33
14
votes
5 answers

FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

I'm new in python and i'm using pydub modules to play mp3 track. Here is my simple code to play mp3: #Let's play some mp3 files using python! from pydub import AudioSegment from pydub.playback import play song =…
stackoverflow
  • 157
  • 1
  • 1
  • 4
13
votes
1 answer

Generating Silence with pyDub

I've found pyDub, and it seems like just what I need: http://pydub.com/ The only issue is with generating silence. Can pyDub do this? Essentially the workflow I want is: Take all the WAV files in a directory Piece them together in filename order…
user3643227
  • 235
  • 1
  • 3
  • 8
10
votes
1 answer

Using pyDub to chop up a long audio file

I'd like to use pyDub to take a long WAV file of individual words (and silence in between) as input, then strip out all the silence, and output the remaining chunks is individual WAV files. The filenames can just be sequential numbers, like 001.wav,…
user3643227
  • 235
  • 1
  • 3
  • 8
9
votes
2 answers

remove silence at the beginning and at the end of wave files with PyDub

How can I remove the silence from the beginning and the end of wave files with PyDub? I guess I should access segment by segment and check whether it's silent or not (but I'm not able to do it) :/ e.g. I have a wave file with silence at the…
DaniPaniz
  • 988
  • 2
  • 10
  • 18
9
votes
1 answer

Playing audio in pydub

How can I play a wav audio after importing it to my code? from pydub import AudioSegment song = AudioSegment.from_wav("explosion.wav")
Amen
  • 1,611
  • 4
  • 16
  • 38
9
votes
6 answers

Pydub (WindowsError: [Error 2] The system can not find the file specified)

I have a problem with Pydub module running in Windows and Linux. When I try open a mp3 file thus: from pydub import AudioSegment sound = AudioSegment.from_mp3("test.mp3") Console show me the next message: WindowsError: [Error 2] The system can not…
Benyi
  • 145
  • 1
  • 1
  • 9
8
votes
1 answer

Pydub - How to change frame rate without changing playback speed

I have a couple audio files that I open in Pydub with AudioSegment. I want to decrease the audio quality from frame rate 22050 to 16000 Hz. (One channel files) If I simply change the frame rate of AudioSegment, what I get is the exact same…
Daniel Möller
  • 74,597
  • 15
  • 158
  • 180
8
votes
2 answers

How to split the audio file in python

I'am working on Speech sentiment analysis on customer care data. I have an audio file where the customer care official has asked the question and the customer has given his review. I need to split this audio, and get only the review part from the…
Anagha
  • 1,903
  • 6
  • 19
  • 37
8
votes
2 answers

Pydub - combine split_on_silence with minimum length / file size

I have two scripts, one of them splits audio of a certain length, the other one splits audio on every time there is a silent passage. Would it be possible to split the audio on silence, but only after a certain time passed? I would need chunks of…
HCLivess
  • 815
  • 10
  • 19
8
votes
2 answers

Pydub concatenate mp3 in a directory

I would like to concatenate all .mp3s in one directory with pydub. The files are numbered consecutively file0.mp3, file1.mp3 etc. this code from the example code: playlist_songs = [AudioSegment.from_mp3(mp3_file) for mp3_file in glob("*.mp3")]…
digit
  • 1,431
  • 5
  • 27
  • 46
7
votes
2 answers

sampling audio doesn't preserve waves (vectors)!

I made a Telegram robot, and one of its jobs is to create samples from audio files. Now for most audios that is sent to it, the sample is perfectly fine; something like this: However, for some audios, the sample looks a bit odd: As you can see,…
Amir A. Shabani
  • 2,701
  • 3
  • 21
  • 46
7
votes
1 answer

Read from bytes not filename to convert audio

I have small-sized sound files stored in MongoDB as BSON. Task is to retrieve Binary data from the database, convert it to an appropriate format and send back to the front end. The problem is with the converting. I have found pydub can be used for…
O. Barinov
  • 131
  • 1
  • 9
1
2 3
21 22