-
Notifications
You must be signed in to change notification settings - Fork 108
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
Writing OGG produces an empty file #130
Comments
I can confirm this on OS X. Ideally, our tests should have caught this! |
Thanks for confirming this ... I have still no clue what's going on here ... I originally thought it was enough to test only one format and rely on libsndfile that all others work, too. Regardless of this bug, we should probably add tests for FLAC and OGG anyway, since those could mistakenly be disabled in the shared library file. I guess a test for writing and afterwards reading FLAC is simple, since it's lossless, but I'm not sure how to test the contents of an OGG file. |
More experiments: import numpy as np
import soundfile as sf
f = sf.SoundFile('delme.ogg', 'w', 44100, 1)
f.write(np.random.randn(10000)) works fine on my machine (Linux, libsndfile 1.0.25-9.1, pysoundfile HEAD). However, if I write more than a few seconds, I get a SIGSEGV instead. Furthermore, if I write less than 10000 frames or so, subsequent long writes segfault as well. Yet, if I first write something between 10000 frames and a few seconds, then subsequent writes work perfectly fine, but do not write the last half second or so to the file. And then all audio data vanishes from the file on To be honest, it seems very unlikely that this is a problem on our end. |
That's very interesting! When I replace The thing with the segmentation fault is also interesting ... I couldn't find a fixed size where this happens, I had a crash with 1.500.000 samples once, but another time it just worked. Here's the C test file #include <stdlib.h>
#include <sndfile.h>
static const unsigned int LENGTH = 100000;
int main() {
float data[LENGTH];
SNDFILE* sf;
SF_INFO sfinfo;
sfinfo.samplerate = 44100;
sfinfo.channels = 1;
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS;
sf = sf_open("delme.ogg", SFM_WRITE, &sfinfo);
if (!sf)
{
printf("error!\n");
exit(99);
}
sf_count_t written = sf_writef_float(sf, data, LENGTH);
printf("written: %d\n", written);
sf_close(sf);
} And a LDLIBS = -lsndfile
all: ogg_problem |
Have you tried libsndfile-1.0.26pre6 from here http://www.mega-nerd.com/tmp/ ? I can't reproduce the bug (empty OGG) with this pre on Win x64. |
Hello, |
I believe we are currently shipping libsndfile 1.0.27 in the Windows and macOS wheels. At what version was this supposed to be fixed? |
Exactly, that's why I tested with the lastest version but with no success.
No one, but since the topic is 2 years old I wanted to know if there was any news. |
It appears that the problem still exists today with libsndfile 1.0.27. |
Unfortunately yes, and still with libsndfile 1.0.28. |
Still broken apparently. |
No ideas to fix this? |
This still seems to be broken. I haven't experienced seg faults, but when I write ogg files, the ends are very often cut off, which makes it sort of unusable. We care considering switching back to wav, but that would be unfortunate since ogg really saves a lot of space. |
I can confirm that this issue depends on the libsndfile version used.
@lcouka and @bastibe: as I was not able to reproduce the error under libsndfile 1.0.27 what did you do to get the error there? |
I have this same error. /Edit: |
You can query By the way, you say you are using "PySoundFile", which is severely outdated. Please install "soundfile" instead, which is the current version. |
Thanks for the advice! |
Any updates on this issue? Using Python 3.7 with the latest version of soundfile and anytime I try to write a sample numpy array to .ogg I always get an empty file. |
Which version of libsndfile and file are you using? |
I seem to have the same problem using libsndfile1 1.0.28-7ubuntu0.1 with I see no easy option for downgrading libsndfile1 to 1.0.27. |
i just tested with libsndfile-1.2.0 (as packaged in Debian, and afaict, the issue is gone) |
That's wonderful news, thank you for following up on this issue! |
I don't know if I'm doing something wrong, but this produces an OGG file with zero frames:
This doesn't seem to depend on my libsndfile binary, since the same error happens both on Debian Linux and on Windows XP 32bit.
To be sure, I compiled a little test program in C, which correctly writes a non-empty OGG file (this I tried only on Linux), so it cannot really be related to my installed version of libsndfile, or can it?
Any ideas what's wrong?
Can anybody write OGG files with PySoundFile?
Reading OGGs works perfectly, BTW ...
Writing other formats, too ...
The text was updated successfully, but these errors were encountered: