This is for the python Soundfile package
Questions tagged [soundfile]
58 questions
0
votes
1 answer
Difference in magnitude between sound file read and wave file read in Python
I am seeing an issue in the magnitude response between reading a wav file with soundfile and wavefile. Here are the different plots:
Can you tell me what I would need to adjust in the wavefile.read to get the same magnitude as the…

Joe
- 357
- 2
- 10
- 32
0
votes
1 answer
`st.audio` does not take a numpy array?
The streamlit docs (https://docs.streamlit.io/en/stable/api.html#streamlit.audio) state that streamlit.audio can take a numpy ndarray containing raw sample data and display an audio player. I tried this as follows on a local host:
import streamlit…

user32882
- 5,094
- 5
- 43
- 82
0
votes
0 answers
Why does librosa load change the flac file?
I have an original file 0.flac which I just open with librosa and then save with SoundFile as 1.flac:
import soundfile as sf
import librosa
in_path = "0.flac"
out_path = "1.flac"
sampling_rate = 16000
wav, source_sampling_rate =…

Andy
- 1,072
- 2
- 19
- 33
0
votes
1 answer
.wav file error : "AttributeError: 'bytes' object has no attribute 'seek'" in python
I am trying to loop through a large list of audio files and want to chop them up into 5 second pieces.
Relevant code for the problem is as below.
for file in os.listdir(directory):
f = sf.SoundFile(file)
audio_file =…

user6074035
- 107
- 1
- 9
0
votes
2 answers
Trouble installing Librosa properly (sndfile.dll has not attribute named 'sf_wchar_open')
I am trying to install librosa on Anaconda environment, I created a completely new and installed librosa, however I keep getting this problem, even when I re-install cffi package, audioread and others. I am not sure how I can fix this…

Mustafa Otbah
- 3
- 2
0
votes
0 answers
Random system error while saving .wav files
I've got a script that loads, resamples, renames and saves audio data to a new (or the same) location.
For the past two days, I've been trying to run this script on Google Cloud. With 8CPUs, this operation should take about 8 hours. I got 6 hours in…

rocksNwaves
- 5,331
- 4
- 38
- 77
0
votes
2 answers
Soundfile imports audio in two different formats
I am attempting to preprocess audiofiles to be used in a neural net with soundfile.read(), but the function is formatting the returned data differently for different .FLAC files with the same sample rate and length. For example, calling data, sr =…

Zack
- 77
- 2
- 6
0
votes
1 answer
Conda Installation Fails for PySoundFIle
I'm trying to understand why my conda installation of pysoundfile via the following command fails
conda install -n condaenv -c conda-forge pysoundfile
The error message seems to complain about a missing comparability between the required python…

ruhig brauner
- 943
- 1
- 13
- 35
0
votes
1 answer
Using PySoundFile, how can I get a buffer of bytes?
I am trying to load an audio file (via PySoundFile) and have it return a buffer of bytes. But current dtype's are ['float32', 'float64', 'int16', 'int32']
I need it as bytes to use with pocketsphinx: decoder.process_raw

Shamoon
- 41,293
- 91
- 306
- 570
-1
votes
1 answer
To support decoding 'mp3' audio files, please install 'sox'
I'm trying to work on an ASR model using transfer learning on wav2vec 2 model.
Anyway when I ever I wan't to show or modifiy an audio file I get this problem
def prepare_dataset(batch):
audio = batch["audio"]
# batched output is…

FOXASDF
- 43
- 3
-1
votes
1 answer
Save beep sound in a .wav file
I generaed a beep sound in Python, that exists for 5ms, and repeats after every 1s, for next 10s.
The codes are as such:
## Import modules
import time
import sys
import winsound
import soundfile as sf
## Set frequency and duration of beep…

LearnerABC
- 51
- 1
- 1
- 7
-1
votes
1 answer
Reading .wav as bytes
I'm reading .wav file in Python with 2 tools. First - with module soundfile:
wav = sf.read(speech_file)
b = io.BytesIO(wav[0])
In result I get such bytes data. It's…

dkagramanyan
- 71
- 6
-1
votes
1 answer
How can you repair damaged sound file?
I have a problem with my wav file. We played with our band (@bataty on instagram)in a club and we asked soundman to record the audio of our show. He gave us a record in wav but we cant play it anywhere.
Is the file damaged? Can somebody help me…

Martin Fáber
- 1
- 1