Default Smoothing Off; Upsample 8k Audio to 48k;

This commit is contained in:
lwvmobile 2022-12-26 09:37:37 -05:00
parent c02d7c0ba0
commit eeb6924369
2 changed files with 56 additions and 76 deletions

View File

@ -518,7 +518,7 @@ initState (dsd_state * state)
state->repeat = 0;
//Upsampled Audio Smoothing
state->audio_smoothing = 1;
state->audio_smoothing = 0;
state->audio_out_buf = malloc (sizeof (short) * 1000000);
state->audio_out_bufR = malloc (sizeof (short) * 1000000);
@ -964,8 +964,8 @@ usage ()
printf (" P25 - 7000; NXDN48 - 4000; DMR - 7000; EDACS/PV - 12500; May vary based on system stregnth, etc.\n");
printf (" -t <secs> Set Trunking VC/sync loss hangtime in seconds. (default = 1 second)\n");
printf (" -q Reverse Mute - Mute Unencrypted Voice and Unmute Encrypted Voice\n");
printf (" -V Disable Audio Smoothing on Upsampled Audio (XDMA and DMR Stereo 24k/2 output) (Capital V)\n");
printf (" (Audio Smoothing is now disabled on rtl, tcp, bin, and wav inputs by default -- fix crackle/buzz bug)\n");
printf (" -V Enable Audio Smoothing on Upsampled Audio (XDMA and DMR Stereo 24k/2 output) (Capital V)\n");
printf (" (Audio Smoothing is now disabled on all upsampled output by default -- fix crackle/buzz bug)\n");
printf ("\n");
exit (0);
}
@ -976,11 +976,11 @@ liveScanner (dsd_opts * opts, dsd_state * state)
if (opts->audio_in_type == 1)
{
opts->pulse_digi_rate_out = 8000; //revert to 8K/1 for STDIN input, sometimes crackles when upsampling
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
if (opts->dmr_stereo == 1)
{
opts->pulse_digi_rate_out = 24000; //stdin needs 24000 by 2 channel for DMR TDMA Stereo output
opts->pulse_digi_rate_out = 24000;
opts->pulse_digi_out_channels = 2;
fprintf (stderr, "STDIN Audio Rate Out set to 24000 Khz/2 Channel \n");
}
@ -995,7 +995,7 @@ if (opts->audio_in_type == 1)
{
//still need this section mostly due the the crackling on the rtl dongle when upsampled
//probably need to dig a little deeper, maybe inlvl releated?
opts->pulse_digi_rate_out = 8000; //revert to 8K/1 for RTL input, random crackling otherwise
opts->pulse_digi_rate_out = 48000; //revert to 8K/1 for RTL input, random crackling otherwise
opts->pulse_digi_out_channels = 1;
if (opts->dmr_stereo == 1)
{
@ -1195,10 +1195,10 @@ main (int argc, char **argv)
//Disabled the Serial Port Dev and Baud Rate, etc, If somebody uses that function, sorry...
//Disable Audio Smoothing for Upsampled Audio
//Enable Audio Smoothing for Upsampled Audio
case '0':
case 'V':
state.audio_smoothing = 0;
state.audio_smoothing = 1;
break;
//Trunking - Use Group List as Allow List
@ -1561,7 +1561,7 @@ main (int argc, char **argv)
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.frame_ysf = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 1;
@ -1581,7 +1581,7 @@ main (int argc, char **argv)
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.frame_ysf = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
state.dmr_stereo = 0;
@ -1602,7 +1602,7 @@ main (int argc, char **argv)
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.frame_ysf = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 0;
@ -1628,7 +1628,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 1;
state.rf_mod = 2;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 0;
@ -1658,7 +1658,7 @@ main (int argc, char **argv)
state.rf_mod = 0; //
opts.dmr_stereo = 0;
opts.dmr_mono = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.setmod_bw = 7000;
sprintf (opts.output_name, "P25P1");
@ -1682,7 +1682,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 0;
state.rf_mod = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
state.dmr_stereo = 0;
@ -1711,7 +1711,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 0;
state.rf_mod = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
state.dmr_stereo = 0;
@ -1814,7 +1814,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 0;
state.rf_mod = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 0;
@ -1839,7 +1839,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 0; //
state.rf_mod = 0; //
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_mono = 1;
opts.dmr_stereo = 0;
@ -1889,7 +1889,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 0;
state.rf_mod = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 0;
@ -2006,7 +2006,7 @@ main (int argc, char **argv)
opts.playfiles = 1;
opts.errorbars = 0;
opts.datascope = 0;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
state.dmr_stereo = 0;
@ -2249,7 +2249,7 @@ main (int argc, char **argv)
if (opts.playfiles == 1)
{
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_out_channels = 1;
openPulseOutput(&opts); //need to open it up for output
playMbeFiles (&opts, &state, argc, argv);

View File

@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------------
* dsd_ncurses.c
* A dsd ncurses terminal printer with menu system
* DSD-FME ncurses terminal printer with menu system
*
* ASCII art generated by:
* https://fsymbols.com/generators/carty/
@ -8,22 +8,6 @@
* LWVMOBILE
* 2022-08 DSD-FME Florida Man Edition
*-----------------------------------------------------------------------------*/
/*
* Copyright (C) 2010 DSD Author
* GPG Key ID: 0x3F1D7FD0 (74EF 430D F7F2 0A48 FCE6 F630 FAA2 635D 3F1D 7FD0)
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "dsd.h"
#include "git_ver.h"
@ -67,15 +51,15 @@ unsigned long long int call_matrix[33][6];
char * FM_bannerN[9] = {
" Press 'q' to quit ESC or Arrow Keys For Menu ",
" ██████╗ ██████╗██████╗  ███████╗███╗ ███╗███████╗ ",
" ██╔══██╗██╔════╝██╔══██╗   ██╔════╝████╗ ████║██╔════╝ ",
" ██║ ██║╚█████╗ ██║ ██║   █████╗ ██╔████╔██║█████╗ ",
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗ ",
" ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ",
" ",
" "
" Press 'q' to quit ESC or Arrow Keys For Menu ",
" ██████╗ ██████╗██████╗  ███████╗███╗ ███╗███████╗ ",
" ██╔══██╗██╔════╝██╔══██╗   ██╔════╝████╗ ████║██╔════╝ ",
" ██║ ██║╚█████╗ ██║ ██║   █████╗ ██╔████╔██║█████╗ ",
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗ ",
" ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ",
" ",
" "
};
@ -137,14 +121,14 @@ char * DMRBusrtTypes[32] = {
"IDLE ",
"R1_D ",
"ERR ",
"DUID ERR ",
"R-S ERR ",
"CRC ERR ",
"NULL ",
"Voice ", //Using 16 for Voice since its higher than possible value in DMR
" ", //17 is assigned on start up
"INIT ",
"INIT ",//expanded to include P1/2 signalling
"DUID ERR ",
"R-S ERR ",
"CRC ERR ",
"NULL ",
"Voice ",
" ",
"INIT ",
"INIT ",
"MAC PTT", //20
"MAC ACTIVE", //21
"MAC HANGTIME", //22
@ -1078,7 +1062,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 1;
opts->frame_x2tdma = 1;
@ -1108,7 +1092,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@ -1136,7 +1120,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 1;
opts->frame_x2tdma = 0;
@ -1169,7 +1153,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@ -1229,7 +1213,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 1;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@ -1256,7 +1240,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@ -1286,7 +1270,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@ -1313,7 +1297,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@ -1979,21 +1963,17 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
if (opts->ncurses_compact == 0)
{
attron(COLOR_PAIR(6)); //6
for (short int i = 0; i < 7; i++)
attron(COLOR_PAIR(6));
for (short int i = 1; i < 7; i++)
{
printw("%s \n", FM_bannerN[i]);
printw("%s", FM_bannerN[i]);
if (i == 1) printw (" ESC to Menu");
if (i == 2) printw (" 'q' to Quit ");
if (i == 5) printw (" MBElib %s", versionstr);
if (i == 6) printw (" %s \n", GIT_TAG);
else printw ("\n");
}
//printw (" https://github.com/lwvmobile/dsd-fme/tree/pulseaudio\n");
printw (" DEV BUILD - May contain changes and broken features\n");
printw (" Github Build Version: %s \n", GIT_TAG);
attroff(COLOR_PAIR(6)); //6
// printw ("--Build Info------------------------------------------------------------------\n");
// printw ("| https://github.com/lwvmobile/dsd-fme/tree/pulseaudio\n"); //http link
// printw ("| Digital Speech Decoder: Florida Man Edition\n");
// printw ("| Github Build Version: %s \n", GIT_TAG);
// printw ("| MBElib version %s\n", versionstr);
// printw ("------------------------------------------------------------------------------\n");
attron(COLOR_PAIR(4));
}
@ -2033,8 +2013,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_out_type == 0)
{
printw ("| Pulse Audio Output: [%2i] kHz [%i] Channel", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels);
if (state->audio_smoothing == 1 && opts->pulse_digi_rate_out != 8000) printw (" Smoothing On");
if (state->audio_smoothing == 0 && opts->pulse_digi_rate_out != 8000) printw (" Smoothing Off");
if (state->audio_smoothing == 1) printw (" - Smoothing On");
printw (" \n");
}
if (opts->monitor_input_audio == 1)
@ -2083,6 +2062,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
{
attron(COLOR_PAIR(3));
level = (int) state->max / 164; //only update on carrier present
if (opts->mod_qpsk == 1) (int) state->max / (164*2); //test values here
reset = 1;
}
if (state->carrier == 0 && opts->reset_state == 1 && reset == 1)