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.