Michael Liesenberg
Member
Hi,
my external adc TLV320AC6140 is sampling at 96kHz and my teensy audio is working at 48KHz.
If i set my ADC to sample the audio at 48kHz, everything works perfectly. Now changing the I2S master clock to 96kHz the audio sound is chopping.
I set a sine wave frequenz generator at 1khz in the ADC input and looked at the data on my MAC with an digital audio osciloscope and the sine wave has 0 values in 1ms length and here is my question:
What should i change in the audiostream class to make an average work so that i doesnt send a 128 zero value package?
my external adc TLV320AC6140 is sampling at 96kHz and my teensy audio is working at 48KHz.
If i set my ADC to sample the audio at 48kHz, everything works perfectly. Now changing the I2S master clock to 96kHz the audio sound is chopping.
I set a sine wave frequenz generator at 1khz in the ADC input and looked at the data on my MAC with an digital audio osciloscope and the sine wave has 0 values in 1ms length and here is my question:
What should i change in the audiostream class to make an average work so that i doesnt send a 128 zero value package?
Code:
void Filter_FFT::update(void)
{
audio_block_t *block;
block = receiveReadOnly();
if (!block) return;
#ifdef AVG
/* for (int i=0; i<AUDIO_BLOCK_SAMPLES; i++)
{
audiodata[i] = float(block->data[i]);
}
//lowpass_average->process (AUDIO_BLOCK_SAMPLES, &audiodata);
*/
for(int i=0; i<128;i=i+oversampling)
{
array_avg[countAVG] = block->data[i];
for(int j=1; j<oversampling;j++)
{
array_avg[count] = (array_avg[count] + block->data[i+j])/2;
}
countAVG++;
}
if(countAVG >= 128)
{
for(int i=0; i<128;i++)
{
block->data[i] = (int16_t)array_avg[i];
}
countAVG=0;
transmit(block);
release(block);
return;
}
else
{
release(block);
return;
}