Movatterモバイル変換


[0]ホーム

URL:


Navigation

22.8.sndhdr — Determine type of sound file

Source code:Lib/sndhdr.py


Thesndhdr provides utility functions which attempt to determine the typeof sound data which is in a file. When these functions are able to determinewhat type of sound data is stored in a file, they return a tuple(type,sampling_rate,channels,frames,bits_per_sample). The value fortypeindicates the data type and will be one of the strings'aifc','aiff','au','hcom','sndr','sndt','voc','wav','8svx','sb','ub', or'ul'. Thesampling_rate will be either the actualvalue or0 if unknown or difficult to decode. Similarly,channels will beeither the number of channels or0 if it cannot be determined or if thevalue is difficult to decode. The value forframes will be either the numberof frames or-1. The last item in the tuple,bits_per_sample, will eitherbe the sample size in bits or'A' for A-LAW or'U' for u-LAW.

sndhdr.what(filename)

Determines the type of sound data stored in the filefilename usingwhathdr(). If it succeeds, returns a tuple as described above, otherwiseNone is returned.

sndhdr.whathdr(filename)

Determines the type of sound data stored in a file based on the file header.The name of the file is given byfilename. This function returns a tuple asdescribed above on success, orNone.

Previous topic

22.7.imghdr — Determine the type of an image

Next topic

22.9.ossaudiodev — Access to OSS-compatible audio devices

This Page

Quick search

Enter search terms or a module, class or function name.

Navigation

©Copyright 1990-2017, Python Software Foundation.
The Python Software Foundation is a non-profit corporation.Please donate.
Last updated on Sep 19, 2017.Found a bug?
Created usingSphinx 1.2.

[8]ページ先頭

©2009-2025 Movatter.jp