C-Netz: Add hack to increase voice deviation for some newer phone
This commit is contained in:
parent
3a7388ba7f
commit
e484814c0a
|
@ -33,6 +33,8 @@
|
||||||
#include "telegramm.h"
|
#include "telegramm.h"
|
||||||
#include "dsp.h"
|
#include "dsp.h"
|
||||||
|
|
||||||
|
extern int voice_deviation;
|
||||||
|
|
||||||
/* test function to mirror received audio from ratio back to radio */
|
/* test function to mirror received audio from ratio back to radio */
|
||||||
//#define TEST_SCRAMBLE
|
//#define TEST_SCRAMBLE
|
||||||
/* test the audio quality after cascading two scramblers (TEST_SCRAMBLE must be defined) */
|
/* test the audio quality after cascading two scramblers (TEST_SCRAMBLE must be defined) */
|
||||||
|
@ -721,6 +723,18 @@ again:
|
||||||
/* pre-emphasis is only used when scrambler is off, see FTZ 171 TR 60 Clause 4 */
|
/* pre-emphasis is only used when scrambler is off, see FTZ 171 TR 60 Clause 4 */
|
||||||
if (cnetz->pre_emphasis && !cnetz->scrambler)
|
if (cnetz->pre_emphasis && !cnetz->scrambler)
|
||||||
pre_emphasis(&cnetz->estate, speech_buffer, speech_length);
|
pre_emphasis(&cnetz->estate, speech_buffer, speech_length);
|
||||||
|
/* change level */
|
||||||
|
if (voice_deviation != 1) {
|
||||||
|
int sample, j;
|
||||||
|
for (j = 0; j < speech_length; j++) {
|
||||||
|
sample = speech_buffer[j] * voice_deviation;
|
||||||
|
if (sample > 32767)
|
||||||
|
sample = 32767;
|
||||||
|
if (sample < -32768)
|
||||||
|
sample = -32768;
|
||||||
|
speech_buffer[j] = sample;
|
||||||
|
}
|
||||||
|
}
|
||||||
speech_pos = 0;
|
speech_pos = 0;
|
||||||
}
|
}
|
||||||
/* copy speech as long as we have something left in buffer */
|
/* copy speech as long as we have something left in buffer */
|
||||||
|
@ -791,7 +805,8 @@ void unshrink_speech(cnetz_t *cnetz, int16_t *speech_buffer, int count)
|
||||||
y_last = cnetz->offset_y_last;
|
y_last = cnetz->offset_y_last;
|
||||||
factor = cnetz->offset_factor;
|
factor = cnetz->offset_factor;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
x = (double)speech_buffer[i];
|
/* change level */
|
||||||
|
x = (double)speech_buffer[i] / voice_deviation;
|
||||||
/* high-pass to remove low level frequencies, caused by level jump between audio chunks */
|
/* high-pass to remove low level frequencies, caused by level jump between audio chunks */
|
||||||
y = factor * (y_last + x - x_last);
|
y = factor * (y_last + x - x_last);
|
||||||
x_last = x;
|
x_last = x;
|
||||||
|
|
|
@ -49,6 +49,7 @@ const char *flip_polarity = "auto";
|
||||||
double noise = 0.0;
|
double noise = 0.0;
|
||||||
int ms_power = 0; /* 0..3 */
|
int ms_power = 0; /* 0..3 */
|
||||||
int auth = 0;
|
int auth = 0;
|
||||||
|
int voice_deviation = 1;
|
||||||
|
|
||||||
void print_help(const char *arg0)
|
void print_help(const char *arg0)
|
||||||
{
|
{
|
||||||
|
@ -79,6 +80,9 @@ void print_help(const char *arg0)
|
||||||
printf(" Enable authentication on the base station. Since we cannot\n");
|
printf(" Enable authentication on the base station. Since we cannot\n");
|
||||||
printf(" authenticate, because we don't know the secret key and the algorithm,\n");
|
printf(" authenticate, because we don't know the secret key and the algorithm,\n");
|
||||||
printf(" we just accept any card. With this we get the vendor IDs of the phone.\n");
|
printf(" we just accept any card. With this we get the vendor IDs of the phone.\n");
|
||||||
|
printf(" -V --voice-deviation\n");
|
||||||
|
printf(" For some unknown reason, Siemens C5 use double deviation for voice.\n");
|
||||||
|
printf(" This option raises audio level on TX and lowers on RX.\n");
|
||||||
printf("\nstation-id: Give 7 digit station-id, you don't need to enter it for every\n");
|
printf("\nstation-id: Give 7 digit station-id, you don't need to enter it for every\n");
|
||||||
printf(" start of this program.\n");
|
printf(" start of this program.\n");
|
||||||
printf("\nPress 'i' key for dumping currently attached subscribers.\n");
|
printf("\nPress 'i' key for dumping currently attached subscribers.\n");
|
||||||
|
@ -98,10 +102,11 @@ static int handle_options(int argc, char **argv)
|
||||||
{"noise", 1, 0, 'N'},
|
{"noise", 1, 0, 'N'},
|
||||||
{"ms-power", 1, 0, 'P'},
|
{"ms-power", 1, 0, 'P'},
|
||||||
{"authentication", 0, 0, 'A'},
|
{"authentication", 0, 0, 'A'},
|
||||||
|
{"voice-deviation", 0, 0, 'V'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
set_options_common("t:MS:F:N:P:A", long_options_special);
|
set_options_common("t:MS:F:N:P:AV", long_options_special);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int option_index = 0, c;
|
int option_index = 0, c;
|
||||||
|
@ -169,6 +174,10 @@ static int handle_options(int argc, char **argv)
|
||||||
auth = 1;
|
auth = 1;
|
||||||
skip_args += 1;
|
skip_args += 1;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
voice_deviation = 2;
|
||||||
|
skip_args += 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
opt_switch_common(c, argv[0], &skip_args);
|
opt_switch_common(c, argv[0], &skip_args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue