Replies: 4 comments 1 reply
-
Hi Michel, Sorry I took so long to reply, I didn't see your question until just now. I am not certain, but I suspect that the issue lies in the version of PyOgg you've installed. I imagine you've run "pip install pyogg", which installed version 0.6.14a1. What happens if you install the version in the GitHub repository?
That should allow you to run Please report back to tell me how you go. Cheers, Matthew |
Beta Was this translation helpful? Give feedback.
-
PyOgg can be used to achieve real-time encoding and/or decoding of Opus audio. Indeed, that's what I use it for personally. Most of these features are not yet released however. An official release, including all the recent Opus-related work, will happen soon. I would also expect that there would be no problem at all with real time encoding and decoding of OggOpus audio, especially if you're using the master branch from the git repository. However, I'm not entirely sure what you're trying to do. Are you trying effectively to write a Python program to play OggOpus files from, say, a network source? Are there synchronization concerns for playback? I would recommend that you consider OpusFileStream.
The duration of that PCM can be easily calculated. First find the length of the chuck in samples, then divide it by 48,000 (which is the number of samples per second for Opus-encoded audio). That gives you the length in seconds. Something like the following:
If your target is playback, then I'd recommend you consider simpleaudio. That will allow you to play back in real time. Finally, the last point in your question is concerning to me: I hope that's helpful. Matthew |
Beta Was this translation helpful? Give feedback.
-
I didn't answer your last question. How should you understand
OpusFile reads the entire file into memory. OpusFileStream reads "chunks" of the file at a time until it's read the whole file. In the case of your text, it's read 174 chunks and each chunk took on average 0.1 milliseconds to read. OpusFileStream read a total of 330360 samples. However OpusFile read more samples. Finally, the first 330360 samples read by both OpusFile and OpusFileStream were identical. |
Beta Was this translation helpful? Give feedback.
-
If you have other questions would you mind creating a new discussion for each topic? I think that would help others who were searching these archives. Cheers, Matthew |
Beta Was this translation helpful? Give feedback.
-
Hello,
I would like to run 04-opus-file-stream.py test as to learn pyogg.
But I meet with following error:
Cannot find reference 'as_array'/'get_buffer_as_array' in 'OpusFile | OpusFile'
here:
and:
Question are these still supported in the pyogg?
I hope this is the good forum to ask beginners question.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions