roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.06k stars 213 forks source link

Failover to local audio #313

Closed BeyondChrispy closed 4 years ago

BeyondChrispy commented 4 years ago

It would be great to implement a feature that would allow playback of a locally stored audio file(s) on a Roc receiver in the event that the internet connection that Roc is using fails (or other similar failure of the stream). Once the internet connection is restored and the Roc stream is working again it goes back to streaming.

I'd like to use Roc as a Studio to Transmitter link solution for a radio station - this feature would be ideal.

gavv commented 4 years ago

Hi!

There is currently no such thing as internet connection, but we know the number of currently active sessions at the receiver, one session per sender. So we could add an option to specify the input file or device that should be used when there are zero active sessions. It's technically possible.

A few questions:

BeyondChrispy commented 4 years ago

Hi, At my radio station, we use a Band 1 analog radio transmitter/receiver to link the studio to the transmitter.  As a backup, we have a streaming receiver which constantly plays the radio station's web stream in case the analog link fails (the transmitter automatically switches to the streaming receiver).  The unit that does this is now rather old and I am looking to replace it with a higher quality solution.  If the stream receiver cannot play the stream (for example, internet connection failure or a stream problem at the studio), it plays an MP3 file from a USB drive until the stream is restored.  This allows us to keep on transmitting if there is no power at our studio (a very rare occurrence, but due to broadcasting laws in the UK, we have to provide protection against this type of failure).

I would run this (most likely) on a Rasperry Pi at both ends (send and receive).

We could call the feature 'Backup Audio'?

I'm no coder, I just thought I'd suggest the feature :)

gavv commented 4 years ago

Thanks, I see. "Backup audio" sounds good, I think.

I'll add this to 0.2 milestone, which we're currently working on.

The backup file is supposed to be played from the beginning every time when we lost connection, right?

BeyondChrispy commented 4 years ago

Hi Victor,

Yes, that sounds good. Thanks so much for your input.

Chris.

On Tue, 7 Jan 2020 at 08:37, Victor Gaydov notifications@github.com wrote:

Thanks, I see. "Backup audio" sounds good, I think.

I'll add this to 0.2 milestone, which we're currently working on.

The backup file is supposed to be played from the beginning every time when we lost connection, right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/roc-project/roc/issues/313?email_source=notifications&email_token=AOF2PUOUETHFNQ3Z4GKEG6LQ4Q5K3A5CNFSM4KCQEMG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIIDXCI#issuecomment-571489161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOF2PUNSISUVWNOPOGNNQIDQ4Q5K3ANCNFSM4KCQEMGQ .

gavv commented 4 years ago

@BeyondChrispy I've implemented this feature. It's pushed to develop branch. Could you test it?

Example:

$ roc-recv -vv -s rtp+rs8m::10001 -r rs8m::10002 --backup file:./somefile.wav
$ roc-send -vv -s rtp+rs8m:127.0.0.1:10001 -r rs8m:127.0.0.1:10002 \
  -i file:./anotherfile.wav

Manual page for roc-recv from develop: https://github.com/roc-project/roc/blob/develop/docs/sphinx/manuals/roc_recv.rst (grep for "backup").

Note that in develop, the command-line syntax changed a bit. It uses URIs for files and devices.

I think develop wont be merged in master very soon because 0.2 release is still in progress. In general, develop is considered unstable, however the current commit 56daef3fffc40d123ef6764734172b62e9a46b0a is known to work good. I recommend you to stick on this commit instead of using develop tip.

BeyondChrispy commented 4 years ago

Thank you Victor! I have had a busy time of late, but I'll endeavor to get it tested as soon as I can!

Chris.

On Mon, 20 Jan 2020 at 11:23, Victor Gaydov notifications@github.com wrote:

@BeyondChrispy https://github.com/BeyondChrispy I've implemented this feature. It's pushed to develop branch. Could you test it?

Example:

$ roc-recv -vv -s rtp+rs8m::10001 -r rs8m::10002 --backup file:./somefile.wav

$ roc-send -vv -s rtp+rs8m:127.0.0.1:10001 -r rs8m:127.0.0.1:10002 \ -i file:./anotherfile.wav

Manual page for roc-recv from develop: https://github.com/roc-project/roc/blob/develop/docs/sphinx/manuals/roc_recv.rst (grep for "backup").

Note that in develop, the command-line syntax changed a bit. It uses URIs for files and devices.

I think develop wont be merged in master very soon because 0.2 release is still in progress. In general, develop is considered unstable, however the current commit 56daef3 https://github.com/roc-project/roc/commit/56daef3fffc40d123ef6764734172b62e9a46b0a is known to work good. I recommend you to stick on this commit instead of using develop tip.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/roc-project/roc/issues/313?email_source=notifications&email_token=AOF2PUMVEP52N3SAQGYGU2LQ6WCUFA5CNFSM4KCQEMG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJMJMIQ#issuecomment-576230946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOF2PUKQDLPJKJGYWRQ2OFTQ6WCUFANCNFSM4KCQEMGQ .

gavv commented 4 years ago

Thanks, no hurry.

gavv commented 4 years ago

Closing this, feel free to reopen or create a new issue if you'll have troubles.