Hello, delving into the Teensy world, and I'm excited.
I have got Teensy to act as a multi-channel USB Audio Interface with help from this thread: https://forum.pjrc.com/index.php?th...-multi-channel-outputs-not-just-stereo.70176/
So far, I have attached a pair of I2S microphones (ICS43434) to a Teensy 4.0 and it is working well. However, I am a little disappointed by the input gain form these microphones. I intend to record background noise, so the levels are coming in very quiet. I get poor resolution by just boosting the 16-bit recording I get from the Teensy. So I have been digging around to find a way to "boost" the signal within the mics/Teensy signal chain...
The microphones themselves apparently transmit a 24-bit PCM signal through I2S (using a word length of 32 bits I believe), however the Teensy Audio library is 16-bit, so I lose 8 bits of data in a 24-to-16bit conversion process somewhere (I assume - most likely the last 8 bits just gets thrown away).
It occurs to me that if I can get into that conversion process, I could create a "digital gain", where the quiet signal from the 24bit samples are converted to louder 16bit samples, losing minimal resolution. If the gain factor is a power of 2, then this conversion should be no more than omitting the leading bits from the 24bit sample (with some consequences accepted).
I was hoping that I might be able to do such a thing by building a new child class from the AudioInputI2S class along the lines of below:
...but I am likely not digging in the right place. I am willing to do some work to get this working, but I could do with a few pointers as to where to look in the Teensy 4 core Audio library. Importantly, where in the library does the 24bit samples from the I2S inputs get decimated to 16bits? The AudioStream class? DMAChannel class?
I'll be willing to work to get this sorted and share the code with others. Thanks in advance.
==== More Info ====
spec sheet for the ICS43434: https://cdn-shop.adafruit.com/product-files/6049/6049_DS-000069-ICS-43434-v1.2.pdf
Paul says 24 bit may come in future ( https://www.pjrc.com/teensy/td_libs_AudioRoadmap.html ), but I don't think I need to wait for this.
I have got Teensy to act as a multi-channel USB Audio Interface with help from this thread: https://forum.pjrc.com/index.php?th...-multi-channel-outputs-not-just-stereo.70176/
So far, I have attached a pair of I2S microphones (ICS43434) to a Teensy 4.0 and it is working well. However, I am a little disappointed by the input gain form these microphones. I intend to record background noise, so the levels are coming in very quiet. I get poor resolution by just boosting the 16-bit recording I get from the Teensy. So I have been digging around to find a way to "boost" the signal within the mics/Teensy signal chain...
The microphones themselves apparently transmit a 24-bit PCM signal through I2S (using a word length of 32 bits I believe), however the Teensy Audio library is 16-bit, so I lose 8 bits of data in a 24-to-16bit conversion process somewhere (I assume - most likely the last 8 bits just gets thrown away).
It occurs to me that if I can get into that conversion process, I could create a "digital gain", where the quiet signal from the 24bit samples are converted to louder 16bit samples, losing minimal resolution. If the gain factor is a power of 2, then this conversion should be no more than omitting the leading bits from the 24bit sample (with some consequences accepted).
I was hoping that I might be able to do such a thing by building a new child class from the AudioInputI2S class along the lines of below:
C++:
class AudioInputI2SGain : public AudioInputI2S
{
public:
AudioInputI2SGain(int gain /** insert integer gain factor */) : AudioInputI2S(void) {/** some constructor**/ }
/** some methods as needed **/
}
I'll be willing to work to get this sorted and share the code with others. Thanks in advance.
==== More Info ====
spec sheet for the ICS43434: https://cdn-shop.adafruit.com/product-files/6049/6049_DS-000069-ICS-43434-v1.2.pdf
Paul says 24 bit may come in future ( https://www.pjrc.com/teensy/td_libs_AudioRoadmap.html ), but I don't think I need to wait for this.
Last edited: