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
1 answer

Is there a way to set an audio file's sample size in bytes using librosa?

In AudioSegment from from pydub import AudioSegment, there is a function set_sample_width. From the docs: Creates an equivalent version of this AudioSegment with the specified sample width (in bytes). Increasing this value does not generally cause…
John Lexus
  • 3,576
  • 3
  • 15
  • 33
0
votes
1 answer

python pydub - wav works, mp3 doesn't

Simple few lines, using pydub. The wav line works, the mp3 line doesn't. I do have ffmpeg installed (today), and included inthe path, and restarted PyCharm. If I type ffmpeg in cmd window, all ok. Not sure why one works an the other doesn't. Any…
garrettb
  • 139
  • 11
0
votes
1 answer

.WAV Audio Produced by PyDub AudioSegment.split_on_silence() has no RIFF ID when reading with wave.open

I am currently taking a large audio file and splitting it based on silence using PyDub's split_on_silence function. However, when I go to open this file using wave.open I get an error saying the .wav file has no RIFF id. The source file I am using…
Coldchain9
  • 1,373
  • 11
  • 31
0
votes
1 answer

Pydub Split on silence error: UnboundLocalError: local variable 'start_ii' referenced before assignment

I try to get a python code running with the pydub library that should split an audio file on silent parts. The code is pretty short but still I get errors that I can't understand. Thanks a lot for your help: Complete error message: Traceback (most…
studioDKR
  • 23
  • 3
0
votes
0 answers

Python Conversion from WAV to FLAC

Ive tried to run the following Code: import sys import os import pydub import glob from pydub import AudioSegment wav_files = glob.glob("X:\general\XXXXX\GSTT\Flac Dateien/*.wav") #print(flac_files) for wav_file in wav_files: flac_file =…
0
votes
1 answer

Mute parts of Wave file using Python/FFMPEG/Pydub

I am new to Python, please bear with me. I have been able to get so far with the help of Google/StackOverflow and youtube :). So I have a long (2 hours) *.wav file. I want to mute certain parts of that file. I have all of those [start], [stop]…
Adil Azeem
  • 11
  • 3
0
votes
1 answer

pydub Overlay Delay

I'm trying to create a mix out of two audio tracks (vocal and instrumental) that are of the same duration (3.:30). However, when I try to use the overlay function, my vocal starts too soon. from pydub import AudioSegment sound1 =…
b1nkh4x0r
  • 5
  • 4
0
votes
1 answer

play audio file in the background

I want to play an audio file in the background (without blocking the rest of my code) using Pydub library. Here is the code I have so far but it will wait till the audio finishes and then run the remaining of the code sound =…
Anita
  • 49
  • 1
  • 10
0
votes
1 answer

AttributeError: 'str' object has no attribute 'raw_data' (Python Voice Assistant)

Hello guys ı am trying to do desktop voice assistant for ubuntu.In my program ıt was working with os.system("mpg123 audio.mp3") How can ı use pydub module instead of this line? but ı don't want to use system to play audio file for talk with me.I…
Can İlgu
  • 137
  • 3
  • 12
0
votes
2 answers

How do I stretch the x-axis of a matplotlib spectrogram?

Sorry if this is a really obvious question. I am using matplotlib to generate some spectrograms for use as training data in a machine learning model. The spectrograms are of short clips of music and I want to simulate speeding up or slowing down the…
cainy393
  • 422
  • 1
  • 4
  • 16
0
votes
1 answer

How to combine two audios and train them in machine learning

I've to train a neural network using audio files. I have an audio dataset that contains the folders with a person's name and commands. Suppose, one folder is 'Marvin', the name of the person becomes 'Mavin' and another folder 'speak', so the command…
0
votes
1 answer

pydub computes rms differently to sox

I am confused by how pydub computes rms. In [187]: audio = AudioSegment.from_mp3("sample-mp3") In [188]: audio.rms Out[188]: 1041 In [189]: audio.dBFS Out[189]: -29.959984108983633 However using sox: $ sox sample.mp3 -n stat Samples read: …
Blue482
  • 2,926
  • 5
  • 29
  • 40
0
votes
2 answers

playing sound without initial click in python

I am new to python and am attempting to build a simple alarm app (command line for now). This is using Python 3.6 and I am developing on Ubuntu 18.04. When I play a sound using pydub, playsound or simpleaudio, the sound is preceded by an annoying…
Bill Turner
  • 869
  • 1
  • 13
  • 27
0
votes
1 answer

how to convert .mp3 to .wav using python?

I tried using pydub to convert mp3 to wav but I'm getting this error: OSError Traceback (most recent call last) in () 5 dst= '/Users/user/Downloads/audio_files/5.wav' …
sudarsan vs
  • 113
  • 1
  • 8
0
votes
1 answer

pydub no ffprobe found

I have an app for MacOS that is compiled with py2app. The app uses the pydub module and the latter uses ffmpeg family package. The problem is that once I compile the app and move it to a different OS, the subprocess call from pydub fails to find…
Virgil Sisoe
  • 195
  • 1
  • 12