Friedrich Fischer
Friedrich Fischer

Reputation: 41

Raspberry Python wit.ai use

I have installed the wip on my raspberry, but when I want to use it I get this error

[wit] initialized sox: 14.4.0    
[wit] init state machine
[wit] initialized with device: default    
[wit] ready. state=idle    
formats: can't open input  `default': snd_pcm_open error: No such file or directory
[wit] couldn't open input device using alsa. Trying with coreaudio...
formats: no handler for given file type `coreaudio'    
[wit] Failed to open input device    
task '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value',
/home/martin/rust/src/libcore/option.rs:357

Upvotes: 3

Views: 1488

Answers (2)

Joshua Montgomery
Joshua Montgomery

Reputation: 11

Correction to the above. Need to edit ~/.asoundrc

Note the "a" in the file name.

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

Upvotes: 1

Richard
Richard

Reputation: 639

Edit ~/.asoundrc and add the following:

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

This little ALSA configuration setting uses the default soundcard as playback device (hw:0,0) and sets hw:1,0 (that suppose to be your USB-mic) to become the default capture device.

(Taken from http://wiki.audacityteam.org/wiki/USB_mic_on_Linux under "Setting default recording device".)

To determine what should be written after slave.pcm, run the following commands:

aplay -l
arecord -l

The result will indicate what should go under playback.pcm and capture.pcm, respectively.

For example, arecord -l results in the the following output on my machine:

**** List of CAPTURE Hardware Devices ****
card 1: USBSA [Andrea PureAudio USB-SA], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

The text beside slave.cpm should read "hw:X,Y", where X and Y are taken from the second line in the output above:

card X: ..., device Y: ...

Upvotes: 3

Related Questions