日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:sndhdr—-推測聲音文件的類型

sndhdr —- 推測聲音文件的類型

源代碼 Lib/sndhdr.py

從版本 3.11 開始標記為過時,將在版本 3.13 中移除。: sndhdr 模塊已被棄用(請參閱 PEP 594 了解詳情及其替代品)。


sndhdr 提供了企圖猜測文件中的聲音數(shù)據(jù)類型的功能函數(shù)。當這些函數(shù)可以推測出存儲在文件中的聲音數(shù)據(jù)的類型是,它們返回一個 collections.namedtuple(),包含了五種屬性:(filetype, framerate, nchannels, nframes, sampwidth)。這些 type 的值表示數(shù)據(jù)的類型,會是以下字符串之一: 'aifc', 'aiff', 'au', 'hcom', 'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul' 。 sampling_rate 可能是實際值或者當未知或者難以解碼時的 0。類似的, channels 也會返回實際值或者在無法推測或者難以解碼時返回 0。 frames 則是實際值或 -1。 元組的最后一項, bits_per_sample 將會為比特表示的 sample 大小或者 A-LAW 時為 'A', u-LAW 時為 'U'。

sndhdr.what(filename)

使用 whathdr() 推測存儲在 filename 文件中的聲音數(shù)據(jù)的類型。如果成功,返回上述的命名元組,否則返回 None

在 3.5 版更改: 將結果從元組改為命名元組。

sndhdr.whathdr(filename)

基于文件頭推測存儲在文件中的聲音數(shù)據(jù)類型。文件名由 filename 給出。這個函數(shù)在成功時返回上述命名元組,或者在失敗時返回 None。

在 3.5 版更改: 將結果從元組改為命名元組。

The following sound header types are recognized, as listed below with the return value from whathdr(): and what():

Value

Sound header format

‘a(chǎn)ifc’

Compressed Audio Interchange Files

‘a(chǎn)iff’

Audio Interchange Files

‘a(chǎn)u’

Au Files

‘hcom’

HCOM Files

‘sndt’

Sndtool Sound Files

‘voc’

Creative Labs Audio Files

‘wav’

Waveform Audio File Format Files

‘8svx’

8-Bit Sampled Voice Files

‘sb’

Signed Byte Audio Data Files

‘ub’

UB Files

‘ul’

uLAW Audio Files

sndhdr.tests

A list of functions performing the individual tests. Each function takes two arguments: the byte-stream and an open file-like object. When what() is called with a byte-stream, the file-like object will be None.

The test function should return a string describing the image type if the test succeeded, or None if it failed.

Example:

 
 
 
 
  1. >>> import sndhdr
  2. >>> imghdr.what('bass.wav')
  3. 'wav'
  4. >>> imghdr.whathdr('bass.wav')
  5. 'wav'

網(wǎng)頁標題:創(chuàng)新互聯(lián)Python教程:sndhdr—-推測聲音文件的類型
當前地址:http://www.5511xx.com/article/cochcdo.html