kpreid / shinysdr

Software-defined radio receiver application built on GNU Radio with a web-based UI and plugins. In development, usable but incomplete. Compatible with RTL-SDR.
https://shinysdr.switchb.org/
GNU General Public License v3.0
1.07k stars 115 forks source link

Offer audio in a standard audio streaming format #117

Open bdn76 opened 5 years ago

bdn76 commented 5 years ago

Nice replcament for proprietry websdr. Can i listen stream without open browser via common wide player, VLC for example.

kpreid commented 5 years ago

Not currently possible — ShinySDR's audio stream is proprietary in the sense of "I made up the protocol and nobody else uses it". However, I have also thought it would be good to be able to just point a regular streaming audio player at a ShinySDR server. Thanks for making the issue.

This is not the same feature as #11, using WebRTC for to-browser streaming, but they might end up sharing some infrastructure.

bdn76 commented 5 years ago

Cool. Thanks.

kpreid commented 5 years ago

I've got a working implementation. It's uncompressed audio just like the existing stream. The latency is high since the browser doesn't consider this realtime and buffers a lot.

Just need to put in a link to it — probably next to the existing audio controls. And test with more players.

… dropping the URL into the ones I have handy just says there's a format error or does nothing. Maybe I need to create a "playlist"? I seem to recall that has been a thing, but I haven't used streaming audio not-in-a-web-page much lately.

bdn76 commented 5 years ago

Where i can get URL for stream?

kpreid commented 5 years ago

Sorry, I was unclear; the changes aren't pushed yet.

kpreid commented 5 years ago

As of commit 31fd6a791a4c3af729421800f32e9845cf0dd299 this feature is in; the link is inside the client audio controls (a collapsible section in the left sidebar where the Spectrum/Map/Telemetry/… display toggles are).

However, it doesn't work very well. Of the software I have handy, only Chrome will play the audio. Firefox tries to download it, Safari and QuickTime Player show a generic error, iTunes does something else random.

Non-mutually-exclusive hypotheses:

  1. Streaming a WAV file is not well supported; I need use something normal like MP3 instead. (This requires integrating an audio encoder library.)
  2. There's something I need to do to tell Firefox, at least, that this is not a file to be downloaded. (Seems unlikely.)
  3. For the non-browsers, I need to serve a playlist file rather than raw audio.
kpreid commented 5 years ago

Any recommendations from people familiar with HTTP audio streaming would be welcome.

bdn76 commented 5 years ago

Hmm... I'm do not see URL:

2018-11-12 09_17_16-shinysdr

Src up to date.

commit 7d89fb6260075c43be1e996aa6983b185d83546c Author: Kevin Reid kpreid@switchb.org Date: Fri Nov 9 08:28:15 2018 -0800

Implement audio streaming over HTTP.

Define a Resource that produces a streaming WAV, and add it to the
session as /<cap>/audio-stream.

The stream is not currently linked from anywhere.
bdn76 commented 5 years ago

Ok. I'm reconstruct URL from source: .../audio-stream/mono?rate=11025 and test it in player. mpv, vlc and ffplay work fine but mono/stereo switch not work:

.../audio-stream/stereo?rate=11025 Playing: .../audio-stream/stereo?rate=11025 [ffmpeg/demuxer] wav: Ignoring maximum wav data size, file may be invalid (+) Audio --aid=1 (pcm_f32le 2ch 11025Hz) AO: [pulse] 11025Hz stereo 2ch float

.../audio-stream/mono?rate=11025 Playing: .../audio-stream/mono?rate=11025 [ffmpeg/demuxer] wav: Ignoring maximum wav data size, file may be invalid (+) Audio --aid=1 (pcm_f32le 2ch 11025Hz) AO: [pulse] 11025Hz stereo 2ch float A: 00:00:06 / 00:00:09 (71%) Cache: 1s+179KB

MP3 would be better of course and variable bitrate must have for squelch interaction.

bdn76 commented 5 years ago

After cache flushing i'm see URL link:

20181112132050

kpreid commented 5 years ago

mpv, vlc and ffplay work fine

Thanks for the report!

mono/stereo switch not work:

There is (currently) no mono/stereo switch; /mono and /stereo only mean anything in the test code you saw them in. You can configure the server for mono audio but if the server is stereo there is no mix-down feature for individual streams, currently.

MP3 would be better of course and variable bitrate must have for squelch interaction.

Indeed! I hope that integrating codecs will improve this and also the interactive stream — the WAV stream is just what was easy to put together.