Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

arecord: set_params:1233: Sample format non available Available formats: - S16_LE

I have a USB microphone and speaker adapter connected to a Raspberry Pi 3. I have set up everything on alsamixer. I have also set the pcm.!default sysdefault:0 in file .asoundrc in the home directory which sets the USB audio adapter as the default audio card.

I have run: aplay -l and the output is:

card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
 Subdevices: 7/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: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I then set the pcm.!default sysdefault:0 in file .asoundrc in the home directory.

When I run the command arecord -d 5 -r 48000 test.wav I receive this error:

arecord: set_params:1233: Sample format non available Available formats: - S16_LE

like image 588
Tonderai Ratisai Avatar asked Mar 24 '16 19:03

Tonderai Ratisai


2 Answers

The solution is to change .asoundrc to this:

pcm.!default {
  type plug
  slave {
    pcm "hw:1,0"
  }
}

ctl.!default {
    type hw
    card 1
}
like image 159
Tonderai Ratisai Avatar answered Sep 18 '22 04:09

Tonderai Ratisai


A generic configuration that works would be:

$ sudo nano ~/.asoundrc

pcm.!default {
    type asym
    playback.pcm {
    type plughw
    slave.pcm "output"
    }
    capture.pcm {
    type plughw
    slave.pcm "input"
    }
}

pcm.output{
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}
like image 41
Keiko Mori Avatar answered Sep 18 '22 04:09

Keiko Mori