I'm writing a tool that converts a dsdiff audio file (dsd64) into a flac audio file (DSM -> PCM). The project is both a programming exercise and a signal processing exercise; I'm learning a lot from it.
Currently, I'm doing the following to compute a sample in the PCM stream
- Select a window of the DSM sequence that corresponds to the size of the window of a low-pass (FIR) filter.
- Replace all 0s in the DSM window with -1s
- Convolve (multiply+sum) the elements in the DSM window with the coefficients of the (FIR) filter and rescale the result to fir into the chosen bitrate (24-bit).
- Move the window by
downsampling factor
many elements (16 in my case) and apply repeat this process.
I tested the conversion using a few (arbitrarily chosen) dsdiff files (songs by the band deep purple). The conversion reproduces the signal (good) but introduces noise (bad) with the following profile (measured during the beginning of the track where there is a bit of silence in the original):
I've been trying to figure out how this is being introduced, and what I need to do to remove it. From my reading of random sources online I understand that this is introduced by integrating the DSM signal, which amplifies the noise floor and maps it to a spectrum similar to the one I see in my plot.
Did I identify the problem correctly? What can I do to verify this and, ultimately, fix it?
Any help is highly appreciated.
Edit:
Added a figure showing the filter's frequency response
Added the Periodogram of the first second of the DSM stream