Questions tagged [soundfile]

This is for the python Soundfile package

58 questions
38
votes
2 answers

How can I remove distortion introduced by librosa griffin lim?

I'm doing: import librosa D = librosa.stft(samples, n_fft=nperseg, hop_length=overlap, win_length=nperseg, window=scipy.signal.windows.hamming) spect, _ = librosa.magphase(D) audio_signal =…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
6
votes
4 answers

AttributeError: cffi library '(pyModulesPath)\_soundfile_data\libsndfile64bit.dll' has no function, constant or global variable named 'sf_wchar_open'

When I try to use anything that's related to the module librosa, I get an error: Traceback (most recent call last): File "C:\Users\User1\Documents\test3.py", line 36, in x, Fs = librosa.load(fn_mp3, sr=None) File "C:\Program…
SF12 Study
  • 375
  • 4
  • 18
2
votes
3 answers

Getting soundfile.LibsndfileError: Error opening 'speech.wav': Format not recognized when giving 2D numpy array to soundfile

Tried generating audio from tensors generated from NVIDIA TTS nemo model before running into the error: Here is the code for it: import soundfile as sf from nemo.collections.tts.models import FastPitchModel from nemo.collections.tts.models import…
Jacob Mukiti
  • 23
  • 1
  • 5
2
votes
1 answer

ValueError: Package 'soundfile' does not exist or is not a package! on auto-py-to-exe

While converting a python programm that uses pytorch and pyaudio to .exe I´m getting "ValueError: Package 'soundfile' does not exist or is not a package!" on auto-py-to-exe even though it works fine in PyCharm and I have checked that soundfile is…
Lol Tesch
  • 21
  • 1
2
votes
1 answer

Cannot import soundfile (mac)

I get an error when I try import soundfile. I tried reinstalling soundfile via pip, but didn't work. Here's the error I get. Traceback (most recent call last): File "/Users/kona/.pyenv/versions/3.9.5/lib/python3.9/site-packages/soundfile.py", line…
salfare
  • 31
  • 2
2
votes
0 answers

WAV file written with AudioSegment.export() sounds half the speed as when rewriting the file with Soundfile.write

I am currently processing some audio data. I have an audio file that I have created from splitting a larger file on silence using pydub. However, if I take this audio file after exporting it with pydub, and then convert the AudioSegment's array to…
Coldchain9
  • 1,373
  • 11
  • 31
2
votes
1 answer

Pysoundfile library not importing

I'm new to Python (I installed the Anaconda distribution a couple weeks ago on my windows 10 machine) and am having trouble getting the pysoundfile library to import from the Spyder ipython console. These are the steps I followed: 1) I found the…
jds
  • 33
  • 4
2
votes
1 answer

How can I convert a numpy array (wav data) to int16 with Python?

I have some data that I assume is wav data. If I use: soundfile.write(filepath, my_data, samplerate) , then it correctly writes a wav file. But I want to somehow convert that wav data to int16 as currently it's some sort of float: [0.0018415 …
Shamoon
  • 41,293
  • 91
  • 306
  • 570
1
vote
0 answers

Opening Ogg is failing with soundfile: "Format not recognised"

import soundfile as sf def convert(): data, samplerate = sf.read('file.ogg') sf.write('file.wav', data, samplerate) I am having error while converting ogg file to wav: soundfile.LibsndfileError: Error opening 'file.ogg': Format not…
slck
  • 11
  • 1
1
vote
1 answer

Title: I'm encountering a CUDA out of memory error while trying to fine-tune the Whisper model in Arabic using PyTorch

The error message is as follows:CUDA out of memory. Tried to allocate 26.00 MiB (GPU 0; 23.65 GiB total capacity; 21.91 GiB already allocated; 25.56 MiB free; 22.62 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try…
1
vote
0 answers

Why the amplitude of the new audio file is not muted

I have a audio file namely audio.wav. I want to mute the peaks of the audio file if the amplitudes of those peaks are greater than 0.2 Although I am able to mark them successfully, I am unable to mute them (i.e, setting the amplitude as 0). What am…
1
vote
0 answers

Audio Recording In Python Can't Hear Output

I found some code online that is supposed to record audio using soundfile but after creating the recording, when I play it back, I can't hear anything. However, the recording is the correct duration, I think it just isn't receiving input. import…
Walker
  • 121
  • 1
  • 9
1
vote
0 answers

Error in librosa.load('path.webm') RuntimeError: File contains data in an unknown format

I am trying to load sound files on a python script. I installed, loaded the right version of modules, imported successfully librosa and soundfile, and even ffmpeg (which I found was a solution to this same error for mp3 files) import os import…
Syrine
  • 13
  • 3
1
vote
1 answer

Python sndfile library not found on newly installed Mac

(my first post here) I have a problem with the librosa python library, which produces the following error. OSError: sndfile library not found. I installed the librosa library and the SoundFile library with pip install and with conda install -c…
jonasblome
  • 21
  • 4
1
vote
0 answers

Python Librosa: How to create a stereo wav from mono?

I've tried a few suggestions from stackoverflow but unfortunately I can't get them to save as a valid wav file. When i try to open them they don't load properly or I get the following error. Any help will be greatly appreciated! "Error opening…
1
2 3 4