element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog BBB - Audio notes
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
BeagleBoard requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 28 May 2013 9:51 PM Date Created
  • Views 718 views
  • Likes 3 likes
  • Comments 17 comments
  • beaglebone_black
  • bb_black
  • beagle_bone_black
Related
Recommended

BBB - Audio notes

shabaz
shabaz
28 May 2013

EDIT: See here for details on how to build a DAC:  BBB - Building a DAC

 

The BBB, unlike the RPi, does not have an in-built analog audio output*. However, there is a USB port for a soundcard, and a HDMI interface. The nice thing about the latter is what it derives the audio from; a hardware I2S interface inside the AM3359, which sends data out to an NXP TDA19988 for conversion to HDMI. So, the possibility exists to obtain I2S directly, theoretically at up to 24bit/192kHz (128fs clock).

 

Just to confirm audio worked, I tried USB audio first quickly. Plugging in the nearest USB audio sound card works with the Beaglebone Black - I tried an old Creative SB1100. The whole thing was powered just from the USB connector on a laptop for this, and it worked, but probably an external power supply should be used.

 

There are some software bugs however, because the sound was lower volume in one ear, like a software mixer issue. Hopefully that will be ironed out in a release sometime (the BBB is only a few weeks old currently). Apart from the lower volume issue, the audio quality was extremely good.

 

This is the procedure to get audio  playing:

 

ls -ald /dev/dsp* (you will see /dev/dsp listed)

Plug in the sound card and repeat. Now you will see /dev/dsp1 also listed.

 

Get the sound card name:

 

aplay -L

 

in my case, I saw:

 

default:CARD=GO

 

 

Play an MP3 file:

ffmpeg -i test.mp3  -f alsa "default:CARD=Go" -re -vol 20 (where vol is 0-256; 0=silent)

 

top revealed about 14% CPU consumption on the particular MP3 file that was being played.

 

I tried to play the same audio file but directing to HDMI:

ffmpeg -i test2.mp3  -f alsa "default:CARD=Black" -re -vol 20

 

It did work, but the current software build has known HDMI audio issues and it was noticeable - it didn't sound great always. Not noise, but some other digital effect.

 

There is not much information on NXP's site for the IC that provides the HDMI interface (TDA19988), however the BBB reference manual (SRM) specifies that  I2S is used to it, clocked at 24.576MHz. I don't have an external DAC, but I was curious if it was truly I2S format as currently configured for the TDA19988. The I2S interface comes out to header P9:

 

BBB Description    Header pin          Description

SPI1_CS0            P9_28               Bitstream

SPI1_D0             P9_29               Left/Right clock

SPI1_SCLK           P9_31               Bit clock


 

The actual data is on the pin CS0, not D0.

 

Looking on a scope, it is clear that the 24.576MHz clock runs always, and the other two pins are low. When there is sound to play, the Left/Right clock begins to toggle (at 32 bits) and then after a short while the bitstream occurs. I couldn't determine which side the padding was for 16/24 bit audio, but these things are configurable on DACs anyway. I noticed the bit change occurs on rising edges of the bitclock, so they are read in on the falling edge of the bitclock.

So, in summary, it is configured as an I2S interface, and it would be rather easy to connect up a decent external DAC if desired (e.g. car audio applications).

I don't know enough about Linux audio, but it would be nice to even send high quality FLAC file content (e.g. from attached storage) after non-lossy conversion into an audio stream directly through the I2S interface.

 

* Although there is no analog output, there is the possibility to toggle pins (at up to 200MHz) for cheap audio, either as PWM, or with multiple pins and summing. It's very cheap just to use I2S  however, since some DAC ICs cost less than $1.

Anonymous
  • morgaine
    morgaine over 8 years ago

    shabaz wrote:

     

    I tried to play the same audio file but directing to HDMI:

             ffmpeg -i test2.mp3  -f alsa "default:CARD=Black" -re -vol 20

    It did work, but the current software build has known HDMI audio issues and it was noticeable - it didn't sound great always. Not noise, but some other digital effect.

     

    I've just tried this with BBB running Debian on the 3.8.13-bone30 kernel, with the same bad result as yourself --- there's a pretty nasty distortion effect of some kind received on HDMI audio.   It's not overload clipping, as the output level is fairly low at all -vol settings.  (In case it may be relevant, there was only a VT console displaying on HDMI, no X11.)  Although the audio is still identifiable as music, the quality is not usable in this state.

     

    I haven't yet eliminated the possibility of ground continuity problems between BBB and the HDMI receiver, which I have seen mentioned as a cause of audio problems for BBB.

     

    In contrast, USB audio works perfectly for me on the BBB into one of these cheap unbranded USB Sound Boxes, which identifies as "Microdia A56AK".  My magic incantation for ffmpeg into this device is:

     

    ffmpeg  -i INPUTFILE.mp3 -f alsa "default:CARD=U0xc450x1158"  -re -vol 128

     

    I'd be interested to hear if anyone manages to get undistorted audio from BBB over HDMI.

     

    Morgaine.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • shabaz
    shabaz over 8 years ago in reply to Former Member

    I just noticed, it currently seems to be browser-dependant. On Firefox, I'm seeing a blank page too. With IE, it works fairly often but not always. With Chrome, it seems to always work.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • shabaz
    shabaz over 8 years ago in reply to Former Member

    Hi fecske,

     

    You're right, I'm seeing a blank page now too, also on some other posts. I think it is related to the site upgrade (this link was working yesterday) so I'll raise it on the Feedback&Support area.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Former Member
    Former Member over 8 years ago in reply to shabaz

    Thank you for your time, but it only opens up a blank page for me.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • shabaz
    shabaz over 8 years ago in reply to Former Member

    Hi fecske,

     

    Looks like the link above is broken, I'll update it. This is the link:

    BBB - Building a DAC

    Good luck with your project!

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
>
Element14

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 © 2022 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube