Raspberry Pi fmbroadcast karaoke System

Source: Internet
Author: User
ArticleDirectory
    • Introduction
Introduction

Some time ago, someone posted a Post saying that Raspberry Pi could send FM radio signals, so they all played around and found that the effect was good. So they wanted to expand their functions.

Fmemission functions implemented on the Internet have limitations:

    • Only files in WAV format can be played, and wav files must be16 bits 22.5 kHz monoFormat.
    • Only local audio files can be played, or-Read audio from a terminal

The functions I have imagined or implemented are as follows:

    • Support MP3 format
    • Supports streaming media or directly playing online music.
    • You can add music for easy management.
    • You can add songs in batches.
    • You can play music on a computer in a LAN.
    • Automatically searches for and plays songs online based on their names
    • There is a Web page that allows anyone to add their favorite songs
    • The web page displays the currently playing songs and the list of songs to be played.
    • When there are no songs in the playlist, a song is automatically played randomly to ensure continuous playback.
    • You can skip a Playing Song and play the next song.

After installing my system, you can use Raspberry Pi as a server, send broadcasts, play popular songs or listen in English (or something that is permitted by law), and tell friends and family a website, then they can play songs on it. Friends who haven't passed cet6 can add cet6 to simulate the real test environment. Or put it in the nursing home to play drama for the elderly. In addition, as longProgramRunning, you can hear music on the radio, and you don't have to go online to find a song every day. In this way, you can save a lot of space for storing songs on your mobile phone. With Raspberry Pi and my karaoke system, you can hear the songs you want on the radio on your mobile phone. My system will not add any garbage to Raspberry Pi, and all the online songs will not be cached, so you don't have to worry about filling up the memory card with too many songs.

Key Technologies and principles

Because Raspberry Pi only supports WAV format music, you need to convert MP3 format to WAV format.

However, the general software conversion efficiency is relatively low, Raspberry Pi CPU is relatively poor, the conversion time is longer.

Later, I found a better solution. I used the software mpg123 to decode it and output it to the terminal. Then, it was converted to WAV format. Then, the pifm program of Raspberry Pi is set to read the audio from the terminal, so that two programs can be connected through a single pipeline, and one side can be decoded and played

In addition, mpg123 has strong functions and supports direct playing of online music. That is to say, you only need to transmit a song URL to mpg123, and you can download and play it.

The above text is summarized with a command:

 
Mpg123-m-C-Q-S song address or URL | sudo pifm-frequency song sampling rate, for example, mpg123-m-C-Q-S/home/PI/aaa.mp3 | sudo pifm- 98.5 44100mpg123-m-C-Q-s http://abc.com/123.mp3 | sudo pifm-98.5 44100

The above command looks very simple. It took half a day to get it up. Because there are many command parameters, it is necessary to combine them to coordinate the work!

After solving this technical problem, the following task is simple. For pythoner, the things mentioned below are not called things!Pai_^

Below is a simple list:

    • A song is captured from sogou MP3. You only need to enter the name of the song and search automatically. Then, the URL of the song is returned.
    • The Web management interface is implemented using web. py to display the list of songs and songs being played in real time.
    • The database uses sqlite3 to save the song information entered by the user for later data analysis.
    • If the list is empty, select a random playback from the local playlist (text file ).
Installation and deployment methods

To simplify installation and deployment, I wrote an installation script, namely setup. Sh, which can be directly executed. (Note: Raspberry Pi is dedicated in this system. Please do not execute this script on your computer)

 
Wget https://github.com/ma6174/fmpi/archive/master.zipunzip master.zipCDFmpi-mastersudo bash setup. Sh

In this way, the dependent software is automatically installed.

Usage

You can directly executeStart. Sh:

 
Sudo bash start. Sh

Then insert a dual line on the gpio4 pin of Raspberry Pi as the antenna.

UseIfconfigCommand to view your IP address and open it in the browser:Http: // Raspberry Pi IP: 8000/You can view the songs being played, and then you can add the songs you want to listen.

Turn on the radio, adjustFM 1, 98.5Channel, you can hear the songs being played!

If you feel this song is not good, you can press the Raspberry Pi keyboard.QKey, automatically play the next song

To terminate the program, pressCTRL + c

You can modify config. py to modify the default playback frequency of 98.5.

Others

If you are interested in this system, go to GitHub to view the source code and expand the system functions:Https://github.com/ma6174/fmpi

You can leave a message or email to contact me for any questions or suggestions:Ma6174 # 163.com

Gtalk:Ma617495 # gmail.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.