Skip to main content

Xiph.org's Ogg Vorbis, Opus and FLAC for Python

Project description

PyOgg

PyOgg provides bindings for Xiph.org's OGG Vorbis, OGG Opus and FLAC audio file formats.

It comes bundled with the required dynamic libraries (.dll) in the Windows WHEEL (.whl) distributions.

The required libraries include the OGG library (e.g. libogg.dll) and at least either OGG Opus' libraries (e.g. libopus.dll, libopusfile.dll) and / or OGG Vorbis' libraries (e.g. libvorbis.dll, libvorbisfile.dll) to support Opus and Vorbis respectively, or the FLAC C library (e.g. libFLAC.dll) for FLAC support.

You can install PyOgg using PyPI.

pip install PyOgg

All the functions, structures and datatypes are the same as in the C++ implementation, except for some that couldn't be translated. If you want to use them natively you will have to use ctypes' data types. Please refer to the official documentation and the C++ headers.

You can import the various functions from pyogg.ogg, pyogg.vorbis, pyogg.opus and pyogg.flac or use the predefined classes and functions from pyogg.

PyOgg is not capable of playing files, however, you can use OpenAL for normal or even 3D playback with PyOpenAL.

Here's a reference for PyOgg's own classes and functions:

<class> pyogg.VorbisFile(path)
	# opens and reads an OGG Vorbis file to a buffer. 
		<str> path # path to the file (can be relative or absolute)

	<int> VorbisFile.channels
		# how many audio channels the audio data has (1 = mono, 2 = stereo, etc.)

	<int> VorbisFile.frequency
		# audio frequency (e.g. 48000, 44100, etc.)

	<str or bytes> VorbisFile.buffer
		# audio data

	<int> VorbisFile.buffer_length
		# length of the buffer

<class> pyogg.OpusFile(path)
	# opens and reads an OGG Opus file to a buffer. 
		<str> path # path to the file (can be relative or absolute)

	<int> OpusFile.channels
		# how many audio channels the audio data has (1 = mono, 2 = stereo, etc.)

	<int> OpusFile.frequency
		# audio frequency (always 48000)

	<opus_int16_p> OpusFile.buffer
		# audio data

	<int> OpusFile.buffer_length
		# length of the buffer

<class> pyogg.FlacFile(path)
	# opens and reads a FLAC file to a buffer. 
		<str> path # path to the file (can be relative or absolute)

	<int> FlacFile.channels
		# how many audio channels the audio data has (1 = mono, 2 = stereo, etc.)

	<int> FlacFile.frequency
		# audio frequency (e.g. 48000, 44100, etc.)

	<FLAC__int16_Array> FlacFile.buffer
		# audio data

	<int> FlacFile.buffer_length
		# length of the buffer

<class> pyogg.VorbisFileStream(path)
	# opens an OGG Vorbis file and prepares it for repeated reading. 
		<str> path # path to the file (can be relative or absolute)

	<vorbis.OggVorbis_File> VorbisFileStream.vf
		# Vorbis audio file stream

	<int> VorbisFileStream.channels
		# how many audio channels the audio data has (1 = mono, 2 = stereo, etc.)

	<int> VorbisFileStream.frequency
		# audio frequency (always 48000)

	<method> get_buffer() -> [buffer, buffer_length] or None
		# reads some audio data into a buffer (to set the buffer size, see pyoggSetStreamBufferSize)
		# if the file reaches it's end this method returns None
			<str or bytes> buffer # a buffer containing some audio data
			<int> buffer_length   # length of the buffer

	<method> clean_up() -> None
		# deletes the buffer and closes the file

<class> pyogg.OpusFileStream(path)
	# opens an OGG Opus file and prepares it for repeated reading. 
		<str> path # path to the file (can be relative or absolute)

	<opus.OggOpusFile> OpusFileStream.of
		# Opus audio file stream

	<int> OpusFileStream.channels
		# how many audio channels the audio data has (1 = mono, 2 = stereo, etc.)

	<int> OpusFileStream.frequency
		# audio frequency (always 48000)

	<method> get_buffer() -> [buffer, buffer_length] or None
		# reads some audio data into a buffer (to set the buffer size, see pyoggSetStreamBufferSize)
		# if the file reaches it's end this method returns None
			<opus_int16_p> buffer # a buffer containing some audio data
			<int> buffer_length   # length of the buffer

	<method> clean_up() -> None
		# deletes the buffer and closes the file

<class> pyogg.FlacFileStream(path)
	# opens a FLAC file and prepares it for repeated reading. 
		<str> path # path to the file (can be relative or absolute)

	<FLAC__StreamDecoder> FlacFileStream.decoder
		# FLAC audio file stream decoder

	<int> FlacFileStream.channels
		# how many audio channels the audio data has (1 = mono, 2 = stereo, etc.)

	<int> FlacFileStream.frequency
		# audio frequency (e.g. 48000, 44100, etc.)

	<method> get_buffer() -> [buffer, buffer_length] or None
		# reads some audio data into a buffer (to set the buffer size, see pyoggSetStreamBufferSize)
		# if the file reaches it's end this method returns None
			<FLAC__int16_Array> buffer # a buffer containing some audio data
			<int> buffer_length   # length of the buffer

	<method> clean_up() -> None
		# deletes the buffer and closes the file

<method> pyogg.pyoggSetStreamBufferSize(size)
	# changes the maximum size for stream buffers (initially 8192)
		<int> size # how much data each stream buffer holds

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyOgg-0.6.11a1.tar.gz (34.6 kB view details)

Uploaded Source

Built Distributions

PyOgg-0.6.11a1-py2.py3-none-win_amd64.whl (1.2 MB view details)

Uploaded Python 2Python 3Windows x86-64

PyOgg-0.6.11a1-py2.py3-none-win32.whl (1.0 MB view details)

Uploaded Python 2Python 3Windows x86

File details

Details for the file PyOgg-0.6.11a1.tar.gz.

File metadata

  • Download URL: PyOgg-0.6.11a1.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for PyOgg-0.6.11a1.tar.gz
Algorithm Hash digest
SHA256 0a05d2ece580b4c461d70950bc0ba14d81440d2925c05910851fac9e5d2de69a
MD5 cd8337198f26e51fe1ed21e1ace762fa
BLAKE2b-256 25001dc3a0b5b7ed0bd3837fb486824936031aefdd5e35fc541a522a90e8dd32

See more details on using hashes here.

File details

Details for the file PyOgg-0.6.11a1-py2.py3-none-win_amd64.whl.

File metadata

  • Download URL: PyOgg-0.6.11a1-py2.py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 2, Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for PyOgg-0.6.11a1-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f34f7f366548f5ee557f4b8314c8b407b147b6ca7b8511e23112d819fef86ce4
MD5 677b359bdec2b6e126b98c8f44d40e80
BLAKE2b-256 648fa69a0f94fc5e6a7ee04a6f01af7d246788a0b357522ed1b7ba892c046db9

See more details on using hashes here.

File details

Details for the file PyOgg-0.6.11a1-py2.py3-none-win32.whl.

File metadata

  • Download URL: PyOgg-0.6.11a1-py2.py3-none-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 2, Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for PyOgg-0.6.11a1-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 6f1c7bb9081b43c8368fa26fef22c9eac6f8c7eb2917edc51c64a28e65d107df
MD5 79d3aad2dd2ce7dbc7506cf4339df60d
BLAKE2b-256 ab86bbbcb68e728e982ef8b76a3ceeaab1fee95bc5d0a8c72fc4732e600b4773

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page