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

Why does pydub think that the length of my AudioSegment is 0 when applying crossfading?

I have a series of extremely short clips I'm trying to merge together (typically only 1/10th of a second). This works fine when joining them with the += operator, but the .append() method, regardless of what argument is passed for crossfade, will…
rllysleepy
  • 52
  • 7
0
votes
1 answer

Pydub AudioSegment export has no sound

I have this simple code: from pydub import AudioSegment audio = AudioSegment.from_wav("recordings/source.wav") audio.export("recordings/export.wav", format="wav") The source.wav is a 5-second recording. The code generates the export.wav, but the…
Ryan Pergent
  • 4,432
  • 3
  • 36
  • 78
0
votes
0 answers

Volume change when overlaying multiple AudioSegments

Does PyDub make any changes to volume when overlaying audio? Is the volume of each segment halved? I want to overlay multiple segments together, but I'm not sure if the volume will be accurately distributed. Assuming I have 3 AudioSegments and I…
The om
  • 16
  • 2
0
votes
0 answers

Replacing an audio channel with silence using pydub

I want to replace the left channel of an AudioSegment with silence using python and pydub. I tried this: sound: AudioSegment = AudioSegment.from_mp3(mp3_file) original_mono = sound.set_channels(1) duration_seconds: float =…
Mike Perrin
  • 320
  • 2
  • 7
0
votes
0 answers

Pydub can't locate existing audio file in a different PC

I made a script that at some point creates a an audio from a scraped text, and I need to get the lenght of this audio so I'm using pydub AudioSegment to read it and get the duration in seconds. def time_of_audio(AUDIO_PATH): audio =…
0
votes
0 answers

How to reduce dBFS of an Audiofile that is close to maximum volume?

My Mandarin teacher gave me a radio recording of someone reading Harry Potter but the problem is it is very loud - painfully so. It sounds like the microphone is in the person's mouth the whole time. As a hobby project I thought it would be neat to…
Grant Curell
  • 1,321
  • 2
  • 16
  • 32
0
votes
2 answers

How to export played audio that is merged and looped through via Python?

I have code in Python that loops through and merges a series of audio files to play a customized sound as follows: from pydub import AudioSegment from pydub.playback import play sounds =…
Ricardo Francois
  • 752
  • 7
  • 24
0
votes
1 answer

Error while convering mp3 file to wav file format using python pydub module

I am trying to convert my mp3 file to wav format but its giving error like this My Code from pydub import AudioSegment src = "my_result.mp3" dst = "final.wav" sound = AudioSegment.from_mp3(src) sound.export("final.wav",format="wav") But this code…
0
votes
1 answer

How to get the chunk times from pydub split_on_silence?

I'm using split_on_silence to split a mp3 file to multiple segments: sound = AudioSegment.from_mp3(TEST_FILE) audio_chunks = split_on_silence(sound, min_silence_len=300, keep_silence=50, silence_thresh=-40 ) Is it possible (How can I do it)…
user3668129
  • 4,318
  • 6
  • 45
  • 87
0
votes
1 answer

SimpleaudioError: Error opening PCM device. -- CODE: -5 -- MSG: Input/output error

When I run play_audio() it works without any problem and I can hear the audio playing. from multiprocessing import Process from pydub import AudioSegment from pydub.playback import play name = "audio.wav" def play_audio(): wavf=…
ramyun
  • 13
  • 3
0
votes
0 answers

Pydub audiosegment output shorter than the sum of concatenated constitutent audiosegments

I use Pydub to concatenate very short wav audiofiles (200ms) that include sounds and silences for an experiment. The sounds I use are previously created and manipulated in Audacity to have sepcific durations and charachteristics. These concatenated…
0
votes
1 answer

Create a multichannel audio with Pydub

I'm trying to create an multichannel audio file with Pydub but I received an error. I know that each channels should be the exact same length, but also the frame count. I don't know how to verify if they are at the same frame count but they are at…
0
votes
0 answers

Sampling frequency is not preserved while using raw data?

I am using pydub to do some experiments with an audio file. After I load it I want to take some parts and analyze them further with numpy, so I extract the raw data as explained here Pydub raw audio data song =…
Fra93
  • 1,992
  • 1
  • 9
  • 18
0
votes
0 answers

Pydub AudioSegment pan not working on windows 10, but is working on mac

I am running the following code segment: import pydub from pydub import AudioSegment from pydub.playback import play from datetime import datetime blast_file = AudioSegment.from_mp3( "/Users/ME/Desktop/Current Work/CRTT study -…
0
votes
0 answers

How to create pydub.AudioSegment from torch.Tensor object?

I am trying to create a pydub.AudioSegment from torch.Tensor object. I tried to transform into an intermediate data type (e.g. numpy) like in the code below. Not a successful method. wav_audio = AudioSegment( …