0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00

does this cause a segfault?

This commit is contained in:
2025-03-19 21:51:59 +01:00
parent 2161549e95
commit be46dd93d3
5 changed files with 19 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
{ {
"port": 13452, "port": 13452,
"time": 1742327656502, "time": 1742417504877,
"version": "0.0.3" "version": "0.0.3"
} }

View File

@@ -60,20 +60,29 @@ outc.write(header)
outh.write(header) outh.write(header)
def generate(): def generate():
offset = int(sample_rate*0.004)
count = int(offset / 10**(len(str(offset)) - 1))
l = int(sample_rate / 1187.5) // 2 l = int(sample_rate / 1187.5) // 2
if count*l > l*16: raise Exception("Sample rate too small")
print(f"{offset=} {count=} {l=}")
sample = [0.0] * (count*l) sample = [0.0] * (16*l)
sample[l] = 1 sample[l] = 1
sample[2*l] = -1 sample[2*l] = -1
sf = rrcosfilter(l*16) sf = rrcosfilter(l*16)
shapedSamples = convolve(sample, sf) shapedSamples = convolve(sample, sf)
lowest = 0
lowest_idx = 0
highest = 0
highest_idx = 0
for i,j in enumerate(shapedSamples):
if j < lowest:
lowest = j
lowest_idx = i
if j > highest:
highest = j
highest_idx = i
middle = int((lowest_idx+highest_idx)/2)
out = shapedSamples[offset-l*count:offset+l*count] out = shapedSamples[middle-int(ratio*2):middle+int(ratio*2)]
out = [2 * (i - min(out)) / (max(out) - min(out)) - 1 for i in out] 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") if max(out) > 1 or min(out) < -1: raise Exception("Clipped")

View File

@@ -13,7 +13,7 @@
// 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 // 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 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 SAMPLES_PER_BIT 14 // this would be your ratio
#define FILTER_SIZE 84 #define FILTER_SIZE 56
#define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE) #define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE)
#define RT_LENGTH 64 #define RT_LENGTH 64

View File

@@ -6,5 +6,5 @@
Released under the GNU GPL v3 license. Released under the GNU GPL v3 license.
*/ */
float waveform_biphase[84] = {0.0004798810307378165, 0.0005158464188224077, 0.00013719954366608889, -0.00041476999846934426, -0.0007191892775416653, -0.0004857966171196715, 0.00018825494724739045, 0.0008295842549825849, 0.0009051529485941678, 0.0002445671263298088, -0.000751794191973798, -0.0013268465280850128, -0.0009132708722269234, 0.0003610677822902808, 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, -0.0018145689052271319, -0.001625489447084072, -0.0003610677822902808, 0.0009132708722270344, 0.0013268465280849018, 0.000751794191973687, -0.0002445671263296978, -0.0009051529485940568, -0.0008295842549824739, -0.00018825494724750147, 0.0004857966171196715, 0.0007191892775417763, 0.00041476999846934426, -0.0001371995436661999}; 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};

View File

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