MPD to automate a webradio

General Discussion about MPD – anything that doesn't fit in the other MPD forums.
Post Reply
Arvy
Posts: 4
Joined: July 5th, 2018, 8:13 pm

MPD to automate a webradio

Post by Arvy » July 5th, 2018, 8:40 pm

Hi there,

I'm new to MPD. I'm starting a project to create a webradio management system. Songs, commercials, spots, radio shows, control songs categories, play hours, logs, and so. And I'll have a script to output the "next mp3 file(s)", as a playlist.

Everything is going cool, but it's time to find a player that can read the playlist dynamically, play the audio, and then I'll encode to an Icecast server.

I found a software called Liquid Soap but it's hard to work :roll:

So I found MPD+MPC and I'm trying to check if them can help me :mrgreen:

All I need is control the playlist, reading somewhere the next file.
Control crossfading or auto-detect dB level to start playing the next file is cool too.
But I'm also interested in the MPD network protocol, maybe connect directly on TCP port 6600 and check status, trigger new files, and so.

Well, I'm on the right way? Any add info that can help me in a first moment?

Thanks a lot!
Arvy

max
Forum team
Posts: 729
Joined: January 15th, 2013, 3:43 pm

Re: MPD to automate a webradio

Post by max » July 6th, 2018, 8:23 am

You can do that with MPD. What might be interesting for you, since you want to automate: MPD separates the playback engine (i.e. MPD itself) and the controller (the client) into separate, mostly independent programs. You can write a client in any language you prefer and implement the automation.

Arvy
Posts: 4
Joined: July 5th, 2018, 8:13 pm

Re: MPD to automate a webradio

Post by Arvy » July 6th, 2018, 12:06 pm

Hello Max,

great, thanks. Just give me some additional information, so I'll start to study and do some tests:

- crossfading (based on dB level or seconds remaining), it's automatic or I need to control?

- the "next song": if my playlist has just one song, how/when it will request the next one? It can reload the playlist file automatically? It can read somewhere else, like an external script or URL?

- where can I find the documentation to directly control MPD? It's everything on TCP port 6600, right? I can write a script to keep connected on it and communicate with my automation system.

Thanks a lot,
Arvy

max
Forum team
Posts: 729
Joined: January 15th, 2013, 3:43 pm

Re: MPD to automate a webradio

Post by max » July 6th, 2018, 3:47 pm

Crossfading is either based on a fixed number of seconds (set by the client) or by MixRamp metadata (if your song files have this metadata).

Next song is never "requested" in the way you probably mean it; it's the other way round. The client needs to take care that there's always already a "next song" in the queue by adding new songs before the last song ends. MPD doesn't care when the client does that, or how many songs the client queues. So as soon as you know what shall be played next, add it to the queue.

This is the protocol documentation (a copy of the DocBook file which comes with every MPD source download): https://www.musicpd.org/doc/protocol/ and there are libraries for all relevant programming languages.

Arvy
Posts: 4
Joined: July 5th, 2018, 8:13 pm

Re: MPD to automate a webradio

Post by Arvy » July 6th, 2018, 4:56 pm

Hello Max,

perfect, thanks, I'm doing the initial tests today. Working fine.

I'll create my script considering the audio duration, in seconds, then queue a new audio about 10-15 seconds before the end of actual one. :idea:

Another question: MPD cannot stream to Icecast in AAC+ (HE v2) format, right? I'm looking for a way, maybe via pipe, but I don't know what's the best option for now. Any tip is very welcome. I need AAC+ to reduce bandwidth, specially on 3G/4G listeners.

Arvy

max
Forum team
Posts: 729
Joined: January 15th, 2013, 3:43 pm

Re: MPD to automate a webradio

Post by max » July 6th, 2018, 5:37 pm

AAC encoding is patent encumbered, and thus there is no free codec.
But there are free codecs which are just as good, or better; try Vorbis or Opus.

Arvy
Posts: 4
Joined: July 5th, 2018, 8:13 pm

Re: MPD to automate a webradio

Post by Arvy » July 6th, 2018, 8:06 pm

Great, thanks for all your help and info!

Arvy

Post Reply