This is for the python Soundfile package
Questions tagged [soundfile]
58 questions
0
votes
0 answers
Saving metadata when converting music file in python
I have the following Python script that should be able to convert a music file as an AIFF format. Everything works really well, however, the last function, sf.write do not allow me to save the new file with metadata.
import os
import soundfile as…

arrabattapp man
- 383
- 1
- 3
- 11
0
votes
0 answers
How to save wav file with different sample rate?
I have a wav file with sample rate of 44100.
I want to save it with different sample rate.
I tried with this code:
import soundfile as sf
SRC = "src.wav"
DST = "dst.wav"
data, samplerate = sf.read(SRC)
sf.write(DST, data, 16000)
But the DST file…

user3668129
- 4,318
- 6
- 45
- 87
0
votes
1 answer
sounddevice.PortAudioError: Error querying host API -9979
I am trying to do python audio with python-sounddevice on a macOS 13.2.1 with M1 chip but I can't get it to work. I installed portaudio and libsndfile with brew, then created a conda environment with sounddevice and soundfile packages then ran:
❯…

Nick Skywalker
- 1,027
- 2
- 10
- 26
0
votes
0 answers
librosa load with changed sr and ffmpeg have different result
I have input.wav with sample rate 4800.
librosa load in python
import librosa
y, sr = librosa.load("input.wav", mono=True, sr=16000)
print(y)
ffmpeg transform and load
% ffmpeg -i input.wav -y -ar 16000 -ac 1 output.wav
import librosa
y, sr =…

wts
- 21
- 4
0
votes
0 answers
How to save all windows.beep sound in a wav file python
I want to save all beep sound i wav file,i came across sf.write function but dont know how to use.
import time
import winsound
import soundfile as sf
freq = 550 # Hz
dotLength = 60 # milliseconds
dashLength = dotLength * 3
pauseWords = dotLength *…
0
votes
0 answers
Python (Soundfile Module) - Output is distorted
I am making a simple software which reads a map of events from a json file and creates sound based off of it.
The way I’m doing this is by having a objects which is the soundfile.read of a wav file and a function which makes a sample position based…

DeKrypt
- 33
- 4
0
votes
1 answer
Backend "sox_io" is not one of available backends: ['soundfile'] even after set up of 'soundfile' on torchaudio
I am working on some speech-recognition project, but I got error when I'be tried to load an audio.
RuntimeError: Backend "sox_io" is not one of available backends: ['soundfile'].
I've imported libries load_dataset, load_metric and Audio (per some…

Andrzej Kończyk
- 1
- 2
0
votes
1 answer
Couldn't store audio as MP3 file using soundfile
My intention is to process MP3 file using Librosa library (normalize volume, trim silences, etc). However, as Librosa doesn't support MP3 format I use audioread library to load audio; however, I could not find the function in audioread that writes…

ussrback
- 491
- 2
- 8
- 22
0
votes
0 answers
Processing: Unable to find sound file
I've been trying to add some music to a sketch I'm making, unfortunately a sound library error keeps popping up saying it's unable to find the file even though my sound files are in the data folder, have the same name and doesn't seem to have syntax…

maryam
- 1
- 1
0
votes
0 answers
Issue installing soundfile
I'm trying to install soundfile in a new conda environment. I've tried everything and I keep getting the ModuleNotFoundError: No module named 'soundfile'.
On the same machine, I have an old conda environment where it works. If I type pip show…

the_dummy
- 317
- 1
- 3
- 15
0
votes
1 answer
audio to array with torchaudio and librosa are different in python
I loaded mp3 file in python with torchaudio and librosa
import torchaudio
import librosa
filename='example.mp3'
array_tor, sample_rate_tor = torchaudio.load(filename,format='mp3')
array_lib, sample_rate_lib = librosa.load(filename,…

aaaaa
- 1
- 1
0
votes
1 answer
Data changed after saving with soundfile and reading with librosa
I am processing an audio file with librosa as:
import librosa
import soundfile as sf
y,sr = librosa.cora.load('test.wav', sr=22050)
y_processed = some_processing(y)
sf.write('test_processed.wav', y_processed , sr)
y_read =…

Kate
- 49
- 1
- 8
0
votes
0 answers
Flutter: How to invoke existing sound file?
I need to make an app, which can analyze existing sound files and get the frequencies of them.
As for analyzing frequencies, I plan to use fft. But as for invoking sound files, I don't know how to do in Flutter. Is there any useful packages which…

yamato
- 85
- 1
- 13
0
votes
1 answer
Getting error while unit testing my machine learning model on Audio files
I am getting errors when training my machine learning model which is for checking what a person is feeling while saying somthing. I am working with librosa, soundfile & MLPClassifier from sklearn. This is my code:
;imported required libraries
import…

Deepak Kumar
- 53
- 7
0
votes
1 answer
Python's SoundFile: soundfile.write and clipping
Suppose I read a WAV file using Python's soundfile,
import soundfile
x, fs = soundfile.read("test.wav")
The array x is in float32 and max(x) = 1, min(x) = -1. That is: each sample in x is a float32 number between -1 and 1.
I do some manipulation on…

Triceratops
- 741
- 1
- 6
- 15