Skip to content
Steven Noreyko edited this page Dec 28, 2018 · 1 revision

Norns USB Audio Config

Boot up your pi and connect your USB Audio device. Get some info from dmesg to check the device

 dmesg | grep usb

look for something like usbcore: registered new interface driver snd-usb-audio to see if the device is loading.

useful commands

check your audio setup (these are all very handy to check things later)

aplay -l   (list all soundcards and digital audio devices)   
aplay -L   (list device names)  

amixer    (command-line mixer for ALSA soundcard driver)
amixer controls

alsamixer  (gui version of mixer controls)

install i2c, alsa stuff

sudo apt-get install -y i2c-tools   
sudo apt-get install libi2c-dev   
sudo apt-get install libasound-dev  
sudo apt-get install alsa-utils  

update boot config

sudo nano /boot/config.txt  
dtparam=audio=off   
dtparam=i2c_arm=on
dtparam=spi=on  
dtparam=i2s=on
dtoverlay=i2s-mmap  
dtoverlay=rpi-proto 

blacklist onboard audio

edit raspi-blacklist.conf

sudo nano /etc/modprobe.d/raspi-blacklist.conf  

add

blacklist snd_bcm2835

edit asound.conf

sudo nano /etc/asound.conf  

add

     pcm.!default  {  
       type hw card 0  
     }  

    ctl.!default {  
      type hw card 0  
    }  

(not sure this is needed with stretch)

Comment out options snd-usb-audio so usb can load first (or set it to zero)

sudo nano /lib/modprobe.d/aliases.conf  
# options snd-usb-audio index=-2

Remove unwanted devices from alsa.conf

sudo nano /usr/share/alsa/alsa.conf   

comment out

	#pcm.front cards.pcm.front
	#pcm.rear cards.pcm.rear
	#pcm.center_lfe cards.pcm.center_lfe
	#pcm.side cards.pcm.side
	#pcm.surround21 cards.pcm.surround21
	#pcm.surround40 cards.pcm.surround40
	#pcm.surround41 cards.pcm.surround41
	#pcm.surround50 cards.pcm.surround50
	#pcm.surround51 cards.pcm.surround51
	#pcm.surround71 cards.pcm.surround71
	#pcm.iec958 cards.pcm.iec958
	#pcm.hdmi cards.pcm.hdmi
	#pcm.modem cards.pcm.modem
	#pcm.phoneline cards.pcm.phoneline

restart alsa

sudo /etc/init.d/alsa-utils restart  

check your device name

aplay -l   

set mixer values (names may be different depending on soundcard)

amixer cset numid=13 on #Output Mixer HiFi  
amixer cset numid=4 on #line in  
sudo alsactl store  

amixer cset numid=3 0%  

Test audio

speaker-test -c2 (noise)
speaker-test -t sine -f 440 -c 2 -Dplug:sysdefault  (440hz sine wave)

Test if jackd is working

aplay -l

Look for CARD=(card name) and use that with hw:(card name) below (in the example, the card name is "PLAY")

export JACK_NO_AUDIO_RESERVATION=1  
jackd -R -P 95 -d alsa -d hw:PLAY -r 48000 -n 3 -p 128 -S -s  

settings note from shreeswifty:

you should have it @ 256 with 3 periods (-p flag) / try 2 periods if it makes noise

edit norns jack configs here (this may not be needed if you're using hw:0)

sudo nano ~/norns-image/config/jackdrc  
sudo nano ~/norns-image/config/norns-jack.service  

List active Jack ports, and optionally display extra information.

jack_lsp -help