justinwood
Posts: 1
Joined: Tue Jul 31, 2012 6:01 pm

sox default device

Wed Aug 01, 2012 1:10 am

Anyone else having issues with "sox"?

I installed it and I get the following errors when running "play test.wav":

play WARN alsa: can't encode 0-bit Unknown or not applicable
play FAIL sox: Sorry, there is no default audio device configured

I did some reading and I should be able to pass sox a default device parameter, however I am not sure where to get that info. None of the options in alsa make sense, I did try passing --default alsa and didnt get anywhere.

Can someone point me at some documentation or give me a hand?

thanks!

Rob Sykes
Posts: 1
Joined: Sun Aug 05, 2012 1:45 pm

Re: sox default device

Sun Aug 05, 2012 1:47 pm

Try
AUDIODEV=hw:0 play test.wav

ericvrp
Posts: 3
Joined: Sat Mar 23, 2013 5:01 pm

Re: sox default device

Tue Apr 16, 2013 2:04 pm

Hi,

I've tried recording with rec/sox and can't find the correct AUDIODEV for my microphone. I think the one I am using now as actually my audio output device. Could anyone help me out finding the right setting for 'rec' on a Raspberry Pi?
rec samples/temp.flac
rec WARN alsa: can't encode 0-bit Unknown or not applicable
rec FAIL formats: can't open input `default': snd_pcm_open error: No such file or directory
AUDIODEV=hw:1 rec samples/temp.flac
rec FAIL sox: Sorry, there is no default audio device configured
AUDIODEV=hw:0 rec -r 16000 samples/temp.flac silence 1 0.2 2% 1 0:00:2 2%
rec WARN alsa: can't encode 0-bit Unknown or not applicable
rec FAIL formats: can't open input `hw:0': snd_pcm_open error: No such file or directory
The following command works however:
arecord -D "plughw:1,0" -q -f cd -t wav -d 5

drgeoff
Posts: 13729
Joined: Wed Jan 25, 2012 6:39 pm

Re: sox default device

Tue Apr 16, 2013 6:27 pm

ericvrp wrote:I've tried recording with rec/sox and can't find the correct AUDIODEV for my microphone. I think the one I am using now as actually my audio output device. Could anyone help me out finding the right setting for 'rec' on a Raspberry Pi?
What USB microphone or USB interface are you using? What responses do you get to the 'lsusb' and 'lsmod' commands?
Quis custodiet ipsos custodes?

kupad
Posts: 1
Joined: Fri May 03, 2013 4:23 pm

Re: sox default device

Fri May 03, 2013 4:33 pm

I had the same problem, and solved it like so:

In addition to setting the audio device with the environment variable AUDIODEV with:
> export AUDIODEV=hw:1,0

(hw:1,0 being a typical value for a USB microphone on raspi)

I also had to set the AUDIODRIVER environment variable:
> export AUDIODRIVER=alsa

Then I was able to use rec. I wanted it, over arecord, since it can start recording when it detects sound, and can stop recording when it detects silence.

--kupad

vonzepp
Posts: 14
Joined: Fri Mar 08, 2013 5:39 pm

Re: sox default device

Mon Jul 08, 2013 8:03 pm

Hi

I have also this problem. I tried the listed solution however it doesn't solve my problem. Leaving an error of .

rec FAIL formats: can't open input `hw:1,0': snd_pcm_open error: No such file or directory
.

Those anyone have ideas about this?

Edit: I managed to fix this. First you need to to arecord -l

Then export AUDIODEV=hw:[insert card number],[insert device number]

ThisNameNotUsed
Posts: 4
Joined: Tue Feb 02, 2016 8:36 pm

Re: sox default device

Thu Apr 21, 2016 7:55 pm

I did all this and went through all the same errors and corrections but I am still left with this error:

Code: Select all

export AUDIODEV=hw:1,0
rec rectest.wav
rec FAIL formats: can't open output file `rectest.wav': Permission denied

sudo rec rectest.wav
rec FAIL formats: can't open input  `default': snd_pcm_open error: No such file or directory

I don't know because I am new to Linux but this might explain something: I had to follow these directions to install a hifi berry amp that I am using: https://www.hifiberry.com/guides/config ... ux-3-18-x/

nixoid
Posts: 1
Joined: Fri Jan 19, 2018 10:43 am

Re: sox default device

Mon Jan 22, 2018 8:07 pm

Try create file .asoundrc in your home dir with content:

Code: Select all

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

SyncMaster
Posts: 1
Joined: Tue Jun 26, 2018 12:41 pm

Re: sox default device

Tue Jun 26, 2018 12:52 pm

possibly it is a authorisation problem. The user needs to be in group audio.
Check with
arecord -l
correct output is
# arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: r4 [UltraMic 200K 16 bit r4], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

Type: groups
to see if you belong to audio, otherwise add the user to the group audio:
sudo usermod -a -G audio myuser

Return to “Troubleshooting”