org的ogg vorbis,opus和flac for python

PyOgg的Python项目详细描述


Pyogg

pyogg为xiph.org的ogg vorbis、ogg opus和flac音频文件格式提供绑定。

它与windows控制盘(.whl)发行版中所需的动态库(.dll)捆绑在一起。

所需的库包括ogg库(例如libogg.dll)和至少一个ogg opus库(例如libopus.dll、libopusfile.dll)和/或ogg vorbis库(例如libvorbis.dll、libvorbisfile.dll) 分别支持opus和vorbis,或者支持flac的flac库(例如libflac.dll)。

您可以使用pypi安装pyogg。

pip install PyOgg

所有的函数、结构和数据类型与C++实现相同,除了一些不能被翻译的。 如果要在本机上使用它们,则必须使用cTypes的数据类型。 请参阅官方文档和C++标题。

可以从pyogg.ogg、pyogg.vorbis、pyogg.opus和pyogg.flac导入各种函数,也可以使用pyogg中预定义的类和函数。

pyogg不能播放文件,但是,您可以使用openal进行正常播放,甚至使用PyOpenAL进行3d播放。

下面是pyogg自己的类和函数的参考:

<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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
springmvc web应用程序中的java导航出错/无效   java是一种JTable,其中每行中的列数可能不同   java哈希表不递减   在Java中使用Path和Path   java如何让服务知道应用程序何时被终止以清除通知?   java为什么sqlite看起来无法在设备中运行?   java Maven jetty插件和资源目录   java将负秒转换为小时:分钟:秒   java简单的安卓和ASP。净组合   java程序编译得非常好,但在运行其drop时,字符串输入会出错   java无状态AjaxFallbackButton?   Java字符串UTF和字节表示   无法从静态上下文引用java Gson非静态变量   java从网站中提取信息   java将派生对象引用分配给基类的变量将不起作用   java CXF自动生成失败   内存如何避免在Java中产生垃圾?   java Jersey:重定向到Jersey根目录之外   java Firestore遍历文档以查找空字段   java中ReadLock的并发检查副本