-
Notifications
You must be signed in to change notification settings - Fork 25
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
unable to write FLAC files with SoundFile #2
Comments
It would be interesting to know if it works with the DLLs from the original installer: http://www.mega-nerd.com/libsndfile/#Download |
It also fails. It is quite weird, that it works if I type the commands in the python command interpreter, but it fails when I execute it in a script. |
That's indeed weird. Did you make sure that you are using the same Python version in both cases? There might be a problem when closing the interpreter, you could try to add How does the crash look like? Is there an error message? |
This did not help. If I change the script into: import soundfile as sf
sf.write('test.flac', [x/10.0 for x in range(4097)], 48000) it also fails when I type the commands in the python interpreter (It does not fail if the length is 4096 samples). I get no error message from python. The Windows operating system says that python.exe does not work anymore. The output file is only an empty FLAC file. |
OK, can you please summarize in which exact combinations it works and in which it doesn't? I think in the end we should try to reproduce the problem with a little example program written in C and then report it to the libsndfile issue tracker (if it still occurs). |
The 32-bit version fails, if the buffer is big enough. The exact buffer size needed for failure is unclear. I made a simple test program in C, and compiled it using Visual Studio 2013. 32-bit: fails with libsndfile DLL > 1.0.25. The debugger says: If I change the output format to: #include <string.h>
#include <stdlib.h>
#include "sndfile.h"
#define NUMBER_OF_SAMPLES 480000
double buffer[NUMBER_OF_SAMPLES];
const char* outfilename = "test";
int main(int argc, char* argv[])
{
SNDFILE *outfile;
SF_INFO sfinfo;
unsigned int i;
memset(&sfinfo, 0, sizeof(sfinfo));
sfinfo.format = SF_FORMAT_FLAC | SF_FORMAT_PCM_16;
sfinfo.channels = 1;
sfinfo.samplerate = 48000;
if (!sf_format_check(&sfinfo)) {
printf("Invalid encoding\n");
return 2;
}
if (!(outfile = sf_open(outfilename, SFM_WRITE, &sfinfo))) {
printf("Error : could not open file : %s\n", outfilename);
puts(sf_strerror(NULL));
return 1;
}
for (i = 0; i < NUMBER_OF_SAMPLES; ++i)
buffer[i] = i *1.0 / NUMBER_OF_SAMPLES;
sf_write_double(outfile, buffer, NUMBER_OF_SAMPLES);
sf_close(outfile);
printf("ok\n");
return 0;
}
#pragma comment(lib, "libsndfile-1.lib") |
@raecke So this error also happens with the library files from the original libsndfile installer, right? I think you should raise an issue at libsndfile project: https://github.com/erikd/libsndfile/issues |
The script
crashes with the current master branch of SoundFile, and python 2.7.6 (32-bit) under Windows 7 64bit.
Also affected is tag 1.0.27. Tag 1.0.25 works.
The text was updated successfully, but these errors were encountered: