Open BakerBunker opened 4 months ago
Since no file name is available with open
, you need to provide a format and subtype manually.
Is it possible to try to get the file name with name
property?
According to PEP519, the __fspath__
method is only for the path-like object, for file-like objects created by open
and remote file-like objects created by smart_open, the filename should accessed by name
property.
It should be reading the format from the name
property: https://github.com/bastibe/python-soundfile/blob/master/soundfile.py#L1466
It's strange, I get an error when I open the above file with sf.read(open("052316.mp3",'rb')), but not when I open this one, is it because the metadata is different? 111097.mp3.zip
file 052316.mp3
> Audio file with ID3 version 2.4.0
file 111097.mp3
> Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 320 kbps, 44.1 kHz, Stereo
Perhaps the file is broken in some way? Libsndfile is a bit more stringent in its MP3 implementation than some other libs.
I tried to read a mp3 with file handle, but soundfile failed to read.
it shows
and here is the file 052316.mp3.zip