0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-27 04:43:52 +01:00

make rds louder and revert that

This commit is contained in:
2025-03-11 20:44:51 +01:00
parent 4e7b161e42
commit ca749bd1ad
4 changed files with 16 additions and 20 deletions

View File

@@ -2,9 +2,9 @@ import math
import io, os
import matplotlib.pyplot as plt
sample_rate = 4750
sample_rate = 9500
# next 2 funcs are modified from ChristopheJacquet's pydemod
# this is modified from ChristopheJacquet's pydemod
def rrcosfilter(NumSamples):
T_delta = 1/float(sample_rate)
sample_num = list(range(NumSamples))
@@ -53,16 +53,10 @@ outc.write(header)
outh.write(header)
def generate():
offset = int(sample_rate*0.004) # 190 khz = 760
count = int(offset / 10**(len(str(offset)) - 1)) # 760 / 100 = 7
l = int(sample_rate / 1187.5) // 2 # 16/2 = 8
if l == 1: raise Exception("Sample rate too small")
if count*l < 2*l:
# idk from where is this
offset *= 2
offset += 3
count *= 4
l *= 2
offset = int(sample_rate*0.004) # 190 khz = 760 760/10/2 = 38 190000/10/2=9500
count = int(offset / 10**(len(str(offset)) - 1)) # 760 / 100 = 7 38 / 10 = 3
l = int(sample_rate / 1187.5) // 2 # 16/2 = 8 8 / 2 = 4
if count*l > l*16: raise Exception("Sample rate too small")
print(f"{offset=} {count=} {l=}")
sample = [0.0] * (count*l)
@@ -75,16 +69,18 @@ def generate():
# Slice the array like numpy would
out = shapedSamples[offset-l*count:offset+l*count]
out = [i/(max(sf)+0.1) for i in out]
if max(out) > 1 or min(out) < -1: print("clipped")
plt.plot(sf, label="sf")
plt.plot(shapedSamples, label="shapedSamples")
# plt.plot(sf, label="sf")
# plt.plot(shapedSamples, label="shapedSamples")
plt.plot(out, label="out")
plt.legend()
plt.grid(True)
plt.show()
outc.write(u"float waveform_biphase[{size}] = {{{values}}};\n\n".format(
values = u", ".join(map(str, [val / 2.5 for val in out])),
values = u", ".join(map(str, out)),
size = len(out)))
# note: need to limit the amplitude so as not to saturate when the biphase
# waveforms are summed

View File

@@ -10,9 +10,9 @@
#define GROUP_LENGTH 4
#define BITS_PER_GROUP (GROUP_LENGTH * (BLOCK_SIZE + POLY_DEG))
#define RDS_SAMPLE_RATE 4750
#define SAMPLES_PER_BIT 4
#define FILTER_SIZE 32
#define RDS_SAMPLE_RATE 9500
#define SAMPLES_PER_BIT 8
#define FILTER_SIZE 24
#define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE)
/* Text items

View File

@@ -6,5 +6,5 @@
Released under the GNU GPL v3 license.
*/
float waveform_biphase[32] = {0.00048792898537812, -0.0006259889636969852, 0.0008222549152560989, -0.0011115066443382834, 0.0015573307379464962, -0.0022850785947540293, 0.0035676349628880324, -0.006086822099947743, 0.011939535657589805, -0.030391545310228592, 0.16462087043040483, 0.5173798784955582, 0.1552139635486674, 0.0, -0.1552139635486674, -0.5173798784955582, -0.16462087043040483, 0.030391545310228592, -0.011939535657589805, 0.006086822099947743, -0.0035676349628880324, 0.0022850785947540293, -0.0015573307379464962, 0.0011115066443382834, -0.0008222549152560989, 0.0006259889636969852, -0.00048792898537812, 0.0003878864829215714, -0.0003135635627245806, 0.00025716303373497773, -0.00021357134703021155, 0.00017933642000528266};
float waveform_biphase[24] = {0.00461068279303888, -1.1797407833720696e-17, -0.008233362130426566, 5.1112771849830444e-17, 0.017125393231287256, -3.975331531625189e-17, -0.047094831386039954, -2.1301970095005356e-17, 0.28256898831623967, 0.7282050708733819, 0.9889914591068393, 0.7282050708733819, 0.0, -0.7282050708733819, -0.9889914591068393, -0.7282050708733819, -0.28256898831623967, 2.1301970095005356e-17, 0.047094831386039954, 3.975331531625189e-17, -0.017125393231287256, -5.1112771849830444e-17, 0.008233362130426566, 1.1797407833720696e-17};

View File

@@ -6,4 +6,4 @@
Released under the GNU GPL v3 license.
*/
extern float waveform_biphase[32];
extern float waveform_biphase[24];