Serial Ports and SAS

I’m just trying to figure out how I get mAirList to act upon serial port data, or send serial port data in its playlist. Are both of these things possible?

I can’t find much documentation on it unfortunately.

I had a look under the serial port section in the configuration, but it enables it and that’s it. I couldn’t find anywhere to specify commands etc… So I moved on to the SAS part where I could.

Is there anyway to actually send a serial string from the playlist?

I figure I can just simply enable SAS on the 2nd PC for receiving serial data and map it to a command easily enough, as long as I send S1-256 and R1-256 codes from the first PC, which I don’t know how to.

Thanks again,
Gavin.

Receiving data: Activate the serial interface in the config and send plain-text commands, delimited by CRs (ASCII #13).

Sending data: Can be done from a script like this.

begin ComPort(1).SetParameters(9600, 8, 'N', 1); ComPort(1).Open; ComPort(1).SendStr('Hello world!'); end.

See the section about the IComPort class in the help file for more information about the methods. You can also take a look at Michel’s SAS_PFLSwitch.mls notification script distributed with mAirList 2.1, to get an idea. It uses the same mechanisms, although it uses the pre-configured SAS serial port (“SASComPort”) instead of a specific one (e.g. “ComPort(1)” for COM1).

Torben

Am I able to run a script using a command in the playlist? Or do I have to use a scheduler to create this item?

Thanks,
Gavin.

Use a “Command” item, and enter the following in the command field:

RUNSCRIPT c:\folder\scriptname.mls

In an M3U playlist (or scheduler), the format would be:

#mAirList COMMAND RUNSCRIPT c:\folder\scriptname.mls

Ref: Wiki : Scripting

Quick note Torben, when making a RUNSCRIPT command in the playlist which I’ve just figured out how to do, I have to type the full path of the script. I have a default path set for runscript in the ini file of c:\program files\mairlist\scripts, but mAirList tries to run the script from c:\program files\mairlist instead. Either way, I have it working though.

I’ve just realised I can not send a serial string with the com port opened to receive. The script treats the com port as already in use, even though it’s mAirList that’s got it open.

I’ve had a look at the SAS PFL switch script however it’s over my head all the computer code stuff, I’m not giving up though, I’m trying to learn half of this scripting stuff. How do I get mAirList to respond to incoming serial data? Or is it just as easy to use SAS on the receiving PC and send SAS codes from the 1st PC?

Cheers,
Gavin.

Thanks for the tip Charlie :o)

You’re up late. Don’t normally get replies from you at lunchtime my time.

Gavin.

Bummer, I just noticed I can’t run commands in assist mode. So it would have to be in auto in order for a serial port string to be sent from the playlist in the right timed order.

Gavin.

Gavin: do you have to use a serial port specifically?

You haven’t at any point told us precisely what you’re trying to achieve, so there may well be a better, easier way to do whatever-that-is than using a serial cable!

BFN
CAD

Gavin, I agree with Cad that you should first tell us what exactly you are trying there :wink:

Incoming data is processed automatically when the serial remote interface is switched on in the config. Just send plain text commands (“PLAYER 1-1 START”) followed by a CR character.

It is correct that COMMAND items cannot be invoked in assist mode. But there are other ways to run a script, e.g. through the main menu, hotkeys etc. I could also add the option to specify a script for each item which will be run each time the item is started. How about that?

The issues with concurrent access of the COM port will be addressed in the near future.

Torben

Yes sorry guys, I should mention what I’m trying to experiment with and do.

I’m trying to come up with newer ways for LPFM (low power fm in New Zealand) to be able to share programming which a lot do currently free, no money attached using Internet streaming (We’re talking stations with a 2-3KM radius that don’t require a license). However, to be able to substitute programming with other information and ID’s more suited to the other stations picking up that stream.

I’d like to do this with serial port data. I’d send a string to an audio switcher first to stop the local lpfm programme’s audio from being received by a second mAirList machine. Then send another string to start the second mAirList machine to insert local information and station ID’s. Then the first mAirList machine would keep doing it’s own thing, then send one more string back to an audio switcher to feed audio back through the second mAirList machine.

By doing it this way rather than mute/unmute sound card channels I can avoid clicks and pops with timing issues and slightly segue the first with second mAirList machine.

Running multiple instances on the same PC of mAirList is out of the question, I use my home computers, both of which aren’t very grunty. One’s a 1.5GHz the other only an 850MHz.

I didn’t realise you just send plain text commands that equal the commands found under the hotkeys section. I wasn’t sure if I was able to map my own strings to commands etc… so I could keep the strings as short as possible for as less delay as possible. This gives me a good start at what to do.

Thanks,
Gavin.

Anyone else already experimented with the delay of sending serial data via a script vs when the next audio item starts? Sometimes the data appears (as I’m only testing with a simple rs232 device at present that has tx/rx lights on it) a little behind the next audio event when a script is fired from the playlist.

Okay I’m not so intelligent on this matter, what is the carriage return and line feed code to include in the string?

Thanks,
Gavin.

When a player is started, several things have to be done - the GUI must be updated, mAirList must write the log file etc. One of these tasks is calling the notification scripts. The delay you encounter is probably because the scripts get called at the end of the chain. I will see if I can make any optimizations.

By the way, are those computers connected through a network? Then you could also use the RPC interface and send the commands via TCP/IP.

Torben

Thanks for looking in to it Torben.

I’m kind of aiming to stay with serial rather than TCP/IP if possible even though it will be available, as then I can control external hardware for the audio muting/un-muting such as an audio router/switcher. Most of them have rs232 interfacing these days for that reason.

There’s a lot of rs232 control options around and in use these days. A lot of transmitters and audio processors can be daypart switched using rs232 (something I’ve never tried though). Satellite news feeds come with rs232 control strings (although mAirList would need to be able to be programmed to listen to user defined strings rather than fixed commands for this part to work). Some modern STL systems can transmit rs232 in sync with audio via wired circuits or over TCP/IP networks to other studios etc…

All I’d like to achieve is switching an audio switcher before it receives audio from the same automation system. I realise there’s other software solutions around, if I could afford to buy them to experiment I would :o) I just thought I’d mention the ideas I’m trying to achieve and see what you think whether it would benefit mAirLists feature set more or not to achieve those results.

Thanks again,
Gavin.

We’re looking at one of the Barix IP boxes for distribution - they have an RS232 port, but I’m not entirely sure if the RS232 will carry in-sync with the audio, the data is a bit vague.

Nice unit Charlie.

Thanks for pointing it out. I did a quick price search thinking it’ll be a thousand or so US dollars but didn’t realise it’s only $560AU (about $300US) or so per box. That’s extremely attractive for distributing LPFM audio and rs232 data between sites compared to building a PC for the job.

It would also mean it’s then up to another studio to insert their own material and watch for serial data. Although as you mention, not very clear on the sync’ing of the serial port though.

I’m off to download the manuals and see what sort of buffering they offer. As soon as my lightning fast 28.8K dialup modem downloads the info haha.

Gavin.

If I understand the data sheet correctly, this is nothing but a streaming source talking to a Shoutcast/Icecast server. Essentially same thing as found in software like Simplecast, the Shoutcast plugin etc. Can be nice if you don’t have a PC where the audio signal is generated. But if you just want to distribute mAirList’s signal anyway …

In particular, be aware that any Shoutcast-based streamng solution suffers from notable delays caused by buffering.

They can be used stand-alone, ie: point-to-point with one Barix at each end. I assume you can multicast to several receivers from one source, too.

We have managed (in the past) to use a SHOUTcast server and MP3 player to send audio and command data - but it’s not perfectly in-sync, usually a second or so out. I think BASS can do this kind of stuff “out the box”, I’ll have to dig deeper into the un4seen forum, fire-up VB and have a fiddle.

The only other hardware solution I know of is the new rack unit from AudioTX (Mo Dutta, of Radio2). That claims to offer perfect data-sync with audio…at a price ;(

How do you create the stream, and how do you insert the commands?

Try to embed the commands into the stream as ordinary meta data (lust like the stream title etc.). BASS provides you a callback function that is called whenever metadata is received.

Torben

Torben,
Yes, that’s exactly what we did - I made a simple VB app that altered the title of the “now playing” info to something that the remote-studio could respond to - Quite primitive, but it worked.

I’m still struggling to get a carriage return to come out the serial port. I found an example command in the wiki that had the letters at the end of it. So I tried entering in my string to send, but didn’t seem to make a difference.

Off topic, but does anyone have a simple example sound card mixer control script? I’ve read the script help file again and again, but I just don’t understand it. It gives examples of the codes and values, but not of how to construct them with all the other dashes and dots inbetween that makes sense to the computer rather than me :o)

I can understand putting in marco’s on other systems like MACRO FADE 1,0,120 which would fade mixer channel 1 to 0 volume over 120 seconds. Then I just point and click to assign those channels to the sound card device and outputs I want. But having to write code for it is a little outside of the average radio station staff, wouldn’t you say?

I think scripting is mAirList’s more powerful tool, but it also comes across as it’s weakest link unless you’re a computer programmer. It gets me very frustrated at times trying to figure the language out from someone with no programming history, only radio. I’m not giving up though! grrr.

Gavin.