Hikey 960 I2S audio capture & playback

I have connected a MAX98357A I2S amplifier and a TDK/Invensense ICS-43434 microphone to a Hikey960. I can succesfully play back 16-bit stereo 48kHz samples and record in the same format. However, the recording volume is very low. I suspect the cause is the ICS-43434 being a 24-bit microphone and therefore I may be losing 8-bits of significance. Is there a way of setting the PCM bitrate on the Hikey PCM audio driver?

– edit –
Hmm got to capture at 24 bit but then it wouldn play it back on the device. Also tried 32 bit but that wouldn capture. Also, when playing back the 24-bit capture on a desktop machine, the volume wasn significantly higher, and the sample was played back 1.5 or twice as fast. So not too sure what I did there (changed some values in hisi-i2s* driver files).

perhaps I’m just looking for a microphone gain setting…

Uh, well bitrate really isn’t the term you’re looking for (although it does impact it, bitrate is used more in discussing compressed audio formats, like vorbis). What you’re looking for is actually the sample size.

As far as I understand it, the driver should support 24 bit sample size;

Since you’ve been partially successful now in capturing 24 bit samples, it would be helpful now to determine if the issue is on the capture side, playback side, or both. Take the captured pcm file and open it in a hex editor and/or https://www.audacityteam.org/ and see if the captured data makes sense. You can also try playback of a known good stereo 24 bit audio sample.

I have run into the situation where I’ve been forced to capture 16 bit sample size from a 24 bit device. Yes, adding gain will do the job. But note that this will generally be a post-processing step unless you write a new capture program to apply the gain while capturing.

Ah that explains why 32-bit was a complete no-go.

I can set 24-bit recording and playback and actually make a recording, but playing it back using tinyplay always results in an error message about the device not being able to play back > 16 bit audio. I can’t find the right place (if it’s there at all) to configure PCM playback to 24-bit.

Just a little further down in the file;

You would need to add 24 bit formats in order for the driver to advertise 24 bit capability…

Yeah I did that and this was reflected in tinypcminfo and I could then record in 24-bit with tinycap, but tinyplay won’t play the 24 bit file. Also, the recorded 24-bit file plays back about twice as fast on a Linux laptop. Furthermore, it didn’t seem that this change had actually increased the recording volume.

I might leave I2S for now and change to USB audio. I have a prototype USB speaker/microphone combo in the office that I built from the same ICS-43434 microphones with a Teensy 3 board doing the I2S to USB conversion, hooked it up to the Hikey and I had instant good quality recordings with tinycap.

You made the change in both spots? It has to be made for both capture as well as playback.

If it’s changing the playback speed, then something funny is definitely happening, I’d probably have to look at the actual data to guess what’s going on.

Have you considered joining the I2S mezzanine group buy? High end TI ADC and DACs, which work wonderfully at 16 bit sample size, and 100% working on the hikey960. I2S Mezzanine | GroupGets

… And if you can find anyone else who wants to buy one or several, that would also be great. I’d really love it if we could get a batch of these out.