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.