What node can using for ReSpeaker 2 Mic Array Pi HAT v1.0

When you connect a file node to the output of the add wav header node and write the the wav buffer to a wav file you can listen to the recording to see if it worked.
You should configure the file node like this:


Can you try that?
This way you know if its recording something.

open the file to see its recording something?

but i uncareful hide the file manager in task bar...how to find it out?

connect headphones or a speaker to your raspberry pi and open the commandline. Type aplay /home/pi/yourwav.wav and listen if you can hear what you recorded.
Another way would be to use an sftp client like FileZilla to download the file to your laptop and listen to it there to see if it recorded something.

image

the output show like this...i cant listen what i record

Where are you plugging your headphones in? It depends what you configured your standard output to be in /etc/asound.conf.
I think that the driver installation of the 2mic pi hat automatically configures playback over the hat itself. Did you plug your speaker/headphone straight into the hat or the pi?
The playback itself looks fine.

Yes, I plug at respeaker 2 mic pi hat

Have you tried the jack on the pi?

yes, i try ..also no sound...or it need some coding in terminal for every time i close the pi and respeaker 2 mic?

Ok please follow along I just set up a fresh pi 3b with a respeaker 2mic hat just for you:
steps:

update

sudo apt-get update
sudo apt-get upgrade

install git & sox

sudo apt-get install git sox

install seeedvoicecard driver according to their instructions

git clone https://github.com/respeaker/seeed-voicecard.git
cd seeed-voicecard
sudo ./install.sh
reboot

copy/save the generated asound.conf edit the original to new content and save it and reboot

sudo cp /etc/asound.conf /etc/asound.conf.old
sudo nano /etc/asound.conf

change the content to

pcm.!default {
    type asym
    playback.pcm "speaker"
    capture.pcm "array"
}

pcm.speaker {
    type plug
    slave.pcm "hw:seeed2micvoicec"
}

pcm.array {
    type plug
    slave.pcm "hw:seeed2micvoicec"
}

reboot

sudo shutdown -r now

check that seeed didn’t overwrite the config. This can happen, otherwise repeat above

cat /etc/asound.conf

now plug your headphones/speaker into the plug on the seeed card and execute this command

sox -t alsa default -L -e signed-integer -c 1 -r 16000 -b 16 ~/test.wav trim 0 5 && play ~/test.wav

it will record 5 seconds of audio and than play it back to you. You should be able to hear it. I just tested those exact commands and it works.

1 Like

so, i am speak to the mic at respeaker right? or i speak to mic at earphone? and i will listen the sound at earphone right?

What I show above records directly from the two microphones on the respeaker mic and than plays back over the headphone jack on the respeaker mic.

image

Still cannot...it need run below flow when record?

or just record to respeaker after run below code in terminal?
sox -t alsa default -L -e signed-integer -c 1 -r 16000 -b 16 ~/test.wav trim 0 5 && play ~/test.wav

are you sure that you have configured the asound.conf correctly?
Can you show me your asound.conf?

image
image

i have try to rewrite asound.conf , but it still show above error...where got wrong?

Can you install https://github.com/johanneskropf/node-red-contrib-sox-utils from github?
As with this you can select the source you want to record from and also on which device to play the recording. If you install it I can send you an example flow. The good thing is you wont have to change anything in the asound.conf for now if you use that node and you can do everything from nodered.
This would make testing the mic a lot easier for both of us.

image

i have installed, is that install successful?

you need to do the install command from your node-red directory for node-red to find it.
This is normally
~/.node-red.
so please do first cd ~/.node-red and than npm install johanneskropf/node-red-contrib-sox-utils and than restart node-red with the command sudo systemctl restart nodered when you open node-red now you should have the sox record and play node in your palette.

after install, what should i need do?

Did you install sox as per the manual of the node sudo apt-get install sox too? If yes than import this flow:

[{"id":"60716630.cb73b","type":"sox-record","z":"2a8d15bd.b2aeea","name":"","inputSource":"1,0","byteOrder":"-L","encoding":"signed-integer","channels":1,"rate":16000,"bits":16,"gain":"0","lowpass":8000,"showDuration":true,"durationType":"limited","durationLength":"6","silenceDetection":"something","silenceDuration":"1.5","silenceThreshold":"2.5","outputFormat":"wav","debugOutput":true,"x":270,"y":80,"wires":[["7fc73aa2.35d88c"],["cbc56be1.bd447"]]},{"id":"45e5db2c.dfd494","type":"inject","z":"2a8d15bd.b2aeea","name":"","topic":"","payload":"start","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":80,"wires":[["60716630.cb73b"]]},{"id":"7fc73aa2.35d88c","type":"sox-play","z":"2a8d15bd.b2aeea","name":"","outputDevice":"1,0","gain":"0","startNew":"start","debugOutput":true,"x":440,"y":80,"wires":[["ce69ce5f.982028"]]},{"id":"cbc56be1.bd447","type":"debug","z":"2a8d15bd.b2aeea","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":450,"y":140,"wires":[]},{"id":"ce69ce5f.982028","type":"debug","z":"2a8d15bd.b2aeea","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":610,"y":80,"wires":[]}]

Than choose the respeaker 2 mic pi hat in both nodes as input/output device and deploy the flow:

Plug your headphones into the respeaker hat.
Than press on the inject node to start the recording and say something. The node is configured to record for a maximum of 6 seconds or until it detects silence. Once it finished recording it will automatically play back that recording to you on the configured output.
You will see detailed recording and playback information in the debug window.