#!python # -*- mode: python; Encoding: utf-8; coding: utf-8 -*- # Last updated: <2018/12/05 18:06:06 +0900> """ use pydub. read wav file. 【Python/pydub】再生時間、サンプリングレート、チャンネル数を取得 | アルゴリズム雑記 https://algorithm.joho.info/programming/python/pydub-time-sampling-rate-channel/ pydubを使って音楽を鳴らす - Python - TIL https://tmg0525.hatenadiary.jp/entry/2018/05/24/211022 Windows10 x64 + Python 2.7.15 32bit """ from pydub import AudioSegment from pydub.playback import play sound = AudioSegment.from_wav("hello.wav") print("Channel : %d" % sound.channels) # 1:mono, 2:stereo print("Sampling rate : %f Hz" % sound.frame_rate) print("Duration : %f sec" % sound.duration_seconds) play(sound)