This is how I configured my Raspberry Pi3 for USB Microphone input, and RPi3 3.5mm jack audio output (headphones/speakers)
=== My hardware:
Processor: Raspberry Pi3 (Thank you element14 Roadtest...)
Firmware: (uname -a) 4.1.19-v7+
OS: (cat /etc/os-release) Raspbian Jessie-lite
Audio out: speakers attached to RPi3 3.5mm jack (the built in RPi Broadcom device)
Audio in: using USB microphone (Kinobo Usb 2.0 Microphone - "Akiro" Mic )
(This is called a "split device" in ALSA because pcm audio comes in on one device and out on another. )
( alsa / ALSA stand for Advanced Linux Sound Architecture which is a feature of the Debian/Raspbian Linux OS )
=== first see if audio output works the way you want (auto) ===
Test audio out:
aplay /usr/share/sounds/alsa/Front_Center.wav
===== If no sound: Set output device for desired audio output device (0=auto, 1=analog, 2=HDMI):
amixer (to see current setting)
sudo amixer cset numid=3 1 (set to output sound to 3.5mm jack)
(up arrow till) aplay /usr/share/sounds/alsa/Front_Center.wav
========== If audio output is too soft =======
if soft: alsamixer
s (select card)
downarrow to “0 bcm2835 ALSA”
8 (4=default loudness, 8=100%, 9=125%)
Escape (press Esc)
then make setting default:
sudo alsactl store 0
==== List USB devices to be sure microphone is seen ====
lsusb to list all usb devices
Bus 001 Device 007: ID ... <-- my flash drive
Bus 001 Device 006: ID 062a:4104 Creative Labs <-- my wireless keyboard/mouse (no mouse)
Bus 001 Device 005: ID 045e:0773 Microsoft Corp. <-- my Microsoft mouse
Bus 001 Device 004: ID 0c76:160a JMTek, LLC. <-- my USB microphone ********* we're good
Bus 001 Device 003: ... SMSC9512/9514 Fast Ethernet Adapter (wired)
Bus 001 Device 002: ... 9514 USB Hub (root->four usb hub)
Bus 001 Device 001: ... root usb hub (processor interface)
Pi3 Port Physical Layout
Eth 004 007
003 005 006
So system knows about my microphone
==== try a recording (hold the mic close for this test!) ====
arecord -D plughw:1,0 -d 7 -c 1 test.wav
say "This is seven seconds of 8k 8bit unsigned mono audio"
and another:
arecord -D plughw:1,0 -d 7 -f S16_LE -r 48000 -c 1 test48.wav
say "This is seven seconds of signed 16 bit little endian 48k mono audio"
play it back:
aplay test.wav
( scratchy recording but it works )
aplay test48.wav
( slightly less scratchy with higher sample rate)
==== make USB mic the default input device ====
ls /etc/asound.conf
(there is probably no /etc/asound.conf file, this creates)
sudo nano /etc/asound.conf
enter:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
press ctnl-o "the letter O" to write a file
press Enter/return
press cntl-x to exit
==========resetting alsa after changes =======
sudo alsactl kill rescan
===== test with default devices =====
arecord -d 7 testdefault.wav
say "default 7 second recording unsigned 8 bit 8k mono audio"
aplay testdefault.wav
====== DONE for now ========