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!
-
- Posts: 1
- Joined: Tue Jul 31, 2012 6:01 pm
Re: sox default device
Try
AUDIODEV=hw:0 play test.wav
AUDIODEV=hw:0 play test.wav
Re: sox default device
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?
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
The following command works however: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
arecord -D "plughw:1,0" -q -f cd -t wav -d 5
Re: sox default device
What USB microphone or USB interface are you using? What responses do you get to the 'lsusb' and 'lsmod' commands?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?
Quis custodiet ipsos custodes?
Re: sox default device
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
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
Re: sox default device
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]
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]
-
- Posts: 4
- Joined: Tue Feb 02, 2016 8:36 pm
Re: sox default device
I did all this and went through all the same errors and corrections but I am still left with this error:
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/
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/
Re: sox default device
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"
}
}
-
- Posts: 1
- Joined: Tue Jun 26, 2018 12:41 pm
Re: sox default device
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
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