Merge branch 'bugfix/fix_i2s_example_sample_calculation_incorrect_bug' into 'master'

bugfix (I2S): Fixed I2S example sine wave sample calculation incorrect bug

Closes IDFGH-2947

See merge request espressif/esp-idf!8108
This commit is contained in:
Michael (XIAO Xufeng)
2020-03-30 12:02:31 +08:00

View File

@@ -40,7 +40,7 @@ static void setup_triangle_sine_waves(int bits)
triangle_float = -(pow(2, bits)/2 - 1); triangle_float = -(pow(2, bits)/2 - 1);
for(i = 0; i < SAMPLE_PER_CYCLE; i++) { for(i = 0; i < SAMPLE_PER_CYCLE; i++) {
sin_float = sin(i * PI / 180.0); sin_float = sin(i * 2 * PI / SAMPLE_PER_CYCLE);
if(sin_float >= 0) if(sin_float >= 0)
triangle_float += triangle_step; triangle_float += triangle_step;
else else
@@ -77,6 +77,7 @@ static void setup_triangle_sine_waves(int bits)
free(samples_data); free(samples_data);
} }
void app_main(void) void app_main(void)
{ {
//for 36Khz sample rates, we create 100Hz sine wave, every cycle need 36000/100 = 360 samples (4-bytes or 8-bytes each sample) //for 36Khz sample rates, we create 100Hz sine wave, every cycle need 36000/100 = 360 samples (4-bytes or 8-bytes each sample)