Read MP3 in Python 3

前端 未结 7 1186
面向向阳花
面向向阳花 2020-12-15 03:46

What I want to do is simply

mp3 = read_mp3(mp3_filename)
audio_left = mp3.audio_channels[0]

where audio_left will contain raw PCM audio dat

相关标签:
7条回答
  • 2020-12-15 04:31

    Code for playing songs in Python

    pip3 install python-vlc
    

    Download the python VLC package

    Code - import vlc

    #plays the song for 10 seconds
    
    import vlc
    import time
    
    song = '/home/fsociety/Music/1.mp3'
    
    playSong = vlc.MediaPlayer(song)
    song.play()
    time.sleep(10)
    

    or

    pip3 install playsound

    import playsound
    
    song = 'path_to_the_.mp3_file'
    
    playsound.playsound(song)
    

    That's it!

    0 讨论(0)
提交回复
热议问题