zetoune
Posts: 7
Joined: Sun May 27, 2018 9:50 pm

Make USB microphone default recording device with RPi 3

Fri Jun 15, 2018 2:34 am

Hi there,

This subject has been discussed several times but all the solutions I found don't work for me.
Most of them are for Wheezy or Jessie. I'm using latest Raspbian version Stretch and I think ALSA is not exactly the same.

I'm using this speaker and this microphone.
I can record using this command

Code: Select all

arecord -D hw:1,0 --format S16_LE --rate 44100 -c1 default.wav -vv

but I want to use the command without specifying the device (and use the default one).

Code: Select all

arecord --format S16_LE --rate 44100 -c1 default.wav -vv

I don't have an error when executing this command, but it gives me an empty file.

I don't need to specify the device when using aplay. It plays directly on the speaker.

The speaker needs a specific /etc/asound.conf configuration.

Code: Select all

pcm.!default {
        type plug
        slave.pcm "softvol_and_pivumeter"
}

ctl.!default {
        type hw
        card 0
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter
I've tried many different configurations (even adding the config in ~/.asoundrc, no lucks).
Latest version /etc/asound.conf looks like this:

Code: Select all

pcm.usb {
        type hw
        card 1
}

pcm.!default {
        type asym
        playback.pcm {
                type plug
                slave.pcm "softvol_and_pivumeter"
        }
        capture.pcm {
                type plug
                slave.pcm  "usb"
        }
}

ctl.!default {
        type hw
        card 0
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter

**boot/config.txt**

Code: Select all

...
# Enable audio (loads snd_bcm2835)
#dtparam=audio=on # disable Build-in audio
start_x=1
gpu_mem=256
dtoverlay=i2s-mmap  # for Speaker pHat
dtoverlay=hifiberry-dac # for Speaker pHat
Other informations

Code: Select all

[email protected]:~ $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
usb
default
    Playback/recording through the PulseAudio sound server
pivumeter
softvol_and_pivumeter
sysdefault:CARD=Device
    USB PnP Sound Device, USB Audio
    Default Audio Device
front:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Front speakers
surround21:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct sample mixing device
dsnoop:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct sample snooping device
hw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Hardware device with all software conversions

Code: Select all

[email protected]:~ $ cat /proc/asound/modules
 0 snd_soc_hifiberry_dac
 1 snd_usb_audio
Any help will be very appreciated.

Return to “Advanced users”

Who is online

Users browsing this forum: hirpi and 12 guests