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

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

新聞中心

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

sndhdr —- 推測(cè)聲音文件的類型

源代碼 Lib/sndhdr.py

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


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

sndhdr.what(filename)

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

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

sndhdr.whathdr(filename)

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

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

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—-推測(cè)聲音文件的類型
URL網(wǎng)址:http://m.5511xx.com/article/cochcdo.html