DSP with C.H.I.P. and audio capture



I am trying to do some DSP with C.H.I.P. but ALSA API call snd_pcm_readi() gets hanged forever.
Have tried arecord from command line and this always returns an I/O error.
I have freshly flashed headless 4.4 on my board.

Is anyone else having similar problems?
Any suggestions?

Maybe moving to another API (jack for instance) solve the problem or is it a HW/driver problem?


Mic In Header Help
Mic In Header Help

Don’t help me everybody at the same time, please :slight_smile:


Usually when I’ve gotten no response, it’s because no one has tried to do what you’re doing. I would help, but I haven’t done anything audio related with my CHIP.

I’m guessing you have all of the right libraries installed to do what you’re attempting to do.

Have you looked at the thread for the CHIP based Amazon Echo? There might be some useful information in there.


What xtacocorex said.

Also, the board has become busy enough that many of us can’t keep up. If, during your browsing here, you’ve encountered somebody who you think might have a clue, you can call them out with an @ sign followed by their username. I always at least visit threads that call me out.


Sorry if I seemed demanding, I know this has to be a very busy forum. :wink:

I’ll try to flash my chip with version 4.3, and see if I get the same error and do some additional tests.

Thanks a lot for your suggestions, xtacocorex, I’ll read that thread carefully (again), although the problem there seems to be different. They only record noise from the mic because of low powered circuitry.

Another test I can do is plugging an external USB audio card, in order to see if it is a software/driver/hardware problem.


Oh, not at all! I just wanted you to know that sometimes if you don’t get a reply, it’s because the people likely to know the answer might have missed your post. Don’t hesitate to reach out for help, that’s what the bbs is for!


Since that Amazon Echo article was written back in January, I’m assuming they were using a much earlier firmware version. I’m having the trouble with 4.4, and I’m assuming the OP is, also.

root@mychip:~# uname -or
4.4.11-ntc GNU/Linux

root@mychip:~# arecord -f cd -d 3 -D hw:0,0 chipaudioin.wav
Recording WAVE ‘chipaudioin.wav’ : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
arecord: pcm_read:2031: read error: Input/output error


Update on this topic: I have just tested arecord and snd_pcm_readi system call, and they WORK on 4.3 headless.
I’m afraid the quality of the captured sound is not very good, but at least I will be able to test it. I’ll post more updates as soon I have some results.

Thanks again!


[manolonte], can you please describe your audio input connection on the C.H.I.P? I am only getting hum in my recording of the built-in MICIN input, as described in the other thread.



In fact I am just getting hum, like you. I’ll try to change some parameters and to plug the mic directly to the ports instead of the minijack input, will let you know.


[manlonte], I am plugged into the port headers, with my audio source coupled into MICIN with a series 100 uF electrolytic into MICIN. I connected GND from my audio source directly to HPCOM. And as we were saying, I am just getting hum.


I am playing around directly with codec registers too, and all I get is hum. Maybe a hardware problem, as log as I can see, nobody has managed to capture any sound yet.


Please don’t miss out on the section in the docs, [Microphone and Audio input](http://docs.getchip.com/chip.html#microphone-and-audio-input), regarding microphone input via the headers. Additional circuitry may be required depending on the type of microphone used.


Oh, my God, I didn’t read the section about soldering the board!!! I’m ashamed…
I’ll try that later, given that I will not need video output for my project.
Will audio capture quality be better with the external circuitry and pins 10/12 than with the TRRS connector?
I would like to keep it as simple as possible, but without sacrificing quality.

Thanks a lot, bleepbloop!


It worked, See the pictures.

Capture quality seems promising.


This isn’t the issue I was seeing. I wasn’t using a microphone. As I described in the other thread, I was AC-coupling a line-level source to MICIN. Elsewhere on the Docs section or on the BBS, I read that MICM was equivalent to HPCOM. This might be my issue–I might need to use MICM as the “ground” for the audio source, instead of HPCOM. When I get a chance, I will try it.

For the last week, I’ve been using an external audio USB dongle, and that has been working fine. However, I miss my USB port, and I need to find a decent powered hub that isn’t enormous.