-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flac returning ValueError: array is too big #361
Comments
What does |
also getting this error for a flac file |
What does |
For me it looks like I just made a bad flac file. I used VNC to convert a wav into flac and I must have done something wrong, because I tried another converter and it worked. |
Interesting! I have seen another issue where a malformed file caused similar confusion. That's perhaps good to keep in mind. |
I'm seeing this error on FLACs generated by tuberipper.com . I don't know what TubeRipper uses to generate FLACs, unfortunately. I can't speak to whether these files are technically malformed, but this file opens in Audacity and VLC but fails with soundfile on Python 3.11:
|
Hi, I got the same issue with a flac file recorded with gnome-sound-recorder. Converting it to wav with ffmpeg works though
Looks like a bug in pysoundfile [EDIT]: After some digging, I found out that when a |
This is a backend issue with libsndfile, the library soundfile uses to open audio files. Please check there if this is a known bug. Soundfile currently lags behind libsndfile by one release, so it is possible that it is already fixed upstream. Since you mentioned pysoundfile. I hope that's a typo. Pysoundfile is severely outdated. Use soundfile instead. |
Hi, I got the same issue on soundfile. |
I started to write about it in the @AnkS4 example at the birdnet repository (the code is from there). My issue starts while I tried to read a 3 seconds flac file. this is my code: import soundfile as sf
from pathlib import Path
audio, _ = sf.read(Path("my_3_second_segment.flac"),start=0, stop=144000, dtype=np.float32)
"""
Error:
soundfile.LibsndfileError: Internal psf_fseek() failed.
""" using this, however, got no error: audio, _ = sf.read(Path("my_3_second_segment.flac"),start=0, stop=144000-1, dtype=np.float32)
audio.shape
# (143999, 2) as expected for 2 channels and according the input arguments if I take a longer file (more than 3 seconds) with the same arguments that failed - I get no error and the file shape is as expected if I drop the audio, _ = sf.read(Path("my_3_second_segment.flac"),start=0, dtype=np.float32)
"""
Error:
ValueError: array is too big; `arr.size * arr.dtype.itemsize` is larger than the maximum possible size.
""" As suggested here, converting to wav works, I chose to pipe the ffmpeg output to librosa (saved the disk IO), the signal length (in mono) is 144000 as expected: import subprocess
import io
import librosa
wav = subprocess.run(
f"ffmpeg -v quiet -i my_3_second_segment.flac -ar 48000 -y -f wav -",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
buffer = io.BytesIO(wav.stdout)
signal, _ = librosa.load(buffer, sr=48000)
signal.shape
# (144000,) as expected - by default converts to mono any ideas? |
I'm receiving ValueError on reading 'flac'.
ErrorLog:
The text was updated successfully, but these errors were encountered: