Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5970

How to play mp3 from URL

$
0
0

I'm trying to write a python script that will play mp3 from Soundcloud URL

This is what I've already done:

from urllib.request import urlopenurl = "soundcloud.com/artist/song.mp3"u = urlopen(url)data = u.read(1024)while data:   player.play(data)   data = u.read(1024)

I tried pyaudio with many options like changing formats, channels, rate.and I just get strange sound from the speakers, I searched Google for pyaudio playing mp3 and didn't found any information.

I tried pygame by creating Sound object by passing the bytes from the mp3 and then just by executing the play function. I am not getting any errors: the script runs but nothing is playing.

I'm working with Python 3 and Ubuntu.


Viewing all articles
Browse latest Browse all 5970

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>