Fixed audio playback test: added a missing conversion from 12 bit to 8 bit
This commit is contained in:
parent
b80ddc1145
commit
3d9cefdd03
|
|
@ -190,10 +190,18 @@ int main()
|
||||||
gpio_setMode(BEEP_OUT, ALTERNATE);
|
gpio_setMode(BEEP_OUT, ALTERNATE);
|
||||||
gpio_setAlternateFunction(BEEP_OUT, 2);
|
gpio_setAlternateFunction(BEEP_OUT, 2);
|
||||||
|
|
||||||
|
gpio_setPin(GREEN_LED);
|
||||||
|
|
||||||
delayMs(3000);
|
delayMs(3000);
|
||||||
|
|
||||||
recordMic(sampleBuf);
|
recordMic(sampleBuf);
|
||||||
|
|
||||||
|
/* Convert samples from 12 bit to 8 bit, as required by PWM audio */
|
||||||
|
for(size_t i = 0; i < numSamples; i++)
|
||||||
|
{
|
||||||
|
sampleBuf[i] >>= 4;
|
||||||
|
}
|
||||||
|
|
||||||
/* End of recording, play sound */
|
/* End of recording, play sound */
|
||||||
gpio_clearPin(GREEN_LED);
|
gpio_clearPin(GREEN_LED);
|
||||||
gpio_setPin(RED_LED);
|
gpio_setPin(RED_LED);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue