Skip to content

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

@Shararamosh

Description

@Shararamosh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions