-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Compatibility issue with soundfile #787
Comments
I have further narrowed this down. If you write through an io.BytesIO object then it works.
Compare this to the version that failed (which is the way I was led to believe this should work through the examples)
|
might this be a side-effect of #796 cc @jakkdl @mpenkov ? @alexjbuck can you re-run your MWE using |
this issue (oct 2023) is older than #796 (merged feb 2024), so it can't be the cause of it. |
ah right, missed that 👍 |
Problem description
Somewhere between smart_open and soundfile data is getting lost when writing or reading to S3 (minio in this case).
The following is a mostly mvp that reproduces this issue. When reading a FLAC file from S3 through passing a file handle from
smart_open
to thesoundfile
library,soundfile
appears to find 1 less sample (2 bytes in this case) than was written. You can successfully readlen(input)-1
samples out of the file whereinput
is the original list used to create the audio file. When you try to read every sample out,libsndfile
errors:LibsndfileError: Internal psf_fseek() failed.
I do not know if this is a
soundfile
,libsndfile
orsmart_open
issue, because the audio library seems to think its getting shorted on data, in that the seek fails when seeking a length that should work (the length of the original sample).To confirm that it isn't an indexing issue, the actual length of the returned samples is one short (24999 vice 25000 in my example).
There is a related issue that I'll file separately that happens when you don't specify the number of frames/samples to read from the audio file when reading it through
smart_open
.I also included an example of using
smart_open
with a filesystem target, to demonstrate that it works for local filesystem objects, but not for remotes3
connections, which also makes me think this might be behavior insidesmart_open
at fault.My final objective is to read and write audio files (FLAC preferrably) to and from S3 storage from within Python.
Steps/code to reproduce the problem
Versions
Please provide the output of:
Full Error
Checklist
Before you create the issue, please make sure you have:
The text was updated successfully, but these errors were encountered: