mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
try a diffrent waveform
This commit is contained in:
@@ -8,7 +8,7 @@ if FFT: import numpy as np # Import numpy for FFT
|
||||
|
||||
DATA_RATE = 1187.5
|
||||
|
||||
ratio = 14
|
||||
ratio = 16
|
||||
sample_rate = DATA_RATE*ratio
|
||||
print(f"{sample_rate=}")
|
||||
if not sample_rate.is_integer(): raise ValueError("Need a even value")
|
||||
@@ -84,9 +84,10 @@ def generate():
|
||||
highest_idx = i
|
||||
middle = int((lowest_idx+highest_idx)/2)
|
||||
|
||||
out = shapedSamples[middle-int(ratio*2):middle+int(ratio*2)]
|
||||
out = shapedSamples[middle-int(ratio):middle+int(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=}")
|
||||
|
||||
if PLOT:
|
||||
# Plot the waveform
|
||||
|
||||
@@ -1,27 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Project name and version
|
||||
project(rds95 VERSION 1.0)
|
||||
project(rds95 VERSION 1.2)
|
||||
|
||||
# Set compiler and flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wextra -pedantic -O2 -std=c18 -march=native -DVERSION=\"${PROJECT_VERSION}\"")
|
||||
add_compile_options(-Wall -Werror -Wextra -pedantic -O2 -std=c18 -march=native -DVERSION=\"${PROJECT_VERSION}\")
|
||||
|
||||
# Define sources
|
||||
set(SOURCES
|
||||
rds95.c
|
||||
waveforms.c
|
||||
rds.c
|
||||
control_pipe.c
|
||||
modulator.c
|
||||
lib.c
|
||||
ascii_cmd.c
|
||||
)
|
||||
file(GLOB SOURCES src/*.c)
|
||||
|
||||
# Define the executable
|
||||
add_executable(rds95 ${SOURCES})
|
||||
|
||||
# Link additional libraries
|
||||
target_link_libraries(rds95 PRIVATE m pthread pulse pulse-simple)
|
||||
|
||||
# Install target
|
||||
install(TARGETS rds95 DESTINATION /usr/local/bin)
|
||||
install(TARGETS rds95 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
@@ -62,7 +62,7 @@ static void handle_rtp(char *arg, RDSModulator* mod, char* output) {
|
||||
}
|
||||
|
||||
static void handle_lps(char *arg, RDSModulator* mod, char* output) {
|
||||
arg[LPS_LENGTH] = 0;
|
||||
arg[LPS_LENGTH * 2] = 0;
|
||||
set_rds_lps(mod->enc, arg);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
@@ -74,7 +74,6 @@ static void handle_ps(char *arg, RDSModulator* mod, char* output) {
|
||||
}
|
||||
|
||||
static void handle_ct(char *arg, RDSModulator* mod, char* output) {
|
||||
arg[2] = 1;
|
||||
mod->enc->data[mod->enc->program].ct = atoi(arg);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
@@ -170,7 +169,7 @@ static void handle_rt2en(char *arg, RDSModulator* mod, char* output) {
|
||||
|
||||
static void handle_rtper(char *arg, RDSModulator* mod, char* output) {
|
||||
mod->enc->data[mod->enc->program].rt_switching_period = atoi(arg);
|
||||
mod->enc->data[mod->enc->program].orignal_rt_switching_period = atoi(arg);
|
||||
mod->enc->data[mod->enc->program].orignal_rt_switching_period = mod->enc->data[mod->enc->program].rt_switching_period;
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
@@ -303,7 +302,7 @@ static void handle_init(char *arg, RDSModulator* mod, char* output) {
|
||||
static void handle_ver(char *arg, RDSModulator* mod, char* output) {
|
||||
(void)arg;
|
||||
(void)mod;
|
||||
strcpy(output, "Firmware v. 1.1a - (C) 2025 radio95\0");
|
||||
sprintf(output, "Firmware v. %.1f - (C) 2025 radio95", VERSION);
|
||||
}
|
||||
|
||||
static void handle_eonen(char *arg, char *pattern, RDSModulator* mod, char* output) {
|
||||
@@ -501,7 +500,7 @@ static bool process_pattern_commands(char *cmd, char *arg, char *output, RDSModu
|
||||
return false;
|
||||
}
|
||||
|
||||
void process_ascii_cmd(RDSModulator* mod, char *str) {
|
||||
void process_ascii_cmd(RDSModulator* mod, char *str, char *cmd_output) {
|
||||
char *cmd, *arg;
|
||||
char output[255];
|
||||
memset(output, 0, sizeof(output));
|
||||
@@ -628,4 +627,6 @@ void process_ascii_cmd(RDSModulator* mod, char *str) {
|
||||
cmd, arg, output, mod)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd_output != NULL) strcpy(cmd_output, output);
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
#include "rds.h"
|
||||
#define CMD_BUFFER_SIZE 255
|
||||
#define CTL_BUFFER_SIZE (CMD_BUFFER_SIZE * 2)
|
||||
#define READ_TIMEOUT_MS 100
|
||||
#define READ_TIMEOUT_MS 150
|
||||
|
||||
extern void process_ascii_cmd(RDSModulator* mod, char *str);
|
||||
extern void process_ascii_cmd(RDSModulator* mod, char *str, char *cmd_output);
|
||||
@@ -37,7 +37,7 @@ void poll_control_pipe(RDSModulator* mod) {
|
||||
if (cmd_len > 0 && cmd_len < CMD_BUFFER_SIZE) {
|
||||
memset(cmd_buf, 0, CMD_BUFFER_SIZE);
|
||||
strncpy((char *)cmd_buf, token, CMD_BUFFER_SIZE - 1);
|
||||
process_ascii_cmd(mod, cmd_buf);
|
||||
process_ascii_cmd(mod, cmd_buf, NULL);
|
||||
}
|
||||
token = strtok(NULL, "\r\n");
|
||||
if(token == NULL) token = strtok(NULL, "\r");
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
|
||||
#define GROUP_LENGTH 4
|
||||
#define BITS_PER_GROUP (GROUP_LENGTH * (BLOCK_SIZE + POLY_DEG))
|
||||
// Higher sample rate makes you more synchronized so you stay at the 11.4 GPS (group per sec) but lesser sample rate gives a smaller amount of cpu usage
|
||||
#define RDS_SAMPLE_RATE 16625 // pira's m32 works at 361 khz, which is a ratio of 304, but this does a ratio of 14, while the m232 does a ratio of about 500
|
||||
#define SAMPLES_PER_BIT 14 // this would be your ratio
|
||||
#define FILTER_SIZE 56
|
||||
#define RDS_SAMPLE_RATE 19000
|
||||
#define SAMPLES_PER_BIT 16
|
||||
#define FILTER_SIZE 32
|
||||
#define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE)
|
||||
|
||||
#define RT_LENGTH 64
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#define RDS_DEVICE "RDS"
|
||||
|
||||
#define NUM_MPX_FRAMES 512
|
||||
#define NUM_MPX_FRAMES 256
|
||||
|
||||
static uint8_t stop_rds;
|
||||
|
||||
@@ -34,7 +34,7 @@ static void *control_pipe_worker(void* modulator) {
|
||||
}
|
||||
|
||||
static void show_version() {
|
||||
printf("rds95 (a RDS encoder by radio95) version 1.2\n");
|
||||
printf("rds95 (a RDS encoder by radio95) version %.1f\n", VERSION);
|
||||
}
|
||||
|
||||
static void show_help(char *name) {
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
Released under the GNU GPL v3 license.
|
||||
*/
|
||||
|
||||
float waveform_biphase[56] = {0.001625489447084183, 0.0018145689052271319, 0.0005024534563098371, -0.001585786352611529, -0.002879473467708782, -0.0020438605658038567, 0.000835500801372735, 0.00390082480083076, 0.004531695189377238, 0.001311093111172612, -0.004343673377232293, -0.008325008325008265, -0.006278010462553496, 0.0027481739441221897, 0.013873333089300166, 0.01763827184078881, 0.005671482599529876, -0.021310188015785658, -0.04761904761904767, -0.04356053386843084, 0.024589602704327973, 0.17800990857960053, 0.4089809815715042, 0.6732730423553916, 0.8973021064512403, 1.0, 0.9222744610899845, 0.6523476952736391, 0.23572259472961843, -0.23572259472961843, -0.6523476952736391, -0.9222744610899845, -1.0, -0.8973021064512402, -0.6732730423553918, -0.4089809815715043, -0.17800990857960053, -0.024589602704327973, 0.04356053386843084, 0.04761904761904767, 0.02131018801578577, -0.005671482599529876, -0.01763827184078881, -0.013873333089300166, -0.0027481739441221897, 0.006278010462553496, 0.008325008325008376, 0.004343673377232404, -0.001311093111172501, -0.004531695189377238, -0.003900824800830649, -0.000835500801372846, 0.0020438605658037456, 0.002879473467708893, 0.00158578635261164, -0.000502453456309726};
|
||||
float waveform_biphase[32] = {0.017316017316017396, 0.015236086644829783, 0.0, -0.025132981969720025, -0.04761904761904756, -0.046927146866075575, 0.0, 0.11019845940569595, 0.2857142857142856, 0.5076664070057264, 0.7363107781851077, 0.9183204950474642, 1.0, 0.9428090415820631, 0.7363107781851077, 0.4040610178208841, 0.0, -0.4040610178208842, -0.7363107781851077, -0.9428090415820631, -1.0, -0.918320495047464, -0.7363107781851077, -0.5076664070057264, -0.2857142857142857, -0.11019845940569584, 0.0, 0.046927146866075464, 0.04761904761904745, 0.025132981969720136, 0.0, -0.015236086644829672};
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
Released under the GNU GPL v3 license.
|
||||
*/
|
||||
|
||||
extern float waveform_biphase[56];
|
||||
extern float waveform_biphase[32];
|
||||
|
||||
Reference in New Issue
Block a user