Article Image
News Link • Media: Radio

UPDATED: Create Your Own Radio Station myDIYfm

• Steemit - Pirate Parties

UPDATED: Create Your Own Radio Station myDIYfm PDF

Radio TowerIn this article I will describe a powerful new feature and updates to the myDIYfm radio station built using a Raspberry Pi 3 micro computer. If you missed the original article you can find it here. Please note the same disclaimer used in that original article applies to this one as well, and is incorporated by reference. Also note the original article is still 100% valid and usable.

So What is This New Feature?

I have added the ability to add audio content from Youtube videos using the youtube-dl python library. I have automated this to a significant degree while giving you full control over the content. However, doing this on the Raspberry Pi 3 is not a fast process. The majority of the time it takes to work this magic is not spent in the video downloads, but rather in the extraction of the audio into an MP3 file.

Another aspect affecting performance is that the titles of the downloaded videos are also converted to .wav audio using festival's text2wave program. These "title .wavs" are queued just ahead of the video's audio track, to announce each item.

To facilitate programming these videos into the broadcast schedule, changes were required to the schedule file format. I have added 2 new network op codes (RNDM and FLDR) to schedule playback of this new content. Placing RNDM in the NETWORK field will announce and play the content in a random order, and the FLDR op code will play them in order based on alphabetic sorting of the title. The actual content is located in the folder indicated by the FILE / URL field of the schedule item.

How Does the Downloading Work?

A new python program,, was created to manage all aspects of downloading, including video selection criteria, conversion to MP3 audio and title announcement generation. The Youtube video URLs may include individual videos, entire playlists or a mixture of both. It also uses qualifiers to select the videos based on various criteria, among them are:

-upload author

-playback time

-keywords in the title

-size of the destination folder

-maximum number of videos to save

The program requires ffmpeg and other software which must be compiled from source code to produce an executable program that runs on the Raspberry Pi. New installers (setup2.bash and setup4Youtube bash shell scripts) are provided to get up and running starting with a base level, freshly installed Raspberry Pi. Refer to the previous article on how to install the Raspbian OS with NOOBs.

Once the base operating system is installed you will use the following commands to download and run the setup2.bash script which will take care of the rest of the installation:

curl -s | tr -d 'r' > setup2.bash chmod 755 setup2.bash ./setup2.bash

The installation process will take some time to complete, much longer if you choose to include the required support for Youtube downloads. You will be asked if you want to do that near the end of the main installation. If you answer "n" the installation will conclude asking you to enter a password for the mydiyfm account and present you with the README2.txt.

If you decide later to add support for Youtube, you may do so by running these commands in the mydiyfm folder (as root):

curl -s | tr -d 'r' > setup4Youtube chmod 755 setup4Youtube ./setup4Youtube

Be aware it will take several hours to run the setup4Youtube script, which includes downloading and compiling code, downloading and processing approximately 50 Youtube videos and a sample schedule that uses them. You can expect it to take 3 - 4 hours to complete, but no interaction is required, so you could start it and then go do other things.

I decided not to try to create an update process to the original mydiyfm but rather preserve it so as not to invalidate it. If you want to upgrade but preserve your schedule the main difference is removing the END TIME field, which is easily done with a text editor using a global find and replace, searching for " 0000 " and deleting every instance. You will also need to update the TTS op codes in the NETWORK field to FTS, as TTS is now used when the FILE / URL field contains the text to speak. FTS is "File" Text to Speech, whereas TTS is "Text" to speak. There are a few minor bugs in the original setup.bash installer (the mydiyfm account wasn't added to the audio group, and the info on adding tmux to the .profile required a change) that were corrected, and FPP Radio News source is no longer being updated, so you will have to replace those lines in your schedule as well.

I have also thought about how to provide a complete image of mydiyfm in the form of an archive (such as a zip or tar file) that could be applied to a base Raspbian OS created by NOOBs. After a full installation including the sample Youtube videos, the mydiyfm folder comes in at around 750MB.

Another option would be to create a complete SD-Card image that includes EVERYTHING. I have not found a good platform for either that allows a truly uncensorable, "pirate" experience to preserve the work. Perhaps an IPFS or blockchain solution will emerge. Stay alert and vigilant, as only time will tell. It may appear earlier than you think!

Join us on our Social Networks:


Share this page with your friends on your favorite social network: