element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Raspberry Pi + Wolfson Audio Streaming Live Audio solution looking good
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 3 replies
  • Subscribers 675 subscribers
  • Views 528 views
  • Users 0 members are here
  • raspberry_pi
  • raspeberry_pi_accessories
Related

Raspberry Pi + Wolfson Audio Streaming Live Audio solution looking good

spoonsphere
spoonsphere over 11 years ago

Hello!

 

We have a project that requires reliable broadcast of live event audio to multiple locations that are some distance from the event location, but still on the same physical campus. It isn't practical to run audio cables to the remote locations, but there are fiber cable runs in place that can be leveraged. Latency isn't a concern. However, the reliability and fidelity of the audio feed is a grave concern.

 

We have set up two Raspberry Pi with Wolfson audio cards.

 

Both have the Wolfson image installed. We did an apt-get update to enable us to install other packages. However, we haven't done an upgrade (and thus haven't had to recompile the kernel with the Wolfson audio drivers).

 

The Broadcast Station (BS) takes audio from Line In via arecord, and pipes it to avconv and broadcasts RTP to a multicast IP.

 

The Player uses ffplay to read that RTP stream and sends it out Line out.

 

We should be able to introduce additional Players onto the network.

 

The BS and Player processes start via a shell script that will restart them if they crash. Player will keep trying to find a stream if BS isn't streaming or if BS stream goes away.

 

These Raspberry Pi aren't going to do anything else - their only objective is to provide an audio feed. In fact, they are going to reside on an isolated network.

 

We have just started testing. But so far, we are able to take away and reintroduce the audio source, BS and Player, and everything hums along.

 

In intent is to not have a component failure require us to touch any other component in order to recover. We want redundancy at each function - more on that below.

 

To do:

* Mount all but a filesystem that will be used for logs read only.

* Write init script so that BS and Player start at boot.

* Add monitoring and alerts. Need a way to validate that audio is actually streaming - a physical Red / Yellow / Green light to indicate health.

* Identify an enclosure for the Raspberry Pi + Wolfson setup.

* Explore active/standby or active/active pair scenarios for BS and each Player location.

* Disable any unneeded services. I've already disabled X.

* Explore central logging server so that problems can be analyzed and correlated more easily after the fact.

* Disable any unneeded processes with the intended result that audio performance be maximized.

 

We would appreciate any feedback you have on this project. If you've used a similar or altogether different approach to solve this problem, we would love to hear that too!

 

Thanks!

  • Sign in to reply
  • Cancel
  • spoonsphere
    spoonsphere over 11 years ago

    For the benefit of anyone else who may want to do this, I will post the complete recipe as it comes together. For now, the BS and Player scripts, both written in bash.

     

    The BS script:


    /home/pi/Record_from_lineIn.sh

    BROADCAST_IP=224.0.0.115

    BROADCAST_PORT=1234

    BROADCAST_URL="rtp://${BROADCAST_IP}:${BROADCAST_PORT}"

     

    while true

    do

        echo ""

        echo "Starting Broadcast Server."

        echo ""

        arecord -D hw:0  -r 44100 -c 2 -f S16_LE | /usr/bin/avconv -i - -acodec mp2 -ab 128k -ac 1 -re -f rtp ${BROADCAST_URL}

        echo ""

        echo "Broadcast server process exited."

        echo ""

    done

     

     

    The Player script:


    /home/pi/Playback_to_Lineout.sh

    STREAMING_SERVER=192.168.10.10

    BROADCAST_IP=224.0.0.115

    BROADCAST_PORT=1234

    BROADCAST_URL="rtp://${BROADCAST_IP}:${BROADCAST_PORT}"

    PING_WAIT=1

    TRY_INTERVAL=5

    PLAYER=ffplay

     

    echo ""

    echo "STREAMING_SERVER is ${STREAMING_SERVER}"

    echo "BROADCAST_URL is ${BROADCAST_URL}"

    echo ""

     

    while true

    do

        ping -q -c 1 -W ${PING_WAIT} ${STREAMING_SERVER}

        PING_RESULT=$?

        if [ ${PING_RESULT} -eq 0 ]

        then

            echo ""

      echo "STREAMING_SERVER ${STREAMING_SERVER} is online."

            echo ""

            ${PLAYER} ${BROADCAST_URL}

     

            #ffplay  rtp://224.0.0.115:1234

     

            echo ""

            echo "Process ${PLAYER} exited."

            echo ""

        else

            echo ""

            echo "STREAMING_SERVER ${STREAMING_SERVER} is not online."

            echo "Sleeping for ${TRY_INTERVAL} seconds."

            echo ""

            sleep ${TRY_INTERVAL}

        fi

    done

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kjciszewski
    kjciszewski over 11 years ago in reply to spoonsphere

    Any further progress to report?  This sounds really interesting.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kjciszewski
    kjciszewski over 11 years ago in reply to spoonsphere

    I tried running the scripts, and realized I had to install avconv.  The problem is that when I went to do that, apt-get couldn't find avconv.  Do  you  know what is up with that?

     

    Also, the player script gave a "couldn't find ffplay" message.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube