Friday, February 25, 2011

RDS Sender update

The code for the PHP RDS Sending program is very nearly complete; it is currently in the testing stages to ensure everything it outputs is correct.  The final implementation will compare a date stored in shared memory to a date passed into the function, so that the RDS Sender doesn't send an old string.  The testing implementation of the RDS Sender doesn't check this date and doesn't send anything out of the serial port, it just prints all the output to a text file.  Once all the testing is done, these features will be enabled and the old RDS Sender program will be decommissioned.   All of this should be ready within the next week.

Remote Delay Panel

WSBF's delay unit is mounted in a very unfortunate place.  For years DJ's have bumped every button on the device, sometimes in seemingly impossible combinations.  Countless times the bypass has been enabled or the delay has been turned off or dump has been pressed by accident.  Earlier this week someone managed to first navigate to the menu screen, select the audio input option, change the audio input to analog (which would have taken us off the air), and then enable the bypass.  Because the bypass was on no one noticed the problem until another DJ managed to bump the bypass, turning it off.  Figuring out the problem took a few minutes and caused a little bit of commotion.
To keep something like this from happening again, I intend to build a remote panel to operate the delay and then hide the actual unit from the DJs.  Moving the unti to a new location could remedy the problem, but would still make the device susceptible to tinkering DJs.  The dump panel will only make available the buttons necessary to the DJ.  Symetrix sells a remote panel compatible with the delay we use, but charges $300 for functionality available in about $20 worth of parts.  I also feel that the functionality their device provides is not satisfactory, as the device does not display the amount of time left on the delay.  The user guide for a similar unit (available here) show how easy it can be to build such a remote panel.  Serial communication with the device is also detailed pretty thoroughly and with a little more hardware and a microcontroller, adding the ability to see the time remaining in the delay should be fairly easy to implement.  I've begun research into the parts needed for the remote delay panel and will move forward in implementing a solution to this problem in the coming weeks.

Thursday, February 3, 2011

RDS Progress

The code for the Windows RDS Sender program has been posted in the Solutions section of this website.  Progress has been made on the new Linux friendly version of the program.  I originally started writing the program in the language I had been most formally taught, C.  After looking into controlling the serial port with C, I decided it would be difficult but not impossible to do, so I began coding.  I got as far as retrieving the artist and song names from a text file when the drawbacks of C began to occur to me.  I started re-learning the uses of malloc and calloc, but before I continued work on the C version of the program I spoke with my friend Yates Monteith, a doctoral student in computer science here at Clemson University.  He suggested that I write the program as a Bash script.  Further research into his suggestion revealed that this would be a great solution for what I intended the program to do.  I began work on the bash script and made a good bit of progress despite the learning curve.  Before completing the script I had an epiphany which revealed that I may be going about the process in completely the wrong manner.  The way the current system works is this: Zach Musgrave's logbook software (written in PHP) writes the name of the artist and the name of the song to text files every time the DJ updates the currently playing song..  My RDS Sending program checks those text files every 1.5 seconds to see if they've been modified and if they have it reads them, formats the output for the RDS encoder, sends them out, and then goes back to checking if the files have been modified.  While this method isn't particularly processor intensive, it occurred to me that this wasn't the best solution to the problem.  Rather than checking to see if the file has been modified over and over, a better solution would be, in simpler terms, to have the logbook software output the artist and song name data to the serial port every time the DJ updates now playing.  While I could have finished the program in bash and just had the PHP script call it and pass the artist and song names into it, I decided to take advantage of some of the niceties of PHP and start writing again from scratch in PHP.  (My only previous experience with PHP was rewriting WSBF's former Computer Engineer, Ross Squire's label maker.  The label maker would make a PDF with information and reviews of CDs that we could print onto stickers and put on the front of CDs, however they stopped making the stickers we used for these labels, and the labels didn't fit properly on the new type of stickers we purchased.  I rewrote the PDF generating part of the label maker almost completely with a new, more robust solution, just in case we ever have to buy different sized stickers for labels again.)  Before starting the program in PHP, I checked to see if there was a way to control the serial port with PHP and I found exactly what I was looking for at http://code.google.com/p/php-serial/.  With what could have been one of the most difficult parts of the bash version wrapped up in an easy to use package I began work on the PHP version of the RDS sender.  After a good bit of progress, I realized that I wasn't sure how I would get the PHP script out of the while loops that I used for resending certain things over and over (to keep the RDS encoder from timing out to the default text after five minutes, say during a Live Session).  Ordinarily it would just stop the while loop once the text file had been modified again, but now there was no text file to modify.  Zach Musgrave and David Bowman both suggested the use of a semaphore, and researching this in PHP is where my most recent work on the program has ended.  Next week I'll continue with my progress and hopefully the PHP version of the RDS Sender will be very close to completion.

Friday, January 28, 2011

RDS Sender

The first project I'll be working on this semester is rewriting a program I've been calling the RDS Sender.  Last semester we installed an RDS encoder so that people could see the name of the song and artist in their cars.  A future post will give a lot more information on that whole process and the problems encountered along the way.  Right now I'll explain more about the RDS Sender.  Over the summer, in anticipation of our RDS encoder, I started trying to figure out a good way to  to send the names of artists and songs out to our transmitter.  I realized that, without Internet at our transmitter site, the only way to do this was to use the serial data port on our studio-transmitter link.  Having never written a program that needed to use serial communication, I began looking for a tutorial on how to do this in a familiar programming language.  Zach Musgrave, General Manager, also wanted me to test the serial connection to ensure that it was reliable and fast enough to suit out needs.  My research brought me to a Visual Basic 6 program that was written in French.  Luckily for me I'd taken a VB6 class in the 9th grade and I had Google Translate at my disposal.  After some translation and some modification I learned the basics of serial communication in VB6 (which is pretty similar to that of VB .Net) and modified this program to send a series of strings (movie quotes so I would recognize if something went wrong) marked with timestamps out of the serial port.  I also modified the program to timestamp every string it received and log them in text files.  I tested the program with two computers at the station first to work out all the bugs before trying it all the way out at the transmitter.  Once everything worked the way I wanted it to, WSBF Computer Engineer, David Cohen and I hooked up a sending computer at the station and drove out to the transmitter to hook up the other.  We were very disappointed when it didn't work.  A re-read through of the STL manual revealed that we needed to activate the serial port.  We activated the port on the STL receiver at the transmitter and David Cohen drove back to the station to activate the port on the STL transmitter while I waited at the transmitter site to see if it worked.  Of course David Cohen didn't have a key to the engineering closet where the STL was housed, so he returned to the transmitter site and we tried it again.  Once we finally got the ports activated we were happy to find that the serial link worked, and after days of running not a single bad string had been logged. From there I moved on to the next step, making the RDS Sender.  There were several goals I outlined for this project.  I decided it would get the song and artist name from text files that the logbook program would keep up to date with the currently playing song.  I chose the Inovonics 730 to be the RDS encoder we would purchase, so I downloaded the manual from the Inovonics website and learned how I would need to format the output of my program.  Once the first version was done it could output the DPS and PS, and calculate the RT+ for a given artist and song name in the formats required by the 730.  Prof. David Bowman suggested that I make the program censor certain words.  Although the FCC doesn't regulate sideband use, I found this to be a good idea that was in line with WSBF's emphasis on the surrounding community.  I soon implemented this feature around the time we were ready to implement the RDS encoder and we were happy to find that the program worked as intended.  I later added the support for the ability to send strings that weren't songs and also improved the text  formatting for when we had live sessions.  I also made it so that the program would send the live session string repeatedly so that the RDS didn't time out to the default text during a long band.  After a few months of this functionality, David Cohen announced his desire to switch our web server over to Linux.  Since a VB application won't work in Linux I've been tasked with the problem of rewriting the RDS Sender, keeping all of the same functionality.  I'll be keeping track of my progress for this an other projects in this blog as the year goes on.  I'll also include the code for the original RDS Sender on my website soon, as well as code for other projects that I'll be talking about.