1

I have two signals (out of wav files), both are mono wav files of 37500 Hz sample rate.

File 1 is output.wav: file 1 'output.wav'

File 2 is saved_mono.wav: file 2 'saved_mono.wav'

I apply superimposing ("+") operation for the two Discrete signals:

    // shiftedSignal is output.wav
    // outSignal is saved_mono.wav
    
    //This is how I read it:
    WaveFile shiftedWav;
    using (var stream = new FileStream("output.wav", FileMode.Open))
    {
        shiftedWav = new WaveFile(stream);
    }
    DiscreteSignal shiftedSignal = shiftedWav[Channels.Left];

    DiscreteSignal mergedSignal = shiftedSignal + outSignal;

    waveFileOut = new WaveFile(mergedSignal);
    using (var stream = new FileStream("merged.wav", FileMode.Create))
    {
        waveFileOut.SaveTo(stream);
    }

As the result, I have merged.wav file and it has a giant peak in the middle: superimposing result - merged.wav file with a giant peak

Both input wav files have the same sample rate of 37500 and the same bitrate of 600 kbps.

Where did it come from and how do I fix it?

Just to make sure, I tried to concatenate these signals:

DiscreteSignal mergedSignal = shiftedSignal.Concatenate(outSignal);

And it comes out OK: Concatenate operation

Ivan G
  • 21
  • 4
  • I tried using ffmpeg for the same operation: "ffmpeg.exe" -i "output.wav" -i "saved_mono.wav" -filter_complex amix=inputs=2:duration=first,volume=2 wav_ffmpeg_merged.wav" Result is quite similar: https://imgur.com/a/buxwk2p – Ivan G Oct 23 '22 at 11:24
  • Temporary solution for now is to attenuate output.wav by 10dB. No more weird giant peaks. But I still wonder why it happens.. – Ivan G Oct 23 '22 at 12:31

0 Answers0