Questions tagged [pydub]

Pydub is a Python library for audio manipulation.

Pydub is a Python library for manipulating audio.

Quick links:

427 questions
1
vote
0 answers

Permission denied error while converting mp3 to wav using pydub

I am trying to convert many MP3 files in a folder to WAV using AudioSegment but I am getting permission denied error. Here is the code I'm using: from os import path from pydub import AudioSegment # files …
1
vote
1 answer

Error while reducing the volume of a audio clip using python

I've tried to reduce or raise the volume of an audio clip using pydub. But when I did so it is giving following error. …
kalyan dk
  • 19
  • 4
1
vote
1 answer

Python pydub AudioSegment MemoryError

I am pretty new to Python and am running into a MemoryError issue when trying to create an AUdioSegment object from a 44 MB .mp3 audio file. I have no issues when dealing with most audio files I have but they are all less than 1 MB except for this…
theHolc
  • 21
  • 1
1
vote
0 answers

How to cut (`trim`) audio with timestamps Python

Ok everyone this is a very very very hard problem. I've spent 3 days already and this feels like a millennium prize math problem. Ok so I have a .ttml of timestamps where I analyzed a mp4 video and stripped subtitles. The assumption is that these…
Mystery Man
  • 535
  • 2
  • 7
  • 20
1
vote
0 answers

Audio gets stuck on stream.write in Pyaudio

I am trying to play audio through the play function of pydub play(audio_segment) but the function was getting constantly stuck on this function without actually playing the audio. It seems like pydub is getting stuck on the def…
Lloyd
  • 1,119
  • 10
  • 29
1
vote
1 answer

How to sum every row of a permutation in python

My goal is to differently sum ten audio files obtained from the permutations in order to have a different audio file for each permutation (10! = 3 628 800 final audio in total) and export them as wav files. Example (sound1 + sound3 + sound2+ sound4…
V_20_sl
  • 45
  • 2
  • 10
1
vote
0 answers

Can we use python yield and create a generator object for audio data in .wav format and get them back?

I want stream my data(audio) from my pc to server. During this process I am ending up saving files on server. I want some suggestions on how I could use the data I stream to server without saving the data on the server. I got to know about python…
Bharath_Raja
  • 622
  • 8
  • 16
1
vote
1 answer

cannot stop audio playback gracefully using pydub or playsound in python

This question was asked and answered here: Stop the audio from playing in pydub However, the one answer does not work for me. I am using pydub, Python 3.6 on Ubuntu 18.04. I have tried a number of variations of the following code, including the…
Bill Turner
  • 869
  • 1
  • 13
  • 27
1
vote
1 answer

Python use ffmpeg not running when using os.system

I have been trying to convert mp3 audio to wav file using subprocess. I have installed ffmpeg and libav using home-brew. However whenever I run my code. import subprocess subprocess.call(['ffmpeg', '-i', 'input.mp3', …
GILO
  • 2,444
  • 21
  • 47
1
vote
0 answers

Moviepy Audio Changes With Extraction

I'm trying to extract some audio from a video and combine it with another audio file to create a 'background noise' on the original video. When I extract the audio from the video, it speeds up and skips. For example, if the audio on the video were…
Ben Gardner
  • 121
  • 1
  • 13
1
vote
2 answers

Convert multiple MP3 files to WAV in python

I want to convert multiple MP3 audio files in a folder to WAV format (with mono type) using python code. I tried the below code using pydub: import os from pydub import AudioSegment audio_files = os.listdir('path') # Folder is having audio files of…
1
vote
1 answer

How to restore the binary data into the audio file?

I used pydub to load the audio file just as follows, audio = AudioSegment.from_mp3(file_path).set_frame_rate(22050).set_channel(1) but if i get the binary data of the audio file, i use the following way, def get_file_content(filePath): with…
Kwoks
  • 33
  • 5
1
vote
1 answer

Play multiple looping audio tracks starting at random times in Python?

I have a list of sound samples of various lengths saved as .wav files. I want to play the fist sample and have it loop forever. As some point in time after an event or a state change I want the 2nd sample to begin playing with the first sample. …
lukecv
  • 113
  • 1
  • 11
1
vote
1 answer

How to split a audio file based on silence and overlap the last say 2 seconds in python

Currently I am using this code to cut the audio file into small chunks: sound = AudioSegment.from_mp3("1.WAV") f=open("decoded.txt", "a+") chunks = split_on_silence(sound,min_silence_len=280,silence_thresh=-33,keep_silence=150) for i, chunk in…
1
vote
0 answers

subprocess.Popen only working in Terminal

I am trying to load an mp3 file with pydub.AudioSegment.from_mp3, however I get this error C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not…
optimalic
  • 511
  • 3
  • 17