diff --git a/gen_wave.py b/gen_wave.py index e1219e6e..41265fc 100644 --- a/gen_wave.py +++ b/gen_wave.py @@ -1,5 +1,5 @@ -PLOT = True -FFT = PLOT and True +PLOT = False +FFT = PLOT and False import math import io, os @@ -9,7 +9,7 @@ if FFT: import numpy as np DATA_RATE = 1187.5 SIZE_RATIO = 1 -ratio = 16 +ratio = 4 sample_rate = DATA_RATE*ratio print(f"{sample_rate=}") if not sample_rate.is_integer(): raise ValueError("Need a even value") @@ -92,4 +92,4 @@ def generate(): generate() outc.close() -outh.close() \ No newline at end of file +outh.close() diff --git a/src/modulator.c b/src/modulator.c index 336efad..eb579e7 100644 --- a/src/modulator.c +++ b/src/modulator.c @@ -146,5 +146,5 @@ float get_rds_sample(RDSModulator* rdsMod, uint8_t stream) { if (rdsMod->data[stream].out_sample_index == SAMPLE_BUFFER_SIZE) rdsMod->data[stream].out_sample_index = 0; uint8_t tooutput = rdsMod->params.rdsgen > stream ? 1 : 0; - return sample*rdsMod->params.level*tooutput; + return sample*rdsMod->params.level*tooutput / 3.5; // 3.5 volts from piracz } diff --git a/src/rds.h b/src/rds.h index 41dac6d..d425ebe 100644 --- a/src/rds.h +++ b/src/rds.h @@ -10,9 +10,9 @@ #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 FILTER_SIZE 16 +#define RDS_SAMPLE_RATE 4750 +#define SAMPLES_PER_BIT 4 +#define FILTER_SIZE 4 #define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE) #define STREAMS 2 diff --git a/src/waveforms.c b/src/waveforms.c index a1fdf2e..d277570 100644 --- a/src/waveforms.c +++ b/src/waveforms.c @@ -6,5 +6,5 @@ Released under the GNU GPL v3 license. */ -float waveform_biphase[16] = {0.0, 0.3826834323650898, 0.7071067811865475, 0.9238795325112867, 1.0, 0.9238795325112867, 0.7071067811865476, 0.3826834323650899, 1.2246467991473532e-16, -0.3826834323650892, -0.7071067811865475, -0.9238795325112868, -1.0, -0.923879532511287, -0.7071067811865477, -0.3826834323650904}; +float waveform_biphase[4] = {0.0, 1.0, 1.2246467991473532e-16, -1.0}; diff --git a/src/waveforms.h b/src/waveforms.h index 930ee51..258449b 100644 --- a/src/waveforms.h +++ b/src/waveforms.h @@ -6,4 +6,4 @@ Released under the GNU GPL v3 license. */ -extern float waveform_biphase[16]; +extern float waveform_biphase[4];