[Solved] Microphone Issues

My Ultimate goal is to get Alexa working using this repo:
https://github.com/matrix-io/alexa-avs-sample-app

Have had zero luck. It always produces this error:

ERROR:An error happened in the mainLoop of SensoryWakeWord snsrRun(): task: Input channel audio-pcm: ALSA error: No such file or directory

So, I decided to go back to basics and try to get the Microphones working with ALSA, then work from there.

It should be noted that I have 2 Matrix Voices and 1 Matrix Creator, and this problem is occurring on all three. Running Raspbian Stretch. I have installed and re-installed, several times.

The HAL Demo, micarray_recorder works fine, as do all the other demos.

sudo dpkg --list | grep matrix
ii libmatrixio-creator-hal:armhf 0.3.0
ii libmatrixio-malos:armhf 0.1.2
ii libmatrixio-malos-dev 0.1.2
ii libmatrixio-protos:armhf 0.1.4
ii libmatrixio-protos-dev 0.1.4
ii libswresample2:armhf 7:3.2.10-1~deb9u1+rpt1
ii matrixio-creator-init 0.4.7
ii matrixio-malos 0.3.2
ii matrixio-malos-wakeword 0.1.4
ii matrixio-malos-zigbee 0.1.4
ii matrixio-openocd 1.0.1
ii matrixio-pocketsphinx 0.1.0
ii matrixio-protobuf 3.4.0
ii matrixio-sphinxbase 0.1.0
ii matrixio-xc3sprog 1.1.1

.asoundrc

pcm.!default
{
type asym
playback.pcm {
type hw
card 0
device 0
}
capture.pcm {
type file
file “/tmp/matrix_micarray_channel_0”
infile “/tmp/matrix_micarray_channel_0”
format “raw”
slave {
pcm sc
}
}
}

This does not record

arecord --device=mic_channel0 -r 16000 -c 1 -f S16_LE test.wav

Causes this error

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM mic_channel0
arecord: main:788: audio open error: No such file or directory

This records

arecord -D hw:1,0 -d 5 test.wav

But, produces this, not what I spoke

If you download test.wav and open it with a text editor, you’ll see that it contains text.

Where does the device name “mic_channel0” come from? It seems most everyone is using mic_channelx (0-7), but I have no idea where this name is coming from and why it is being used.

Once I get this working so that I can at least record something, then I’ll be back with my Alexa issues.

Thanks,

Kenny

I’ve had great results using the kernel modules and stretch light using the directions here… https://github.com/matrix-io/matrixio-kernel-modules

and using this for /etc/asound.conf… https://github.com/matrix-io/matrixio-kernel-modules/blob/master/misc/asoundrc

I’m impressed with the quality of the sound using this command…
arecord -d 3 --device=default -r 48000 -c 1 -f S16_LE test.wav

Try copying your .asoundrc file to /etc/asound.conf

Also,

ls /tmp

Should list the mic_channels

Alec

It wouldn’t work with my .asoundrc, so I used this one:

pcm.sc {
type hw
card 1
}

pcm.mic_channel0 {
type file
file “/tmp/matrix_micarray_channel_0”
infile “/tmp/matrix_micarray_channel_0”
format “raw”
slave {
pcm sc
}
}

pcm.mic_channel1 {
type file
file “/tmp/matrix_micarray_channel_1”
infile “/tmp/matrix_micarray_channel_1”
format “raw”
slave {
pcm sc
}
}

pcm.mic_channel8 {
type file
file “/tmp/matrix_micarray_channel_8”
infile “/tmp/matrix_micarray_channel_8”
format “raw”
slave {
pcm sc
}
}

pcm.!default {
type asym
playback.pcm {
type hw
card 0
device 0
}

capture.pcm {
type file
file “/tmp/matrix_micarray_channel_0”
infile “/tmp/matrix_micarray_channel_0”
format “raw”
slave {
pcm sc
}
}
}

Copied it to /etc/asound.conf

and now, this works and sounds perfectly:

arecord --device=mic_channel0 -d 5 -r 16000 -c 1 -f S16_LE test.wav

It would be great if a default set of .asoundrc and asound.conf configurations and files would be provided/installed when installing the software.

My Alexa example is now working (to a point) and even autostarting at boot.

When I say Alexa, it makes the start sound and turns the LED’s red, but that is all it does. It never speaks or responds to questions.

Subject for a new thread, I guess.

Thank you,

Kenny

I don’t remember if I installed that or not. Anyway to tell?

I installed just about everything Matrix related. If that one takes a long time to compile and install, then I probably installed it yesterday because something I did took quite a while.

Kenny

That’s exactly where I’m at as well. I can record using arecord and run all of the matrix-creator-hal demos, but Alexa just makes the start sound. It does not apparently hear me or respond.

Alec

Hi @gapdev,

If you are trying to get and Alexa demo working also check this guide for the Alexa SDK (C++ version from Amazon). We are working on a full guide on Hackster. So you can go to https://github.com/matrix-io/matrixio-alexa-sdk-guide and follow the steps. This guide is way more simple than the Java version. Take into account that the installation of all packages following this guide can take almost an hour. It is also a good advise to start from scratch when starting with this guide.

Just FYI the current guide we have is based on the Java example from Amazon that is currently in maintenance mode.

Let us knokw how it goes,

Thank you

Exactly the problem I’m having now.

Getting syslog entries like this:

Apr 4 06:34:39 raspi-voice bash[477]: INFO:===> WakeWordAgent: wake word detected <===
Apr 4 06:34:39 raspi-voice bash[477]: INFO:WakeWordAgent: State set to WAKE_WORD_DETECTED(3)
Apr 4 06:34:39 raspi-voice bash[477]: INFO:WakeWordAgent: State set to SENT_WAKE_WORD_DETECTED(4)
Apr 4 06:34:39 raspi-voice bash[477]: INFO:WakeWordAgent: IPC Command received:3
Apr 4 06:34:39 raspi-voice bash[477]: INFO:WakeWordAgent: State set to WAKE_WORD_PAUSE_REQUESTED(5)
Apr 4 06:34:39 raspi-voice bash[477]: INFO:SensoryWakeWordEngine: handling pause
Apr 4 06:34:39 raspi-voice bash[477]: INFO: *** THREAD JOINING: Sensory ***
Apr 4 06:34:39 raspi-voice bash[477]: INFO:SensoryWakeWordEngine: mainLoop thread ended
Apr 4 06:34:39 raspi-voice bash[477]: INFO:WakeWordAgent: State set to WAKE_WORD_PAUSED(6)
Apr 4 06:34:41 raspi-voice bash[476]: Listening

It recognizes the wake word and makes log entries when I say it, but nothing else.

Ok, I will do that on a different SD Card/new install and see how it goes.

Does that one also require that we renew a License every 3 months?

Thanks much,

Kenny

Yes, it is also required, the license is related to Sensory’s wakeword library.

Not trying to steal this post but gapdev and I seem to be having very similar issues. Using a seperate SD card with a fresh Raspbian Stretch install I followed the Alexa SDK guide. It looks like it’s working but I can not hear Alexa’s response. I did test the speaker to make sure it was working. Here is the “Speaking” output from the app when asking Alexa what time it is:

###########################
#       Speaking...       #
###########################

2018-04-04 16:53:26.356 [  c] 0 HTTP2Stream:libcurl:streamId=23,text=Curl_http_done\: called premature \=\= 0
2018-04-04 16:53:26.357 [  c] 0 AudioInputProcessor:onSendCompleted:status=SUCCESS
2018-04-04 16:53:26.357 [  c] 0 HTTP2Transport:cleanupFinishedStream:streamId=23,result=200
2018-04-04 16:53:26.357 [  c] 0 HTTP2StreamPool:releaseStream:streamId=23,numAcquiredStreams=1
2018-04-04 16:53:26.358 [  c] 0 HTTP2Transport:processNextOutgoingMessage:jsonContent={"event"\:{"header"\:{"namespace"\:"SpeechSynthesizer"\,"name"\:"SpeechStarted"\,"messageId"\:"5e51f0f5-e25a-4fd9-8bc9-433d0a604ee5"}\,"payload"\:{"token"\:"amzn1.as-ct.v1.Domain\:Application\:NotificationsV4#ACRI#DeviceTTSRendererV4_1b19bded-8401-4568-a3cb-e98d6f470756"}}}
2018-04-04 16:53:26.359 [  c] 0 HTTP2StreamPool:getStream:streamId=25,numAcquiredStreams=2
2018-04-04 16:53:26.359 [  c] 9 HTTP2Transport:insertActiveStream:handle=0x2262048
2018-04-04 16:53:26.360 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Found bundle for host avs-alexa-na.amazon.com\: 0x2182bb0 [can multiplex]
2018-04-04 16:53:26.361 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Conn\: 0 (0x218bb88) Receive pipe weight\: (-1/0)\, penalized\: (nil)
2018-04-04 16:53:26.361 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Multiplexed connection found!
2018-04-04 16:53:26.361 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Found connection 0\, with requests in the pipe (1)
2018-04-04 16:53:26.361 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Re-using existing connection! (#0) with host avs-alexa-na.amazon.com
2018-04-04 16:53:26.362 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Using Stream ID\: 19 (easy handle 0x2262048)
2018-04-04 16:53:26.492 [ 16] 9 BaseStreamSource:onNeedDataCalled:size=4096
2018-04-04 16:53:26.493 [  2] 9 BaseStreamSource:handleNeedDataCalled
2018-04-04 16:53:26.597 [  c] 0 HTTP2Stream:receivedRequestId:value=x-amzn-requestid\: 024652fffe78bc6a-00004557-001f8ac9-8eae5e13e5859080-76625a96-5
2018-04-04 16:53:26.597 [  c] 0 HTTP2Stream:libcurl:streamId=25,text=Curl_http_done\: called premature \=\= 0
2018-04-04 16:53:26.597 [  c] 0 HTTP2Transport:cleanupFinishedStream:streamId=25,result=204
2018-04-04 16:53:26.597 [  c] 0 HTTP2StreamPool:releaseStream:streamId=25,numAcquiredStreams=1
2018-04-04 16:53:26.597 [  c] 0 CurlEasyHandleWrapper:reset:responseCode=HTTP_RESPONSE_SUCCESS_NO_CONTENT
2018-04-04 16:53:27.542 [  2] 9 MediaPlayer:messageReceived:type=eos,source=audio-pipeline
2018-04-04 16:53:27.842 [  2] 9 BaseStreamSource:~BaseStreamSource
2018-04-04 16:53:27.843 [  2] 0 MediaPlayer:callingOnPlaybackFinished:currentId=4
2018-04-04 16:53:27.843 [  2] 9 SpeechSynthesizer:onPlaybackFinished:callbackSourceId=4
2018-04-04 16:53:27.843 [  2] 9 MediaPlayer:tearDownTransientPipelineElements
2018-04-04 16:53:27.843 [  2] 0 MediaPlayer:saveOffsetBeforeTeardown:offset=1968
2018-04-04 16:53:27.843 [  9] 0 SpeechSynthesizer:executePlaybackFinished
2018-04-04 16:53:27.843 [  9] 9 SpeechSynthesizer:setCurrentStateLocked:state=FINISHED
2018-04-04 16:53:27.843 [  9] 0 SpeechSynthesizer:executeProvideState:stateRequestToken=0
2018-04-04 16:53:27.844 [  9] 0 ContextManager:updateStateLocked:action=updatedState,state={"token"\:"amzn1.as-ct.v1.Domain\:Application\:NotificationsV4#ACRI#DeviceTTSRendererV4_1b19bded-8401-4568-a3cb-e98d6f470756"\,"offsetInMilliseconds"\:0\,"playerActivity"\:"FINISHED"},namespace=SpeechSynthesizer,name=SpeechState
2018-04-04 16:53:27.844 [  9] 0 EventBuilder:buildJsonEventString:messageId=f292d958-615b-4bc7-9599-f309503650af,namespace=SpeechSynthesizer,name=SpeechFinished
2018-04-04 16:53:27.845 [  9] 9 HTTP2Transport:enqueueRequest:jsonContent={"event"\:{"header"\:{"namespace"\:"SpeechSynthesizer"\,"name"\:"SpeechFinished"\,"messageId"\:"f292d958-615b-4bc7-9599-f309503650af"}\,"payload"\:{"token"\:"amzn1.as-ct.v1.Domain\:Application\:NotificationsV4#ACRI#DeviceTTSRendererV4_1b19bded-8401-4568-a3cb-e98d6f470756"}}}
2018-04-04 16:53:27.845 [  9] 9 SpeechSynthesizer:setHandlingCompleted
2018-04-04 16:53:27.845 [  9] 0 DirectiveProcessor:onHandlingCompeted:messageId=55efc48a-5f4a-4195-9985-8590b014a5c4,directiveBeingPreHandled=(nullptr)
2018-04-04 16:53:27.846 [  9] 0 CapabilityAgent:removingMessageIdFromMap:messageId=55efc48a-5f4a-4195-9985-8590b014a5c4
2018-04-04 16:53:27.902 [  c] 0 HTTP2Transport:processNextOutgoingMessage:jsonContent={"event"\:{"header"\:{"namespace"\:"SpeechSynthesizer"\,"name"\:"SpeechFinished"\,"messageId"\:"f292d958-615b-4bc7-9599-f309503650af"}\,"payload"\:{"token"\:"amzn1.as-ct.v1.Domain\:Application\:NotificationsV4#ACRI#DeviceTTSRendererV4_1b19bded-8401-4568-a3cb-e98d6f470756"}}}
2018-04-04 16:53:27.903 [  c] 0 HTTP2StreamPool:getStream:streamId=27,numAcquiredStreams=2
2018-04-04 16:53:27.903 [  c] 9 HTTP2Transport:insertActiveStream:handle=0x2262048
2018-04-04 16:53:27.904 [  c] 0 HTTP2Stream:libcurl:streamId=27,text=Found bundle for host avs-alexa-na.amazon.com\: 0x2182bb0 [can multiplex]
2018-04-04 16:53:27.904 [  c] 0 HTTP2Stream:libcurl:streamId=27,text=Conn\: 0 (0x218bb88) Receive pipe weight\: (-1/0)\, penalized\: (nil)
2018-04-04 16:53:27.904 [  c] 0 HTTP2Stream:libcurl:streamId=27,text=Multiplexed connection found!
2018-04-04 16:53:27.904 [  c] 0 HTTP2Stream:libcurl:streamId=27,text=Found connection 0\, with requests in the pipe (1)
2018-04-04 16:53:27.904 [  c] 0 HTTP2Stream:libcurl:streamId=27,text=Re-using existing connection! (#0) with host avs-alexa-na.amazon.com
2018-04-04 16:53:27.905 [  c] 0 HTTP2Stream:libcurl:streamId=27,text=Using Stream ID\: 1b (easy handle 0x2262048)
2018-04-04 16:53:28.045 [  e] 0 DialogUXStateAggregator:setState:from=SPEAKING,to=IDLE

I will mark this post title “Microphone issues” as solved. I suggest you to open a new one to follow the Alexa SDK progress.

Thank you

-Yoel

Can you share the entire output? Maybe in a file so it doesn’t fill the conversation?

Thank you

Yes, thanks for your help. Started new thread at Matrix Voice and Alexa SDK issue.

Alec

The Alexa guide now on Hackster as promised !
MATRIX Voice and MATRIX Creator Running Alexa (C++ Version)

1 Like

Hello,
I am running the exact same process you mentioned but I’m encountering the following error:

$ arecord --device=mic_channel0 -d 5 -r 16000 -c 1 -f S16_LE test.wav
ALSA lib pcm_file.c:763:(snd_pcm_file_open) file format “raw” is unknown
arecord: main:788: audio open error: Invalid argument

Can you help me with what might be wrong in my setup??