diff --git a/gen_wave.py b/gen_wave.py index ff172ae..8262a9d 100644 --- a/gen_wave.py +++ b/gen_wave.py @@ -7,6 +7,7 @@ if PLOT: import matplotlib.pyplot as plt if FFT: import numpy as np # Import numpy for FFT DATA_RATE = 1187.5 +SIZE_RATIO = 1 ratio = 16 sample_rate = DATA_RATE*ratio @@ -84,10 +85,10 @@ def generate(): highest_idx = i middle = int((lowest_idx+highest_idx)/2) - out = shapedSamples[middle-int(ratio):middle+int(ratio)] + out = shapedSamples[middle-int(ratio*SIZE_RATIO):middle+int(ratio*SIZE_RATIO)] out = [2 * (i - min(out)) / (max(out) - min(out)) - 1 for i in out] if max(out) > 1 or min(out) < -1: raise Exception("Clipped") - print(f"{len(out)=} {len(out)/sample_rate/2=} {1/DATA_RATE=}") + print(f"{len(out)=} {len(out)/sample_rate=} {(len(out)/sample_rate)/(1/DATA_RATE)=} {1/DATA_RATE=}") if PLOT: # Plot the waveform diff --git a/src/rds.h b/src/rds.h index e3a0e21..68c3bcf 100644 --- a/src/rds.h +++ b/src/rds.h @@ -11,7 +11,7 @@ #define GROUP_LENGTH 4 #define BITS_PER_GROUP (GROUP_LENGTH * (BLOCK_SIZE + POLY_DEG)) #define RDS_SAMPLE_RATE 19000 -#define SAMPLES_PER_BIT 16 +#define SAMPLES_PER_BIT 8 // ratio//2 #define FILTER_SIZE 32 #define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE)