Rename dbm0 (level) to speech (level)

In mobile communications we use speech level instead of milliwatts.
The deviation (FM) is always based on speech level, not on 1 milliwatt.
pull/1/head
Andreas Eversberg 3 years ago
parent c3da4a77d4
commit c2f14834e5
  1. 18
      src/amps/dsp.c
  2. 20
      src/anetz/dsp.c
  3. 34
      src/bnetz/dsp.c
  4. 4
      src/cnetz/cnetz.c
  5. 2
      src/cnetz/cnetz.h
  6. 8
      src/cnetz/dsp.c
  7. 2
      src/cnetz/dsp.h
  8. 8
      src/cnetz/main.c
  9. 22
      src/imts/dsp.c
  10. 22
      src/jolly/dsp.c
  11. 15
      src/libmobile/sender.c
  12. 4
      src/libmobile/sender.h
  13. 22
      src/libsendevolumenregler/sendevolumenregler.c
  14. 4
      src/libsendevolumenregler/sendevolumenregler.h
  15. 14
      src/nmt/dsp.c
  16. 10
      src/r2000/dsp.c

@ -101,18 +101,18 @@
#define AMPS_MAX_DEVIATION 8000.0
#define AMPS_MAX_MODULATION 10000.0
#define AMPS_DBM0_DEVIATION 2900.0 /* deviation of dBm0 at 1 kHz */
#define AMPS_FSK_DEVIATION (8000.0 / AMPS_DBM0_DEVIATION) /* no emphasis */
#define AMPS_SAT_DEVIATION (2000.0 / AMPS_DBM0_DEVIATION) /* no emphasis */
#define AMPS_MAX_DISPLAY (10000.0 / AMPS_DBM0_DEVIATION) /* no emphasis */
#define AMPS_SPEECH_DEVIATION 2900.0 /* deviation of speech at 1 kHz */
#define AMPS_FSK_DEVIATION (8000.0 / AMPS_SPEECH_DEVIATION) /* no emphasis */
#define AMPS_SAT_DEVIATION (2000.0 / AMPS_SPEECH_DEVIATION) /* no emphasis */
#define AMPS_MAX_DISPLAY (10000.0 / AMPS_SPEECH_DEVIATION) /* no emphasis */
#define AMPS_BITRATE 10000
/* for some reason, 4000 Hz deviation works better */
#define TACS_DBM0_DEVIATION 4000.0 /* 2300 Hz deviation at 1 kHz (according to panasonic manual) */
#define TACS_SPEECH_DEVIATION 4000.0 /* 2300 Hz deviation at 1 kHz (according to panasonic manual) */
#define TACS_MAX_DEVIATION 6400.0 /* (according to texas instruments and other sources) */
#define TACS_MAX_MODULATION 9500.0 /* (according to panasonic manual) */
#define TACS_FSK_DEVIATION (6400.0 / TACS_DBM0_DEVIATION) /* no emphasis */
#define TACS_SAT_DEVIATION (1700.0 / TACS_DBM0_DEVIATION) /* no emphasis (panasonic / TI) */
#define TACS_MAX_DISPLAY (8000.0 / TACS_DBM0_DEVIATION) /* no emphasis */
#define TACS_FSK_DEVIATION (6400.0 / TACS_SPEECH_DEVIATION) /* no emphasis */
#define TACS_SAT_DEVIATION (1700.0 / TACS_SPEECH_DEVIATION) /* no emphasis (panasonic / TI) */
#define TACS_MAX_DISPLAY (8000.0 / TACS_SPEECH_DEVIATION) /* no emphasis */
#define TACS_BITRATE 8000
#define SAT_DURATION 0.05 /* duration of SAT signal measurement */
#define SAT_QUALITY 0.85 /* quality needed to detect SAT signal */
@ -202,7 +202,7 @@ int dsp_init_sender(amps_t *amps, int tolerant)
sender_set_fm(&amps->sender,
(!tacs) ? AMPS_MAX_DEVIATION : TACS_MAX_DEVIATION,
(!tacs) ? AMPS_MAX_MODULATION : TACS_MAX_MODULATION,
(!tacs) ? AMPS_DBM0_DEVIATION : TACS_DBM0_DEVIATION,
(!tacs) ? AMPS_SPEECH_DEVIATION : TACS_SPEECH_DEVIATION,
(!tacs) ? AMPS_MAX_DISPLAY : TACS_MAX_DISPLAY);
if (amps->sender.samplerate < 96000) {

@ -35,15 +35,15 @@
#define PI 3.1415927
/* signaling */
#define MAX_DEVIATION 15000.0
#define MAX_MODULATION 4000.0
#define DBM0_DEVIATION 10500.0 /* deviation of dBm0 at 1 kHz */
#define TX_PEAK_TONE (10500.0 / DBM0_DEVIATION) /* 10.5 kHz, no emphasis */
#define TX_PEAK_PAGE (15000.0 / DBM0_DEVIATION) /* 15 kHz, no emphasis */
#define MAX_DISPLAY (15000.0 / DBM0_DEVIATION) /* 15 kHz, no emphasis */
#define CHUNK_DURATION 0.010 /* 10 ms */
#define TONE_THRESHOLD 0.05
#define QUAL_THRESHOLD 0.5
#define MAX_DEVIATION 15000.0
#define MAX_MODULATION 4000.0
#define SPEECH_DEVIATION 10500.0 /* deviation of speech at 1 kHz */
#define TX_PEAK_TONE (10500.0 / SPEECH_DEVIATION) /* 10.5 kHz, no emphasis */
#define TX_PEAK_PAGE (15000.0 / SPEECH_DEVIATION) /* 15 kHz, no emphasis */
#define MAX_DISPLAY (15000.0 / SPEECH_DEVIATION) /* 15 kHz, no emphasis */
#define CHUNK_DURATION 0.010 /* 10 ms */
#define TONE_THRESHOLD 0.05
#define QUAL_THRESHOLD 0.5
// FIXME: how long until we detect a tone?
#define TONE_DETECT_TH 8 /* chunk intervals to detect continuous tone */
@ -89,7 +89,7 @@ int dsp_init_sender(anetz_t *anetz, double page_gain, int page_sequence, double
squelch_init(&anetz->squelch, anetz->sender.kanal, squelch_db, MUTE_TIME, LOSS_TIME);
/* set modulation parameters */
sender_set_fm(&anetz->sender, MAX_DEVIATION * page_gain, MAX_MODULATION, DBM0_DEVIATION, MAX_DISPLAY);
sender_set_fm(&anetz->sender, MAX_DEVIATION * page_gain, MAX_MODULATION, SPEECH_DEVIATION, MAX_DISPLAY);
anetz->page_gain = page_gain;
anetz->page_sequence = page_sequence;

@ -37,25 +37,25 @@
*
* At 2000 Hz the deviation shall be 4 kHz, so with emphasis the deviation
* at 1000 Hz would be theoretically 2 kHz. This is factor 0.714 below
* 2.8 kHz deviation we want at dBm0.
* 2.8 kHz deviation we want at speech level.
*/
/* signaling */
#define MAX_DEVIATION 4000.0
#define MAX_MODULATION 3000.0
#define DBM0_DEVIATION 2800.0 /* deviation of dBm0 at 1 kHz */
#define TX_PEAK_FSK (4000.0 / 2000.0 * 1000.0 / DBM0_DEVIATION)
#define TX_PEAK_METER (2000.0 / 2900.0 * 1000.0 / DBM0_DEVIATION) /* FIXME: what is the metering pulse deviation??? we use half of the 4kHz deviation, so we can still use -6dB of the speech level */
#define DAMPEN_METER 0.5 /* use -6dB to dampen speech while sending metering pulse (according to FTZ 1727 Pfl 32 Clause 3.2.6.6.5) */
#define MAX_DISPLAY 1.4 /* something above dBm0 */
#define BIT_RATE 100.0
#define BIT_ADJUST 0.5 /* full adjustment on bit change */
#define F0 2070.0
#define F1 1950.0
#define METERING_HZ 2900 /* metering pulse frequency */
#define TONE_DETECT_CNT 7 /* 70 milliseconds to detect continuous tone */
#define TONE_LOST_CNT 14 /* we use twice of the detect time, so we bridge a loss of "TONE_DETECT_CNT duration" */
#define TONE_STDDEV_TH 0.2 /* threshold of bad quality (standard deviation) to reject tone */
#define MAX_DEVIATION 4000.0
#define MAX_MODULATION 3000.0
#define SPEECH_DEVIATION 2800.0 /* deviation of speech at 1 kHz */
#define TX_PEAK_FSK (4000.0 / 2000.0 * 1000.0 / SPEECH_DEVIATION)
#define TX_PEAK_METER (2000.0 / 2900.0 * 1000.0 / SPEECH_DEVIATION) /* FIXME: what is the metering pulse deviation??? we use half of the 4kHz deviation, so we can still use -6dB of the speech level */
#define DAMPEN_METER 0.5 /* use -6dB to dampen speech while sending metering pulse (according to FTZ 1727 Pfl 32 Clause 3.2.6.6.5) */
#define MAX_DISPLAY 1.4 /* something above speech level */
#define BIT_RATE 100.0
#define BIT_ADJUST 0.5 /* full adjustment on bit change */
#define F0 2070.0
#define F1 1950.0
#define METERING_HZ 2900 /* metering pulse frequency */
#define TONE_DETECT_CNT 7 /* 70 milliseconds to detect continuous tone */
#define TONE_LOST_CNT 14 /* we use twice of the detect time, so we bridge a loss of "TONE_DETECT_CNT duration" */
#define TONE_STDDEV_TH 0.2 /* threshold of bad quality (standard deviation) to reject tone */
/* carrier loss detection */
#define MUTE_TIME 0.1 /* time to mute after loosing signal */
@ -91,7 +91,7 @@ int dsp_init_sender(bnetz_t *bnetz, double squelch_db)
squelch_init(&bnetz->squelch, bnetz->sender.kanal, squelch_db, MUTE_TIME, LOSS_TIME);
/* set modulation parameters */
sender_set_fm(&bnetz->sender, MAX_DEVIATION, MAX_MODULATION, DBM0_DEVIATION, MAX_DISPLAY);
sender_set_fm(&bnetz->sender, MAX_DEVIATION, MAX_MODULATION, SPEECH_DEVIATION, MAX_DISPLAY);
PDEBUG(DDSP, DEBUG_DEBUG, "Using FSK level of %.3f (%.3f KHz deviation @ 2000 Hz)\n", TX_PEAK_FSK, 4.0);

@ -247,7 +247,7 @@ int cnetz_init(void)
}
/* Create transceiver instance and link to a list. */
int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double speech_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
{
sender_t *sender;
cnetz_t *cnetz;
@ -321,7 +321,7 @@ int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *
#endif
/* init audio processing */
rc = dsp_init_sender(cnetz, measure_speed, clock_speed, demod, dbm0_deviation);
rc = dsp_init_sender(cnetz, measure_speed, clock_speed, demod, speech_deviation);
if (rc < 0) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to init signal processing!\n");
goto error;

@ -138,7 +138,7 @@ int cnetz_channel_by_short_name(const char *short_name);
const char *chan_type_short_name(enum cnetz_chan_type chan_type);
const char *chan_type_long_name(enum cnetz_chan_type chan_type);
int cnetz_init(void);
int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback);
int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double speech_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback);
void cnetz_destroy(sender_t *sender);
void cnetz_go_idle(cnetz_t *cnetz);
void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts);

@ -42,8 +42,8 @@
#define MAX_DEVIATION 4000.0
#define MAX_MODULATION 3000.0
#define FSK_DEVIATION (2500.0 / dbm0_deviation) /* no emphasis */
#define MAX_DISPLAY 1.4 /* something above dBm0, no emphasis */
#define FSK_DEVIATION (2500.0 / speech_deviation) /* no emphasis */
#define MAX_DISPLAY 1.4 /* something above speech level, no emphasis */
#define BITRATE 5280.0 /* bits per second */
#define BLOCK_BITS 198 /* duration of one time slot including pause at beginning and end */
#define CUT_OFF_OFFSET 300.0 /* cut off frequency for offset filter (level correction between subsequent audio chunks) */
@ -80,7 +80,7 @@ static void dsp_init_ramp(cnetz_t *cnetz)
}
/* Init transceiver instance. */
int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod, double dbm0_deviation)
int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod, double speech_deviation)
{
int rc = 0;
double size;
@ -89,7 +89,7 @@ int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], en
PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Init FSK for 'Sender'.\n");
/* set modulation parameters */
sender_set_fm(&cnetz->sender, MAX_DEVIATION, MAX_MODULATION, dbm0_deviation, MAX_DISPLAY);
sender_set_fm(&cnetz->sender, MAX_DEVIATION, MAX_MODULATION, speech_deviation, MAX_DISPLAY);
if (measure_speed) {
cnetz->measure_speed = measure_speed;

@ -1,6 +1,6 @@
void dsp_init(void);
int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod, double dbm0_deviation);
int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod, double speech_deviation);
void dsp_cleanup_sender(cnetz_t *cnetz);
void calc_clock_speed(cnetz_t *cnetz, double samples, int tx, int result);
void unshrink_speech(cnetz_t *cnetz, sample_t *speech_buffer, int count);

@ -73,7 +73,7 @@ int8_t futln_sperre_start = -1; /* no blocking */
int8_t futln_sperre_end = -1; /* no range */
enum demod_type demod = FSK_DEMOD_AUTO;
int metering = 20;
double dbm0_deviation = 4000.0; /* best results with all my equipment */
double speech_deviation = 4000.0; /* best results with all my equipment */
void print_help(const char *arg0)
{
@ -118,7 +118,7 @@ void print_help(const char *arg0)
printf(" -V --voice-deviation <2400..4000 Hz>\n");
printf(" It is unclear what the actual voice deviation is. Please decrease, if\n");
printf(" mobile's microphone is too loud and speaker is too quiet.\n");
printf(" (default = %.0f)\n", dbm0_deviation);
printf(" (default = %.0f)\n", speech_deviation);
printf(" -S --sysinfo fuz-nat=<nat>\n");
printf(" Set country ID of base station. All IDs were used inside Germany only.\n");
printf(" (default = %d)\n", fuz_nat);
@ -327,7 +327,7 @@ static int handle_options(int short_option, int argi, char **argv)
metering = atoi(argv[argi]);
break;
case 'V':
dbm0_deviation = atoi_limit(argv[argi], 2400, 4000);
speech_deviation = atoi_limit(argv[argi], 2400, 4000);
break;
case 'S':
p = strchr(argv[argi], '=');
@ -621,7 +621,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
rc = cnetz_create(kanal[i], chan_type[i], audiodev[i], use_sdr, demod, samplerate, rx_gain, challenge_valid, challenge, response_valid, response, warteschlange, metering, dbm0_deviation, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);
rc = cnetz_create(kanal[i], chan_type[i], audiodev[i], use_sdr, demod, samplerate, rx_gain, challenge_valid, challenge, response_valid, response, warteschlange, metering, speech_deviation, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;

@ -38,22 +38,22 @@
#define PI 3.1415927
/* signaling */
#define MAX_DEVIATION 7000.0 /* signaling tone plus some extra to calibrate */
#define MAX_MODULATION 3000.0 /* FIXME */
#define DBM0_DEVIATION 2500.0 /* deviation of dBm0 (with emphasis) */
#define TX_PEAK_TONE (5000.0 / DBM0_DEVIATION) /* signaling tone level (5khz, no emphasis) */
#define RX_MIN_AMPL 0.25 /* FIXME: Minimum level to detect tone */
#define MAX_DEVIATION 7000.0 /* signaling tone plus some extra to calibrate */
#define MAX_MODULATION 3000.0 /* FIXME */
#define SPEECH_DEVIATION 2500.0 /* deviation of speech (with emphasis) */
#define TX_PEAK_TONE (5000.0 / SPEECH_DEVIATION) /* signaling tone level (5khz, no emphasis) */
#define RX_MIN_AMPL 0.25 /* FIXME: Minimum level to detect tone */
/* Note that 75 is half of the distance between two tones (2000 and 2150 Hz)
* An error of more than 50 causes too much toggeling between two tones,
* less would take too long to detect the tone and maybe not detect it, if
* it is too far off the expected frequency.
*/
#define RX_MIN_FREQ 50.0 /* minimum frequency error to detect tone */
#define MAX_DISPLAY (MAX_DEVIATION / DBM0_DEVIATION)/* as much as MAX_DEVIATION */
#define RX_MIN_FREQ 50.0 /* minimum frequency error to detect tone */
#define MAX_DISPLAY (MAX_DEVIATION / SPEECH_DEVIATION)/* as much as MAX_DEVIATION */
/* Note that FILTER_BW / SUSTAIN and QUAL_TIME sum up and should not exeed minimum tone length */
#define RX_FILTER_BW 100.0 /* amplitude filter (causes delay) */
#define RX_SUSTAIN 0.010 /* how long a tone must sustain until detected (causes delay) */
#define RX_QUAL_TIME 0.005 /* how long a quality measurement lasts after detecting a tone */
#define RX_FILTER_BW 100.0 /* amplitude filter (causes delay) */
#define RX_SUSTAIN 0.010 /* how long a tone must sustain until detected (causes delay) */
#define RX_QUAL_TIME 0.005 /* how long a quality measurement lasts after detecting a tone */
/* carrier loss detection */
#define MUTE_TIME 0.1 /* time to mute after loosing signal */
@ -131,7 +131,7 @@ int dsp_init_transceiver(imts_t *imts, double squelch_db, int ptt)
squelch_init(&imts->squelch, imts->sender.kanal, squelch_db, MUTE_TIME, LOSS_TIME);
/* set modulation parameters */
sender_set_fm(&imts->sender, MAX_DEVIATION, MAX_MODULATION, DBM0_DEVIATION, MAX_DISPLAY);
sender_set_fm(&imts->sender, MAX_DEVIATION, MAX_MODULATION, SPEECH_DEVIATION, MAX_DISPLAY);
/* init FM demodulator for tone detection */
if (imts->mode == MODE_IMTS) {

@ -37,15 +37,15 @@
#define db2level(db) pow(10, (double)db / 20.0)
/* transceiver parameters */
#define MAX_DEVIATION 5000.0 /* deviation of signal */
#define MAX_MODULATION 4000.0 /* frequency spectrum of signal */
#define DBM0_DEVIATION 3000.0 /* deviation of dBm0 at 1 kHz (generally used with 25 kHz channel spacing) */
#define MAX_DISPLAY 1.0 /* maximum level to display */
#define TX_INFO_TONE 1.0 /* Level of tone relative to dBm0 (each component) */
#define TX_ACK_TONE 0.1 /* Level of tone relative to dBm0 */
#define INFO_TONE_F1 640.0
#define INFO_TONE_F2 670.0
#define ACK_TONE 1000.0
#define MAX_DEVIATION 5000.0 /* deviation of signal */
#define MAX_MODULATION 4000.0 /* frequency spectrum of signal */
#define SPEECH_DEVIATION 3000.0 /* deviation of speech at 1 kHz (generally used with 25 kHz channel spacing) */
#define MAX_DISPLAY 1.0 /* maximum level to display */
#define TX_INFO_TONE 1.0 /* Level of tone relative to speech level (each component) */
#define TX_ACK_TONE 0.1 /* Level of tone relative to speech level */
#define INFO_TONE_F1 640.0
#define INFO_TONE_F2 670.0
#define ACK_TONE 1000.0
/* Squelch */
#define MUTE_TIME 0.1 /* Time until muting */
@ -83,9 +83,9 @@ int dsp_init_sender(jolly_t *jolly, int nbfm, double squelch_db, int repeater)
/* set modulation parameters (NBFM uses half channel spacing, so we use half deviation) */
if (nbfm)
sender_set_fm(&jolly->sender, MAX_DEVIATION / 2.0, MAX_MODULATION, DBM0_DEVIATION / 2.0, MAX_DISPLAY);
sender_set_fm(&jolly->sender, MAX_DEVIATION / 2.0, MAX_MODULATION, SPEECH_DEVIATION / 2.0, MAX_DISPLAY);
else
sender_set_fm(&jolly->sender, MAX_DEVIATION, MAX_MODULATION, DBM0_DEVIATION, MAX_DISPLAY);
sender_set_fm(&jolly->sender, MAX_DEVIATION, MAX_MODULATION, SPEECH_DEVIATION, MAX_DISPLAY);
/* init dtmf audio processing.
* each frequency may be +6 dB deviation, which means a total deviation of +12 dB is allowed for detection.

@ -281,15 +281,16 @@ void sender_destroy(sender_t *sender)
jitter_destroy(&sender->dejitter);
}
void sender_set_fm(sender_t *sender, double max_deviation, double max_modulation, double dBm0_deviation, double max_display)
/* set frequency modulation and parameters */
void sender_set_fm(sender_t *sender, double max_deviation, double max_modulation, double speech_deviation, double max_display)
{
sender->max_deviation = max_deviation;
sender->max_modulation = max_modulation;
sender->dBm0_deviation = dBm0_deviation;
sender->speech_deviation = speech_deviation;
sender->max_display = max_display;
PDEBUG_CHAN(DSENDER, DEBUG_DEBUG, "Maxium deviation: %.1f kHz, Maximum modulation: %.1f kHz\n", max_deviation / 1000.0, max_modulation / 1000.0);
PDEBUG_CHAN(DSENDER, DEBUG_DEBUG, "Deviation at dBm0 (audio level): %.1f kHz\n", dBm0_deviation / 1000.0);
PDEBUG_CHAN(DSENDER, DEBUG_DEBUG, "Deviation at speech level: %.1f kHz\n", speech_deviation / 1000.0);
}
static void gain_samples(sample_t *samples, int length, double gain)
@ -361,8 +362,8 @@ cant_recover:
/* do pre emphasis towards radio */
if (inst->pre_emphasis)
pre_emphasis(&inst->estate, samples[i], count);
/* normal level to frequency deviation of dBm0 */
gain_samples(samples[i], count, inst->dBm0_deviation);
/* normal level to frequency deviation of speech level */
gain_samples(samples[i], count, inst->speech_deviation);
/* set paging signal */
paging_signal[i] = inst->paging_signal;
on[i] = inst->paging_on;
@ -417,8 +418,8 @@ cant_recover:
/* loop through all channels */
for (i = 0, inst = sender; inst; i++, inst = inst->slave) {
/* frequency deviation of dBm0 to normal level */
gain_samples(samples[i], count, 1.0 / inst->dBm0_deviation);
/* frequency deviation of speech level to normal level */
gain_samples(samples[i], count, 1.0 / inst->speech_deviation);
/* rx gain */
if (inst->rx_gain != 1.0)
gain_samples(samples[i], count, inst->rx_gain);

@ -36,7 +36,7 @@ typedef struct sender {
/* fm levels */
double max_deviation; /* max frequency deviation */
double max_modulation; /* max frequency modulated */
double dBm0_deviation; /* deviation of 1000 Hz reference tone at dBm0 */
double speech_deviation; /* deviation of 1000 Hz reference tone at speech level */
double max_display; /* level of displaying wave form */
/* audio */
@ -92,7 +92,7 @@ extern int cant_recover;
int sender_create(sender_t *sender, const char *kanal, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, enum paging_signal paging_signal);
void sender_destroy(sender_t *sender);
void sender_set_fm(sender_t *sender, double max_deviation, double max_modulation, double dBm0_deviation, double max_display);
void sender_set_fm(sender_t *sender, double max_deviation, double max_modulation, double speech_deviation, double max_display);
int sender_open_audio(int latspl);
int sender_start_audio(void);
void process_sender_audio(sender_t *sender, int *quit, int latspl);

@ -38,22 +38,22 @@
/*
* Init function
*
* abwaerts_dbs = how many dB per second to lower the amplification, if input signal is above dBm0
* aufwaerts_dbs = how many dB per second to raise the amplification, if input signal is below dBm0
* maximum_db = limit of the output level above dBm0
* abwaerts_dbs = how many dB per second to lower the amplification, if input signal is above db0
* aufwaerts_dbs = how many dB per second to raise the amplification, if input signal is below db0
* maximum_db = limit of the output level above db0
* minimum_db = below this input level, the amplification is not raised, so it stays constant.
* dbm0_level = target level to be treated as 0 dB
* db0_level = target level to be treated as 0 dB
*
* Hopefully this is correct
*
*/
void init_sendevolumenregler(sendevolumenregler_t *state, double samplerate, double abwaerts_dbs, double aufwaerts_dbs, double maximum_db, double minimum_db, double dbm0_level)
void init_sendevolumenregler(sendevolumenregler_t *state, double samplerate, double abwaerts_dbs, double aufwaerts_dbs, double maximum_db, double minimum_db, double db0_level)
{
memset(state, 0, sizeof(*state));
state->peak = 1.0;
state->envelope = 1.0;
state->dbm0_level = dbm0_level;
state->db0_level = db0_level;
state->step_down = pow(db2level(abwaerts_dbs), 1.0 / samplerate);
state->step_up = pow(db2level(aufwaerts_dbs), 1.0 / samplerate);
state->maximum_level = db2level(maximum_db);
@ -72,10 +72,10 @@ void init_sendevolumenregler(sendevolumenregler_t *state, double samplerate, dou
*/
void sendevolumenregler(sendevolumenregler_t *state, sample_t *samples, int num)
{
double value, peak, envelope, step_up, step_down, maximum_level, minimum_level, dbm0_level;
double value, peak, envelope, step_up, step_down, maximum_level, minimum_level, db0_level;
int i;
dbm0_level = state->dbm0_level;
db0_level = state->db0_level;
step_up = state->step_up;
step_down = state->step_down;
maximum_level = state->maximum_level;
@ -84,8 +84,8 @@ void sendevolumenregler(sendevolumenregler_t *state, sample_t *samples, int num)
envelope = state->envelope;
for (i = 0; i < num; i++) {
/* normalize sample value to dbm0_level level */
value = *samples / dbm0_level;
/* normalize sample value to db0_level level */
value = *samples / db0_level;
/* 'peak' is the level that raises directly with the value
* level, but falls as specified by step_up. */
@ -106,7 +106,7 @@ void sendevolumenregler(sendevolumenregler_t *state, sample_t *samples, int num)
if (peak / envelope > maximum_level)
envelope = peak / maximum_level;
*samples++ = value / envelope * dbm0_level;
*samples++ = value / envelope * db0_level;
}
state->envelope = envelope;

@ -6,9 +6,9 @@ typedef struct sendevolumenregler {
double step_down;
double minimum_level;
double maximum_level;
double dbm0_level;
double db0_level;
} sendevolumenregler_t;
void init_sendevolumenregler(sendevolumenregler_t *state, double samplerate, double abwaerts_dbs, double aufwaerts_dbs, double maximum_db, double minimum_db, double dbm0_level);
void init_sendevolumenregler(sendevolumenregler_t *state, double samplerate, double abwaerts_dbs, double aufwaerts_dbs, double maximum_db, double minimum_db, double db0_level);
void sendevolumenregler(sendevolumenregler_t *state, sample_t *samples, int num);

@ -35,11 +35,11 @@
/* Notes on TX_PEAK_FSK level:
*
* This deviation is -2.2db below the dBm0 deviation.
* This deviation is -2.2db below the speech deviation.
*
* At 1800 Hz the deviation shall be 4.2 kHz, so with emphasis the deviation
* at 1000 Hz would be theoretically 2.333 kHz. This is factor 0.777 below
* 3 kHz deviation we want at dBm0.
* 3 kHz deviation we want at speech.
*/
/* Notes on TX_PEAK_SUPER (supervisory signal) level:
@ -54,14 +54,14 @@
/* signaling */
#define MAX_DEVIATION 4700.0
#define MAX_MODULATION 4055.0
#define DBM0_DEVIATION 3000.0 /* deviation of dBm0 at 1 kHz */
#define TX_PEAK_FSK (4200.0 / 1800.0 * 1000.0 / DBM0_DEVIATION)
#define TX_PEAK_SUPER (300.0 / 4015.0 * 1000.0 / DBM0_DEVIATION)
#define SPEECH_DEVIATION 3000.0 /* deviation of speech at 1 kHz */
#define TX_PEAK_FSK (4200.0 / 1800.0 * 1000.0 / SPEECH_DEVIATION)
#define TX_PEAK_SUPER (300.0 / 4015.0 * 1000.0 / SPEECH_DEVIATION)
#define BIT_RATE 1200.0
#define BIT_ADJUST 0.1 /* how much do we adjust bit clock on frequency change */
#define F0 1800.0
#define F1 1200.0
#define MAX_DISPLAY 1.4 /* something above dBm0 */
#define MAX_DISPLAY 1.4 /* something above speech level */
#define DIALTONE_HZ 425.0 /* dial tone frequency */
#define TX_PEAK_DIALTONE 1.0 /* dial tone peak FIXME: Not found in the specs! */
#define SUPER_DURATION 0.25 /* duration of supervisory signal measurement */
@ -114,7 +114,7 @@ int dsp_init_sender(nmt_t *nmt, double deviation_factor)
PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Init DSP for Transceiver.\n");
/* set modulation parameters */
sender_set_fm(&nmt->sender, MAX_DEVIATION * deviation_factor, MAX_MODULATION * deviation_factor, DBM0_DEVIATION * deviation_factor, MAX_DISPLAY);
sender_set_fm(&nmt->sender, MAX_DEVIATION * deviation_factor, MAX_MODULATION * deviation_factor, SPEECH_DEVIATION * deviation_factor, MAX_DISPLAY);
PDEBUG(DDSP, DEBUG_DEBUG, "Using FSK level of %.3f (%.3f KHz deviation @ 1500 Hz)\n", TX_PEAK_FSK * deviation_factor, 3.5 * deviation_factor);
PDEBUG(DDSP, DEBUG_DEBUG, "Using Supervisory level of %.3f (%.3f KHz deviation @ 4015 Hz)\n", TX_PEAK_SUPER * deviation_factor, 0.3 * deviation_factor);

@ -47,9 +47,9 @@
/* signaling */
#define MAX_DEVIATION 2500.0
#define MAX_MODULATION 2550.0
#define DBM0_DEVIATION 1500.0 /* deviation of dBm0 at 1 kHz */
#define TX_PEAK_FSK (1425.0 / 1500.0 * 1000.0 / DBM0_DEVIATION) /* with emphasis */
#define TX_PEAK_SUPER (300.0 / DBM0_DEVIATION) /* no emphasis */
#define SPEECH_DEVIATION 1500.0 /* deviation of speech at 1 kHz */
#define TX_PEAK_FSK (1425.0 / 1500.0 * 1000.0 / SPEECH_DEVIATION) /* with emphasis */
#define TX_PEAK_SUPER (300.0 / SPEECH_DEVIATION) /* no emphasis */
#define FSK_BIT_RATE 1200.0
#define FSK_BIT_ADJUST 0.1 /* how much do we adjust bit clock on frequency change */
#define FSK_F0 1800.0
@ -59,7 +59,7 @@
#define SUPER_F0 136.0
#define SUPER_F1 164.0
#define SUPER_CUTOFF_H 400.0 /* filter to remove spectrum of supervisory signal */
#define MAX_DISPLAY 1.4 /* something above dBm0 */
#define MAX_DISPLAY 1.4 /* something above speech level */
/* global init for FSK */
void dsp_init(void)
@ -80,7 +80,7 @@ int dsp_init_sender(r2000_t *r2000)
PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Init DSP for Transceiver.\n");
/* set modulation parameters */
sender_set_fm(&r2000->sender, MAX_DEVIATION, MAX_MODULATION, DBM0_DEVIATION, MAX_DISPLAY);
sender_set_fm(&r2000->sender, MAX_DEVIATION, MAX_MODULATION, SPEECH_DEVIATION, MAX_DISPLAY);
PDEBUG(DDSP, DEBUG_DEBUG, "Using FSK level of %.3f\n", TX_PEAK_FSK);

Loading…
Cancel
Save