Raspberry Pi Audio with AudioQuest DragonFly

 

AudioQuest Dragonfly Red

After booting Raspbian for the first time on my latest Raspberry Pi 3 (Jessie) I started to play with audio.

I have an Audioquest Dragonfly Red connected to one of the USB ports.

 

 

pi+dragonfly-red

First list the available device names using aplay -L

pi@raspberrypi:~ $ aplay -L
null
 Discard all samples (playback) or generate zero samples (capture)
pulse
 PulseAudio Sound Server
sysdefault:CARD=ALSA
 bcm2835 ALSA, bcm2835 ALSA
 Default Audio Device
dmix:CARD=ALSA,DEV=0
 bcm2835 ALSA, bcm2835 ALSA
 Direct sample mixing device
dmix:CARD=ALSA,DEV=1
 bcm2835 ALSA, bcm2835 IEC958/HDMI
 Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
 bcm2835 ALSA, bcm2835 ALSA
 Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
 bcm2835 ALSA, bcm2835 IEC958/HDMI
 Direct sample snooping device
hw:CARD=ALSA,DEV=0
 bcm2835 ALSA, bcm2835 ALSA
 Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
 bcm2835 ALSA, bcm2835 IEC958/HDMI
 Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
 bcm2835 ALSA, bcm2835 ALSA
 Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
 bcm2835 ALSA, bcm2835 IEC958/HDMI
 Hardware device with all software conversions
sysdefault:CARD=v10
 AudioQuest DragonFly Red v1.0, USB Audio
 Default Audio Device
front:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 Front speakers
surround21:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 4.0 Surround output to Front and Rear speakers
surround41:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 Direct sample mixing device
dsnoop:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 Direct sample snooping device
hw:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 Direct hardware device without any conversions
plughw:CARD=v10,DEV=0
 AudioQuest DragonFly Red v1.0, USB Audio
 Hardware device with all software conversions

As you can see the Raspberry Pi has the inbuilt sound chip (bcm2835) capable of audio output on the HDMI and the 3.5mm jack. I also have an AudioQuest Dragonfly Red attached to the USB port.

The list of devices is shown using the command aplay -l

pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
 Subdevices: 8/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: v10 [AudioQuest DragonFly Red v1.0], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

Initially I was getting no audio out of the Dragonfly.

I tried using alsamixer command. The device shows up, the volume control works. But no audio played.

Back to the command line using aplay

I copied a sample wav file (44.1kHz 16bit)

aplay ~/sample.wav

resulted in an error:

aplay sample.wav
Playing WAVE 'sample.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:1233: Sample format non available
Available formats:
- S24_3LE

The Device needs to be specified (plughw:CARD:v10) as follows:

pi@raspberrypi:~/Music $ aplay sample.wav -v -Dplughw:CARD=v10
Playing WAVE 'sample.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Linear conversion PCM (S24_3LE)
Its setup is:
 stream : PLAYBACK
 access : RW_INTERLEAVED
 format : S16_LE
 subformat : STD
 channels : 2
 rate : 44100
 exact rate : 44100 (44100/1)
 msbits : 16
 buffer_size : 22050
 period_size : 5513
 period_time : 125011
 tstamp_mode : NONE
 period_step : 1
 avail_min : 5513
 period_event : 0
 start_threshold : 22050
 stop_threshold : 22050
 silence_threshold: 0
 silence_size : 0
 boundary : 1445068800
Slave: Hardware PCM card 1 'AudioQuest DragonFly Red v1.0' device 0 subdevice 0
Its setup is:
 stream : PLAYBACK
 access : MMAP_INTERLEAVED
 format : S24_3LE
 subformat : STD
 channels : 2
 rate : 44100
 exact rate : 44100 (44100/1)
 msbits : 24
 buffer_size : 22050
 period_size : 5513
 period_time : 125011
 tstamp_mode : NONE
 period_step : 1
 avail_min : 5513
 period_event : 0
 start_threshold : 22050
 stop_threshold : 22050
 silence_threshold: 0
 silence_size : 0
 boundary : 1445068800
 appl_ptr : 0
 hw_ptr : 0

Sweet Music from my AudioQuest Dragonfly Red!

To make the AudioQuest Dragonfly USB the default sound device can be achieved by disabling the on board sound (snd_bcm2835):

$ sudo nano /boot/config.txt

Comment out the section that loads the snd_bcm2835 by adding the # symbol as shown – then reboot for the changes to take effect:

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on

Next set the required device to use for the audio by editing ~/.asoundrc

nano ~/.asoundrc

This should be as follows:

pcm.!default {

type plug

slave {

pcm "hw:0,0"

}

}

ctl.!default {

type hw

card 0

}

 

Remote Desktop Connection for Raspberry Pi

For remote GUI access to the Raspberry PI we need RDP.

Start by connecting via SSH (ssh -l pi raspberrypi) or directly in a Terminal window and install as follows:

sudo apt-get install xrdp

Start the service

sudo service xrdp start

You may now easily access the Raspberry Pi from a Windows PC using “Remote Desktop Connection” (mstsc.exe). You may use the hostname (raspberrypi by default) or the IP address (found using ifconfig)

 

mstc2
remote Desktop Connection to Raspberry Pi

 

mstsc3
Initial RDP Login to the Raspberry Pi. Username pi, password raspberry
mstsc4
Established Remote Desktop session to Raspberry Pi from Windows 10

 

This works on Raspbian (July 2016):

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.4.13-v7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux

pi@raspberrypi:~ $ cat /proc/version
Linux version 4.4.13-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #894 SMP Mon Jun 13 13:13:27 BST 2016