Skip to content

Conversation

@ijc8
Copy link

@ijc8 ijc8 commented Sep 11, 2021

Modifies OpusFile/OpusFileStream's __init__() to accept a path or buffer and call the appropriate libopusfile function (op_open_file or op_open_memory, respectively).

Resolves #90.

@bernardohenz
Copy link

bernardohenz commented Aug 10, 2022

Hi @ijc8 , I'm looking exactly for this, but for loading a VorbisFile.
I'm trying to adapt your code to vorbis, but I couldn't find the equivalent of opus.op_open_memory for the vorbis.
Do you have any idea how to open a VorbisFile from memory?

@ijc8
Copy link
Author

ijc8 commented Aug 10, 2022

Hey @bernardohenz! I haven't tried it myself, but it should be possible using vorbis.ov_open_callbacks from libvorbisfile as mentioned here.

It looks like that's what opus.op_open_memory does under the hood. You could use opusfile's read-from-memory callbacks as a model, though this may be a little more painful to implement in Python with ctypes. (See here for how to use Python functions as C callbacks.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpusFile and OpusFileStream: Open Opus files from memory.

2 participants