using slower sample rate
Hi I'm quite new with this codec shield. I'm using maple board from leaflabs to interface with the audio codec shield. For some reason, I want to generate 1kHz sine wave at 2.145kHz sample rate instead of using the default 44.1Khz. But, I could not do it, the output waveform is just a really noisy sine wave which is not even at 1Khz.
This is part of my code:
This is part of my code:
#define SAMPLE_RATE 2
//#define SAMPLE_RATE 44
int16 sinewave[] __FLASH__ = {
#include <sinetable.inc>
};
const uint16 realSamplerate = 2450;
//const uint16 realSamplerate = 44100;
const uint16 sineSize = 1024;
uint16 currentFreqL = 1000;
int16 tempL;
uint16 locationL;
samplesPerSinewaveL = realSamplerate / currentFreqL;
sineIncL = sineSize/ samplesPerSinewaveL;
tempL = sinewave[locationL];
locationL += sineIncL;
locationL &= 0x03ff;