I have a raspberry pi 2 model B and a raspberry pi 1 (I think, it doesn't have any version number on it and I have had it for a long time and I don't quite remember exactly the version). I think the raspberry pi 2 would be better to do it on but It's already in use and I would want to use the other pi.

So I want to play music on the speakers connected to the pi from a stream, which I already have the URL for. How would I do this without any external modules and libraries. Please note that this is a learning project so I would like to do it without external libraries. I know both javascipt(nodejs) and python, so both of the two languages could be used in solutions.

Sorry for my English, if anything is unclear please comment and I'll try to clarify it.


1 Answer 1


I don't quite understand "playing music from a stream". Is it a stream like Twitch stream or is it a URL of a .mp3/.wav file? If it is the first type, could you please provide me the URL? Thanks!

I'm not sure about the first type streaming. But for the second one, you can use wget to download the file and play it with omxplayer. Or you can use pygame with Python to play music.

  • It's like an mp3 that has no end and keeps going, almost like a stream on Twitch but for audio only. Also is there a way in pygame to pass in a URL instead of the path for the audio file?
    – lolfail
    Jul 27, 2020 at 18:29
  • You have to read the URL somehow (wget, urllib3, ...) to play it. Read this stackoverflow.com/questions/31674416/…
    – Dat Le
    Jul 27, 2020 at 18:47
  • nevermind I used omxplayer to play the stream URL, turns out I'm just simply dumb :)
    – lolfail
    Jul 27, 2020 at 18:51
  • @lolfail If this answers your question, please tick the big checkmark on the left.
    – goldilocks
    Jul 27, 2020 at 21:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.