Questions tagged [pydub]

Pydub is a Python library for audio manipulation.

Pydub is a Python library for manipulating audio.

Quick links:

427 questions
0
votes
0 answers

pydub: how to retain headroom across `export` and `from_file`?

What are the proper ffmpeg flags to pass through pydub.AudioSegment.export and / or pydub.AudioSegment.from_file to ensure the audio retains the expected headroom? I'm trying to write some unit tests that assert that audio normalization is taking…
aweeeezy
  • 806
  • 1
  • 9
  • 22
0
votes
1 answer

How do I convert a PyDub AudioSegment object into a SpeechRecognition AudioData object?

I'm trying to break an audio file into small subsections, and then perform speech recognition on each small subsection. To do this, I am splitting the file up using PyDub, and hoping to input it into the SpeechRecognition library. However, I want to…
0
votes
0 answers

How to get raw bytestring from AudioSegment

Hello I'm trying to get the raw bytestring out of pydub AudioSegment. I've already tried following: sound = AudioSegment.from_mp3(file="../source/myfile.mp3") bytestring = sound.raw_data and sound =…
Yingrjimsch
  • 122
  • 1
  • 11
0
votes
0 answers

Convert from oga to mp3 using pydub: ffmpeg returned error code: 1

I want to take an OGA file within a binary stream and convert it into mp3 using also another stream. I'm getting a permissions error even with running VSCode as administrator. This is my code: from pydub import AudioSegment AudioSegment.converter =…
Juan David
  • 2,676
  • 4
  • 32
  • 42
0
votes
0 answers

python write mp3 AudioSegment slice to file as mp3 without export method

I have an mp3 live radio stream, which i write locally to an mp3 file using ffmpeg and subprocess Popen (the ffmpeg). After i open this file with pydub and i wrote the raw_data to pyaudio for hearing the stream. Now after all, i want to record some…
Chris P
  • 2,059
  • 4
  • 34
  • 68
0
votes
0 answers

radio bot discord using selenium to automate entering the radio website and clicking the play button

I wrote a code in python using the libraries: discord.py, selenium and pydub, i also tried to use youtube_dl. Basically the logic is to transfer the audio from the website to the discord bot in the app's voice channel using selenium, ffmpeg and…
Athos
  • 1
  • 1
0
votes
0 answers

Audio clip speed up/slow down Python

Let's say I have two audio clips: 1a.mp3 and 1b.mp3 1a is 1.04s. 1b is 1.01s or 1a is 1.01s. 1b is 1.04s How can I change the speed of 1b so that the resulting clip would be the same as 1a. Here's a visual representation of what I want to do:…
SaltyBoy
  • 21
  • 4
0
votes
1 answer

Creating variables from a python dictionary with multiple values for each key using a for loop

I have an audio (wav) file imported into Python using the pydub package. I have a dictionary consisting of each key matching to 2 values. The key is meant to be used as the name for the variable in a subsequent step for variable creation. The values…
DTYK
  • 1,098
  • 1
  • 8
  • 33
0
votes
1 answer

pydub raises FIleNotFoundError when trying to get an mp3 file

my code: from pydub import AudioSegment AudioSegment.ffmpeg = r"C:\Users\תמרה\AppData\Local\ffmpegio\ffmpeg-downloader\ffmpeg\bin\ffmpeg.exe" sound = AudioSegment.from_mp3(r"C:\Users\תמרה\PycharmProjects\spotify\The Moon Drops - Nathan…
0
votes
1 answer

I have this function that tells me the length of an audio but it tells me a wrong number

from pydub import AudioSegment import math def get_audio_length(audio_file_path): # Load the audio file audio_file = AudioSegment.from_file(audio_file_path) # Get the duration of the audio in seconds duration_sec = len(audio_file) /…
0
votes
1 answer

How to convert mp3 data to wav data?

I have a wav audio file and i extracted data from that wav using python pydub module and i got this data [-139 18 -215 34 -196 6 -295 -31 -301 -35 -211 13 -93 47 -60 39 -58 7 -17 2] (this is first 10 data i got more than 1…
Yali
  • 1
  • 2
0
votes
0 answers

How can I change the playback speed of my audio file using a module in python?

I have a project with multiple mp3 audio files and i would like to create a slow/speed button to change the playback speed of the song whilst it is playing, althought it would be fine if i could change it before the song is playing as well. audio…
Vax
  • 1
0
votes
0 answers

How would I stop audio that is playing from pydub when using a voice command?

I am trying to stop audio from playing when I say stop, but it does not seem to work. The code I currently have is very rudimentary, and is as follows: import sys import threading import tkinter as tk import pydub import speech_recognition import…
0
votes
1 answer

how do I locate audio chunks in a specific location?

I'm a beginner programmer! I'm triyng to make a program that takes three audio file from a specific path, then divides this in random slices and save this slices in a new specific path. than the program should take the slices and marge them in…
0
votes
0 answers

PyDub can't locate FFmpeg, even after comfirming that FFmpeg is properly installed

After trying many solutions, checking that FFmpeg is installed correctly through cmd and other modules, PyDub still cannot find it. I am running Windows 11, Python 3.10.6, PyDub 0.25.1 and FFmpeg version…
TordG
  • 1