Internet streaming
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Internet streaming
is it possible to get internet sound broadcasts (internet radio) with love or lua and play it through it?
Learning to Löve.
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Internet streaming
Possible, yes.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Internet streaming
How would one go about doing it do you know?zorg wrote:Possible, yes.
Learning to Löve.
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Internet streaming
Yes, i know how one would go about doing it.
...seriously now, it's really not that simple a thing to do.
In broad strokes, you'd need to get or write a lib capable of handling whatever net protocol the stream you'd want to listen to would use, it itself continuously receiving more data into a buffer, which you'd need to queue up for your soundcard to play back.
No idea whether any lua lib exists or not for the first part, the second can be solved with lpghatguy's queuablesource.lua, itself part of a lib allowing audio recording.
Furthermore, if you do intend all this to work alongside an actual game, for instance, all this should be threaded as well... how well that would work with data streams and buffer accessing is a can of worms even i don't really want to open after nearly 3 years now (of using löve) .
...seriously now, it's really not that simple a thing to do.
In broad strokes, you'd need to get or write a lib capable of handling whatever net protocol the stream you'd want to listen to would use, it itself continuously receiving more data into a buffer, which you'd need to queue up for your soundcard to play back.
No idea whether any lua lib exists or not for the first part, the second can be solved with lpghatguy's queuablesource.lua, itself part of a lib allowing audio recording.
Furthermore, if you do intend all this to work alongside an actual game, for instance, all this should be threaded as well... how well that would work with data streams and buffer accessing is a can of worms even i don't really want to open after nearly 3 years now (of using löve) .
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Internet streaming
Internet radio isn't that complex, actually: usually it's just an endless http file that happens to contain mp3/ogg/whatever data.
So you need, ultimately, 2 things:
1. A way to open a request and keep it open
2. A way to turn that data into a love.audio source
The easiest way I see, since love.audio already supports file-backed streaming sources, is to open a request on a new thread that pushes to a temp file (or ideally a named pipe), and then just read from that file on the main thread.
So you need, ultimately, 2 things:
1. A way to open a request and keep it open
2. A way to turn that data into a love.audio source
The easiest way I see, since love.audio already supports file-backed streaming sources, is to open a request on a new thread that pushes to a temp file (or ideally a named pipe), and then just read from that file on the main thread.
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Internet streaming
Not to nitpick, but one would think that streams used RT(S)P at least, and not http; you'd get the "playlist file" through http, that's possible, but whatever's inside it, usually one line, and not audio data, is the address from where the stream sends out the data proper.
And despite löve can stream audio from disk doesn't mean you can concurrently write to (whether append or replace the content in the process) the file that's currently streaming.
Then again, I might be wrong, but these were my usual experiences.
And despite löve can stream audio from disk doesn't mean you can concurrently write to (whether append or replace the content in the process) the file that's currently streaming.
Then again, I might be wrong, but these were my usual experiences.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Internet streaming
Could you not approach the problem in a different way - while its operating system dependant and you would need to verify that the software was on the machine in the first play using the system commands you could load the program, run the stream whilst running your lua program. Depending on what program you had - odds are especially for linux a lot of them can run in headless mode. Not sure about windows or mac.
Re: Internet streaming
At least last time I messed with icecast, http was the default.zorg wrote:Not to nitpick, but one would think that streams used RT(S)P at least, and not http; you'd get the "playlist file" through http, that's possible, but whatever's inside it, usually one line, and not audio data, is the address from where the stream sends out the data proper.
And despite löve can stream audio from disk doesn't mean you can concurrently write to (whether append or replace the content in the process) the file that's currently streaming.
Then again, I might be wrong, but these were my usual experiences.
I found an example: this is my local public radio, which provides a flash-based player and a .pls file which links to this.
Code: Select all
curl http://wamu-1.streamguys.com | mpg123 -
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 50 guests