LoginSignup
4
4

More than 5 years have passed since last update.

音楽ファイルの情報を取得する(長さなど)

Posted at

soxコマンドではなく、soxiを使います。

% soxi qiita.wav


Input File     : './qiita.wav'
Channels       : 1
Sample Rate    : 16000
Precision      : 16-bit
Duration       : 00:03:15.35 = 5600 samples ~ 26.25 CDDA sectors
File Size      : 11.2k
Bit Rate       : 257k
Sample Encoding: 16-bit Signed Integer PCM

また、soxiは様々なオプションがあります。そのまま引用すると、

Usage: soxi [-V[level]] [-T] [-t|-r|-c|-s|-d|-D|-b|-B|-p|-e|-a] infile1 ...

-V[n]   Increment or set verbosity level (default is 2)
-T  With -s, -d or -D, display the total across all given files

-t  Show detected file-type
-r  Show sample-rate
-c  Show number of channels
-s  Show number of samples (0 if unavailable)
-d  Show duration in hours, minutes and seconds (0 if unavailable)
-D  Show duration in seconds (0 if unavailable)
-b  Show number of bits per sample (0 if not applicable)
-B  Show the bitrate averaged over the whole file (0 if unavailable)
-p  Show estimated sample precision in bits
-e  Show the name of the audio encoding
-a  Show file comments (annotations) if available

With no options, as much information as is available is shown for
each given file.

soxiだけだと、全部の情報が出てきてしまうけれど、オプションをつけると欲しい分だけ情報が取れるといったところですね。

4
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4