What is the easiest way to read wav-files using Python [summary]?

后端 未结 8 668
夕颜
夕颜 2020-12-09 13:13

I want to use Python to access a wav-file and write its content in a form which allows me to analyze it (let\'s say arrays).

  1. I heard that \"audiolab\" is a sui
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 13:46

    pydub provides an even easier solution without any dependencies needing to be installed (for wav files). I'm currently using this method in production without any issues.

    from pydub import AudioSegment
    awesome_song = AudioSegment.from_wav('awesome_song.wav')
    print('Duration in seconds is {}'.format(awesome_song.duration_seconds))
    

提交回复
热议问题