mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-20 12:45:40 -05:00
Fix Upsampling
Fix Upsampling --upsample audio on all input types to the proper output rate required for mono and stereo output. --Allows for 48000/1 or 24000/2 output when using RTL or STDIN input --MBE file playback still at 8000 due to random crackling when upscaled --WAV file still recorded at 8000 mono --MBE file saving and WAV saving disabled when using the -T Stereo TDMA option until both can be reworked.
This commit is contained in:
@@ -156,7 +156,8 @@ processAudio (dsd_opts * opts, dsd_state * state)
|
|||||||
|
|
||||||
// copy audio data to output buffer and upsample if necessary
|
// copy audio data to output buffer and upsample if necessary
|
||||||
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
|
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
|
||||||
if (opts->split == 0)
|
//the only time we don't want to upsample is when playing back MBE files, upsampling them seems to cause random crackling
|
||||||
|
if (opts->playfiles == 0) //opts->split == 0
|
||||||
{
|
{
|
||||||
for (n = 0; n < 160; n++)
|
for (n = 0; n < 160; n++)
|
||||||
{
|
{
|
||||||
@@ -295,7 +296,8 @@ processAudioR (dsd_opts * opts, dsd_state * state)
|
|||||||
|
|
||||||
// copy audio data to output buffer and upsample if necessary
|
// copy audio data to output buffer and upsample if necessary
|
||||||
state->audio_out_temp_buf_pR = state->audio_out_temp_bufR;
|
state->audio_out_temp_buf_pR = state->audio_out_temp_bufR;
|
||||||
if (opts->split == 0) //shouldn't need splitR
|
//the only time we don't want to upsample is when playing back MBE files, upsampling them seems to cause random crackling
|
||||||
|
if (opts->playfiles == 0) //opts->split == 0
|
||||||
{
|
{
|
||||||
for (n = 0; n < 160; n++)
|
for (n = 0; n < 160; n++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -499,19 +499,19 @@ usage ()
|
|||||||
void
|
void
|
||||||
liveScanner (dsd_opts * opts, dsd_state * state)
|
liveScanner (dsd_opts * opts, dsd_state * state)
|
||||||
{
|
{
|
||||||
//need to use this area to configure audio rates for different sources if not pulse
|
|
||||||
|
|
||||||
if (opts->audio_in_type == 1) //if stdin, switch to 8000 and single channel audio
|
//not sure this section is needed now that I've worked out the issue, wasn't upsampling due to split == 1
|
||||||
|
if (opts->audio_in_type == 1)
|
||||||
{
|
{
|
||||||
opts->pulse_digi_rate_out = 8000; //stdin needs 8000 output for single channel
|
opts->pulse_digi_rate_out = 48000;
|
||||||
opts->pulse_digi_out_channels = 1;
|
opts->pulse_digi_out_channels = 1;
|
||||||
if (opts->dmr_stereo == 1)
|
if (opts->dmr_stereo == 1)
|
||||||
{
|
{
|
||||||
opts->pulse_digi_rate_out = 4000; //stdin needs 4000 by 2 channel for DMR TDMA Stereo output
|
opts->pulse_digi_rate_out = 24000; //stdin needs 24000 by 2 channel for DMR TDMA Stereo output
|
||||||
opts->pulse_digi_out_channels = 2;
|
opts->pulse_digi_out_channels = 2;
|
||||||
fprintf (stderr, "STDIN Audio Rate Out set to 4000 Khz/2 Channel \n");
|
fprintf (stderr, "STDIN Audio Rate Out set to 24000 Khz/2 Channel \n");
|
||||||
}
|
}
|
||||||
else fprintf (stderr, "STDIN Audio Rate Out set to 8000 Khz/1 Channel \n");
|
else fprintf (stderr, "STDIN Audio Rate Out set to 48000 Khz/1 Channel \n");
|
||||||
opts->pulse_raw_rate_out = 48000;
|
opts->pulse_raw_rate_out = 48000;
|
||||||
opts->pulse_raw_out_channels = 1;
|
opts->pulse_raw_out_channels = 1;
|
||||||
|
|
||||||
@@ -533,16 +533,16 @@ if (opts->audio_in_type == 1) //if stdin, switch to 8000 and single channel audi
|
|||||||
#ifdef USE_RTLSDR
|
#ifdef USE_RTLSDR
|
||||||
if(opts->audio_in_type == 3)
|
if(opts->audio_in_type == 3)
|
||||||
{
|
{
|
||||||
//test to see if this is still necessary
|
//not sure this section is needed now that I've worked out the issue, wasn't upsampling due to split == 1
|
||||||
opts->pulse_digi_rate_out = 8000; //rtl needs 8000 and 1 channel is mono system
|
opts->pulse_digi_rate_out = 48000; //rtl needs 8000 and 1 channel is mono system
|
||||||
opts->pulse_digi_out_channels = 1;
|
opts->pulse_digi_out_channels = 1;
|
||||||
if (opts->dmr_stereo == 1)
|
if (opts->dmr_stereo == 1)
|
||||||
{
|
{
|
||||||
opts->pulse_digi_rate_out = 4000; //rtl needs 4000 by 2 channel for DMR TDMA Stereo output
|
opts->pulse_digi_rate_out = 24000; //rtl needs 4000 by 2 channel for DMR TDMA Stereo output
|
||||||
opts->pulse_digi_out_channels = 2;
|
opts->pulse_digi_out_channels = 2;
|
||||||
fprintf (stderr, "RTL Audio Rate Out set to 4000 Khz/2 Channel \n");
|
fprintf (stderr, "RTL Audio Rate Out set to 24000 Khz/2 Channel \n");
|
||||||
}
|
}
|
||||||
else fprintf (stderr, "RTL Audio Rate Out set to 8000 Khz/1 Channel \n");
|
else fprintf (stderr, "RTL Audio Rate Out set to 48000 Khz/1 Channel \n");
|
||||||
opts->pulse_raw_rate_out = 48000;
|
opts->pulse_raw_rate_out = 48000;
|
||||||
opts->pulse_raw_out_channels = 1;
|
opts->pulse_raw_out_channels = 1;
|
||||||
|
|
||||||
@@ -1308,7 +1308,7 @@ main (int argc, char **argv)
|
|||||||
openAudioInDevice (&opts);
|
openAudioInDevice (&opts);
|
||||||
|
|
||||||
|
|
||||||
fprintf (stderr,"Press CTRL + C twice to close.\n"); //Kindly remind user to double tap CTRL + C
|
fprintf (stderr,"Press CTRL + C twice to close.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -1323,7 +1323,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
if (opts.playfiles == 1)
|
if (opts.playfiles == 1)
|
||||||
{
|
{
|
||||||
opts.pulse_digi_rate_out = 8000; //need set to 8000 for amb/imb playback
|
opts.pulse_digi_rate_out = 8000; //need set to 8000 for amb/imb playback, upsamling seems to cause random crackles
|
||||||
opts.pulse_digi_out_channels = 1;
|
opts.pulse_digi_out_channels = 1;
|
||||||
openPulseOutput(&opts); //need to open it up for output
|
openPulseOutput(&opts); //need to open it up for output
|
||||||
playMbeFiles (&opts, &state, argc, argv);
|
playMbeFiles (&opts, &state, argc, argv);
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||||||
}
|
}
|
||||||
if (opts->audio_in_type == 1)
|
if (opts->audio_in_type == 1)
|
||||||
{
|
{
|
||||||
printw ("| STDIN - Input\n");
|
printw ("| STDIN Standard Input: - \n");
|
||||||
}
|
}
|
||||||
if (opts->audio_in_type == 3)
|
if (opts->audio_in_type == 3)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user