Re: [Savonet-users] Using liquidsoap to dynamically play .mp3 files in order one time and silence otherwise

2017-01-31 Thread Romain Beauxis
Hi Jeff,

2017-01-21 12:19 GMT-06:00 Jeff Garvas :
> This appears to work, but I'm curious if those of you more familiar with
> this scripting see a more efficient solution?
>
> set("server.socket",true)
> set("server.socket.path","path/to/socket")
>
> # points to a single blank .mp3 file
> silence = mksafe(playlist("./silence.m3u"))
>
> # If there is anything in the queue, play it.  If not, play the silence
> defined above repeatedly:
> radio = fallback([ request.queue(), silence])
>
> # Connect to icecast and play the radio object defined above:
> output.icecast(%mp3(stereo=false),
> host="192.168.1.1", port = 8000,
> user = "test", password = "test", mount = "/test",
>radio)
>
> Then, this works to push items into the queue and they appear to play
> immediately:
>
> echo "queue.push /path/to/file" | socat ./socket -
>
> So some questions:
>
> - Is there a better in-script way to generate silence until the queue is
> populated without having to reference a file?

Yes, you could use a blank() source and set the switch to be insensitive to
track limits to it switches to the queue as soon as it is available:

silence = blank()

radio = fallback(track_sensitive=false, [ request.queue(), silence])

> - Does anyone have any perl, python or php examples for connecting to the
> socket that work?  Struggling with that.

There used to be projects for this. Prolly some of those here:
http://liquidsoap.fm/tools.html

> - Is there any overall better way to accomplish what I'm doing?
> - What is the best way to define the meta data for each file I am placing
on
> the queue?

You can annotate requests with metadata this way:

queue.push annotate:title="Title 1",artist="Artist 1":/path/to/file

Metadata are filtered for security reason. The list of accepted metadata
tags is set through this setting:
set("decoder.metadata.export",
["artist","title","album","genre","date","tracknumber",
"comment","track","year","dj"])

> - Why would I be generating these just looping the blank mp3 file but not
> appear to actually be out of sync:
>
> 2017/01/21 02:50:44 [clock.wallclock_main:2] We must catchup 43.84 seconds
> (we've been late for 100 rounds)!

This can happen if for instance your server lacks CPU resources to
compute/encode the stream in real time.

> Some back story:
>
> I am generating audio files off of SDR dongles and each .wav file belongs
to
> a specific police/fire talk-group.  I want to selectively stream certain
> files towards a broadcastify.com stream in sequence and if possible I want
> to define the metadata with the name of the agency each audio file belongs
> to, and some of these transmissions are really brief so defining it in a
> timely manner is important.

That sounds like a fun project! Hope these clarifications help..
Romain
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users


Re: [Savonet-users] Using liquidsoap to dynamically play .mp3 files in order one time and silence otherwise

2017-01-21 Thread Jeff Garvas
This appears to work, but I'm curious if those of you more familiar with
this scripting see a more efficient solution?

set("server.socket",true)
set("server.socket.path","path/to/socket")
# points to a single blank .mp3 file
silence = mksafe(playlist("./silence.m3u"))

# If there is anything in the queue, play it.  If not, play the silence
defined above repeatedly:
radio = fallback([ request.queue(), silence])

# Connect to icecast and play the radio object defined above:
output.icecast(%mp3(stereo=false),
host="192.168.1.1", port = 8000,
user = "test", password = "test", mount = "/test",
   radio)

Then, this works to push items into the queue and they appear to play
immediately:

echo "queue.push /path/to/file" | socat ./socket -

So some questions:

- Is there a better in-script way to generate silence until the queue is
populated without having to reference a file?
- Does anyone have any perl, python or php examples for connecting to the
socket that work?  Struggling with that.
- Is there any overall better way to accomplish what I'm doing?
- What is the best way to define the meta data for each file I am placing
on the queue?
- Why would I be generating these just looping the blank mp3 file but not
appear to actually be out of sync:

2017/01/21 02:50:44 [clock.wallclock_main:2] We must catchup 43.84 seconds
(we've been late for 100 rounds)!
Some back story:

I am generating audio files off of SDR dongles and each .wav file belongs
to a specific police/fire talk-group.  I want to selectively stream certain
files towards a broadcastify.com stream in sequence and if possible I want
to define the metadata with the name of the agency each audio file belongs
to, and some of these transmissions are really brief so defining it in a
timely manner is important.

Thanks

On Fri, Jan 20, 2017 at 8:59 PM, Jeff Garvas  wrote:

>
> I've been reading some cookbook examples but I think my use case scenario
> is unusual.   I am generating small .mp3 files that I would like to be able
> to sequentially inform a running liquidsoap instance about, and have it
> play them in the order that they arrive.
>
> When there are no .mp3 files in the queue I want it to play silence.  My
> thinking is a 1 second .mp3 infallible file of silence would do the trick?
>
> What is the best way to build the queuing mechanism and inform liquidsoap
> of new items?   Is there a way to delete the file after it was played?
>
> Thanks
>
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users