How to play mp3 from URL
<p>I'm trying to write a python script that will play mp3 from Soundcloud URL</p>

<p>This is what I've already done:</p>

<pre><code>from urllib.request import urlopen

url = "soundcloud.com/artist/song.mp3"
u = urlopen(url)

data = u.read(1024)

while data:
   player.play(data)
   data = u.read(1024)
</code></pre>

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

<p>I tried <code>pygame</code> by creating <code>Sound</code> 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.</p>

<p>I'm working with Python 3 and Ubuntu.</p>