question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read 6ch FLAC file

See original GitHub issue
sf.read(r'D:\temp\6ch_silence.flac')
Out[6]: (array([], shape=(0, 6), dtype=float64), 16000)

sf.read(r'D:\temp\2ch_silence.flac')
Out[7]: 
(array([[0., 0.],
        [0., 0.],
        [0., 0.],
        ...,
        [0., 0.],
        [0., 0.],
        [0., 0.]]),
 16000)

multi_ch_flac.zip

When I try to read 6ch flac file, soundfile returns empty array. 2ch is fine.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bastibecommented, Dec 1, 2022

So, I investigated this a bit:

It seems that there is a limit on how many samples can be read from flac files at the moment. With your 2ch-example, the entire file is smaller than the limit, but with the 6ch-example is bigger. Reading in chunks of up to 2:45 minutes (or thereabouts) seems to work. More than that does not work.

This is most probably related to https://github.com/libsndfile/libsndfile/pull/858, and will therefore hopefully be fixed in the next release of libsndfile.

If you don’t think this is related, please open an issue at libsndfile. Silent files can be weird edge cases sometimes.

0reactions
bastibecommented, Dec 5, 2022

(By the way, if you urgently need a fix, put an updated libsndfile in your load path, and soundfile will use it instead of its own)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Soundfile cannot read the full FLAC file it generated · Issue #236
I am generating a soundfile by appending to audioFile = sf.SoundFile(conf['pSavAudio'], mode='w', samplerate=samplerate, channels=nChan, subtype='PCM_16', ...
Read more >
Problem converting 6ch 24-bit wav to FLAC - HydrogenAudio
I tried converting the WAVs into FLAC using winamp 5.52 (Flake 0.11). The resulting FLAC files however are only 16-bit (although it's proper...
Read more >
How to Open, Edit, and Convert FLAC Files - Lifewire
What to Know. A FLAC file is an audio file in the Free Lossless Audio Codec format. Open one with VLC media player....
Read more >
KB5003430: FLAC encoded music file is corrupted when ...
This update addresses a metadata encoding issue which causes Free Lossless Audio Codec (FLAC) music files to become unplayable if their title, artist, ......
Read more >
Can't play 24bit/96kHz flac files - narkive
If I try to play them in MOC I get: (0) Can't set audio parameters: Invalid argument. With mplayer I see: MPlayer SVN-r30656...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found