Exit code -1073741571 (0xC00000FD) when writing OGG files with python-soundfile

Open
#1,093 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Start by reading the linked python-soundfile issue and its maintainer response, then trace libsndfile's OGG/Vorbis writing path and relevant tests. Reproduce the crash with the reported repeated writes and check whether the process still exits with 0xC00000FD; done means the cause is identified and the crash is fixed or documented with a reproducer.

Written by the indexing model from the issue text.

Description

I use python-soundfile library and trying to write OGG file to BytesIO buffer, however every time I call sf.write(format="ogg") on my audio data, I get exit code -1073741571 (0xC00000FD).
Here's my function:

def attempt_convert_to_vorbis(audio_data: np.ndarray, samplerate: int, uses_librosa_format: bool) -> None | bytes:
    if uses_librosa_format:
        audio_data = audio_data.T
    vorbis_buffer = io.BytesIO()
    for i in range(0, 101):
        print(f"{i}%.")
        sf.write(vorbis_buffer, audio_data, samplerate, format="ogg", subtype="vorbis", compression_level=0.01*i)
        print("Wrote Vorbis data to buffer.")
        vorbis_buffer.seek(0)
        vorbis_data, _ = sf.read(vorbis_buffer)
        print("Read Vorbis data from buffer.")
        if np.array_equal(audio_data, vorbis_data):
            print("Vorbis data is identical to original.")
            return vorbis_buffer.read()
    return None

Even if I add try-except chunk for this call, the process just finishes with same exit code. Same thing happens if I remove compression_level, subtype and replace BytesIO buffer with actual file path.
I've first opened this issue on python-soundfile issues page. The maintainer responded to it saying it's probably libsndfile issue.

Dominant language
C
Stars
1.7k
Forks
476
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libsndfile/libsndfile

All issues in libsndfile/libsndfile

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.