diff --git a/src/pifmrds/fm_mpx.c b/src/pifmrds/fm_mpx.c index 52bc9b5..84a5858 100644 --- a/src/pifmrds/fm_mpx.c +++ b/src/pifmrds/fm_mpx.c @@ -48,7 +48,7 @@ float carrier_38[] = {0.0, 0.8660254037844386, 0.8660254037844388, 1.22464679914 float carrier_19[] = {0.0, 0.5, 0.8660254037844386, 1.0, 0.8660254037844388, 0.5, 1.2246467991473532e-16, -0.5, -0.8660254037844384, -1.0, -0.8660254037844386, -0.5}; -float carrier_3125[] = {0.0, 0.7586133425663026, 0.9885355334735083, 0.5295297022607088, -0.29851481100169425, -0.918519035014914, -0.898390981891979, -0.2521582503964708}; +float carrier_3125[] = {0.0, 0.7586133425663026, 0.9885355334735083, 0.5295297022607088, -0.29851481100169425, -0.918519035014914, -0.898390981891979, -0.2521582503964708}; // sine wave int phase_38 = 0; int phase_3125 = 0; @@ -292,7 +292,7 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, floa } } - //Add the gain + // Multiply by the gain out_left = out_left * gain; if(channels > 1) out_right = out_right * gain; @@ -342,7 +342,7 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, floa if(channels > 1) out_right = 0; } - out_left = limiter(out_left, limiter_threshold, 1); //chatgpt says that 0.8 is -1.9382 db, amplified a mp3 2000 times, without this it was fucking huge it took like a mhz but with this, about 20khz + out_left = limiter(out_left, limiter_threshold, 1); if( channels > 1 ) out_right = limiter(out_right, limiter_threshold, 1); out_left = clip(out_left, 1); //max is gonna be 1.0 (0 db), lowest is -1.0 (-inf db) @@ -364,8 +364,8 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, floa mpx_buffer[i] += 4.05*(out_left+out_right) + // Stereo sum signal (L+R) 4.05 * carrier_3125[phase_3125] * (out_left-out_right); // Stereo difference signal //NO PIOT TONE!!!!!!!!!!!!!!!!!!!!!!!!!!!! (its missplelled correctly probably just like misspelled) - phase_3125++; - if(phase_3125 >= 8) phase_3125 = 0; + phase_3125++; + if(phase_3125 >= 8) phase_3125 = 0; } } } else { diff --git a/src/pifmrds/pi_fm_rds.cpp b/src/pifmrds/pi_fm_rds.cpp index 09fe8d1..7aa6be6 100644 --- a/src/pifmrds/pi_fm_rds.cpp +++ b/src/pifmrds/pi_fm_rds.cpp @@ -178,7 +178,7 @@ int main(int argc, char **argv) { int enable_compressor = 1; float rds_volume = 1.0; float pilot_volume = 0.9; - float limiter_threshold = 0.8; + float limiter_threshold = 0.9; int log = 1; int ta = 0; int tp = 0; @@ -198,7 +198,7 @@ int main(int argc, char **argv) { int alternative_freq[100] = {}; int bypassfreqrange = 0; int ct = 1; - float cutofffreq = 16200; + float cutofffreq = 15000; // up to standart // Parse command-line arguments for(int i=1; itm_year - l) * 365.25) + (int)((utc->tm_mon + 2 + l*12) * 30.6001); - blocks[1] = 0x4400 | (mjd>>15); + blocks[1] = 0x4400 | rds_params.tp << 10 | rds_params.pty << 5 | (mjd>>15); blocks[2] = (mjd<<1) | (utc->tm_hour>>4); blocks[3] = (utc->tm_hour & 0xF)<<12 | utc->tm_min<<6; @@ -139,12 +139,12 @@ void get_rds_group(int *buffer, int stereo, int ct_clock_enabled) { //no idea ho if((ps_state == 3) && stereo) blocks[1] |= 0x0004; // DI Stereo, someone explain from where the 0004 comes from and what does "bit d0" mean? if(rds_params.af[0]) { // AF if(af_state == 0) { - blocks[2] = (rds_params.af[0] + 224) << 8 | rds_params.af[1]; + blocks[2] = (rds_params.af[0] + 224) << 8 | rds_params.af[1]; // Send number of AFs and the first AF } else { - if(rds_params.af[af_state+1]) { - blocks[2] = rds_params.af[af_state] << 8 | rds_params.af[af_state+1]; + if(rds_params.af[af_state+1]) { // If we have something next + blocks[2] = rds_params.af[af_state] << 8 | rds_params.af[af_state+1]; // We send this and the 2nd one } else { - blocks[2] = rds_params.af[af_state] << 8 | 0xCD; + blocks[2] = rds_params.af[af_state] << 8 | 0xCD; // No? then we just send this one } } af_state = af_state + 2; @@ -162,7 +162,7 @@ void get_rds_group(int *buffer, int stereo, int ct_clock_enabled) { //no idea ho } state++; - if(state >= 6) state = 0; + if(state >= 8) state = 0; } // Calculate the checkword for each block and emit the bits @@ -238,7 +238,6 @@ void get_rds_samples(float *buffer, int count, int stereo, int ct_clock_enabled, // modulate at 57 kHz - // use phase for this (we need something better than this, so i dont see transmitting on 95 mhz rds alone on 95.15 switch(phase) { case 0: case 2: sample = 0; break;