audio_capture with pcm device

asked 2017-11-30 05:58:32 -0500

kevinjust gravatar image

I do have a Matrix Creator on a Raspberry pi where the /etc/asound.conf looks like:

pcm.!default {
    type hw
    card 0

ctl.!default {
        type hw
        card 0
} {
    type hw
    card 1
    format S16_LE
    channels 1
    rate 16000

pcm.mic_channel0 {
  type file
  file "/tmp/matrix_micarray_channel_0"
  infile "/tmp/matrix_micarray_channel_0"
  format "raw"
  slave {
    pcm sc

I can record and play sound through these commands:

arecord -f S16_LE -r 16000 -d 10 -D plug:mic_channel0 test.wav
aplay test.wav

but this command from the Streaming audio Tutorial

gst-launch-0.10 alsasrc device=plug:mic_channel0 ! audioconvert ! audioresample ! alsasink

unfortunatly doesn't work. It gives me this output:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock
gst-launch-0.10: pcm_file.c:397: snd_pcm_file_add_frames: Assertion `file->wbuf_used_bytes < file->wbuf_size_bytes' 

also a audio_capture roslaunch like:

roslaunch audio_capture capture_wave.launch device:="plug:mic_channel0"

ends with this error message:

process[audio_capture-2]: started with pid [4427]
[ERROR] [1512041350.206905657]: gstreamer: Could not open audio device for recording.
terminate called after throwing an instance of 
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
  what():  boost: mutex lock failed in pthread_mutex_lock: Invalid argument
[audio_capture-2] process has died [pid 4427, exit code -6, cmd 
/home/roboy/workspace/devel/lib/audio_capture/audio_capture __name:=audio_capture 
log file: /root/.ros/log/ae316724-d5c1-11e7-b8ef-b827eb26edd2/audio_capture-2*.log

Since I'm in the end able to record sound from the microphones, it should also be possible to tell the gstreamer to access the mic data. But since now I don't know how, and the big master Google couldn't help me either. Does anyone know how to solve this problem? Or at least has better google skills?

edit retag flag offensive close merge delete