Pink Noise Dithering - filmgrain of audio

Discussion in 'Audio Science' started by cameng318, Aug 18, 2023.

  1. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    As I was experimenting with digital filters and noise shaping a while ago, I was messing with the coefficients and accidentally got this crappy noise shaper. It measures so badly that I didn't even bother to give it a listen. However, I just tried it this week and it actually sounds surprisingly great.

    Here's its noise floor just to show the craps:
    pink.jpg
    Pink noise dithering

    Yeah it's a f'ing eye sore to look at, especially you can get much lower noise floor with good old TPDF dithering, or even without any dithering at all. Their middle fingers are about 30dB longer:
    no dither.jpg
    No dithering at all

    tpdf.jpg
    TPDF dithering
     
    • Like Like x 2
    • Epic Epic x 1
    • List
  2. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    In my journey with digital filters, I figured out many things it takes to inject less digital fuckery into the audio, but the sound is still not as emotional as the vintage/NOS/analog alternatives. Now I might have cracked (at least part of) the code about injecting emotions into the audio.

    With pink noise dithering, the basslines and percussions almost sound a dB louder, and the vocals feel planted and rooted on the ground. The bass is not only playing louder, but also hitting harder, despite the spectrum looking the same as before. Even the wet noodle farts sound more decisive now. There also seems to be a little more decay.

    However it also strips some of the air and sparkles out of the highs. I got a similar feeling by completely stripping away 20+kHz contents with some hires files, but they didn’t sound nearly as emotional as deez nuts. I guess it’s a combination of sin of commission and sin of omission - adding pink noise and deleting ultrasonic white noise.

    In my tests, you can add as much pink noise as possible until you can directly hear the hiss. I suspect there is already some pink noise in many of the well mastered recordings that sounds great. On the other hand, for the white noise, you could add a little bit more of them, but they don’t do much except masking the details. While white noise might be helpful sometimes to hide the digital fuckeries, it’s at the expense of resolution, and making the music flatter than the great plains.
     
  3. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    I guess this phenomenon partially explains why the good old R2R DACs sound so emotional. The vintage components typically have more pink noises than modern ones due to impurities, and the aggressive analog LPF cleans up the ultrasonics. In my tests, the droop brings some darkness to the sound, but not nearly as much emotions as the pink noise does.

    I wouldn’t be surprised if anything I wrote above is labeled as pseudo science. Heck, I didn't want to believe it myself. It's like suggesting that we should listen to music right next to loud traffic or airplanes. However, my feelings kept telling me the pink noise made a significant difference in an unexpected way. It consistently sounds syrupy and viscous regardless of my gear swaps, even down to 24 bit truncations.

    It’s a lot easier to tell the difference when playing on a decently designed DAC with few digital fuckeries. My Gungnir Multibit handles the 192khz -> 384kHz oversampling and further dithering itself, but I could still clearly tell the difference with it. I was able to make my RME ADI-2 sound much less digital with a combination of a few techniques, but the sound is still thin. Maybe I should make an aggressive analog LPF to insert after it.

    After all this is a ridiculous and ridiculously trivial idea. It’s like driving backward in a car race and somehow getting to the finish line first. On top of this idea, there are many more ways to tune the noise curve that we should experiment with. Keep listening!



    I can make some sound files to show the difference, but I don’t know if the copyrights will get me in trouble. Are there any good songs that I can process and post without trouble?

    Just made some file to compare Pink Noise Dither with TPDF Dither. Link here: https://drive.google.com/file/d/1xLmDErm3ix_rcinpg-dSBZLEyfU9EU60/view?usp=drive_link

    It's a banned song in China, so hopefully it won't get me into copyright trouble. I always felt like missing something when I listened to its album, it turned out every major platform in China had that album without this song. Now the album feels complete sitting in my drive.

    The sinc files are upsampled to 176.4kHz with my carefully tuned filters, feel free to compare it to what your software/hardware handles oversampling;)I'd be glad to hear how my sinc filter performs too. It'll be valueable feedback for me to write about it.

    I wanted to make a 32 bit file for TPDF, but it turned out I can't export it in FLAC with Matlab. The file size is too big, and I'd like to save some space in Google Drive. 24 bit is close enough though, just ever so slightly hazey or airy.
     
    Last edited: Aug 18, 2023
  4. MLegend

    MLegend Friend

    Pyrate
    Joined:
    Oct 4, 2015
    Likes Received:
    320
    Trophy Points:
    63
    Location:
    Northwest Florida
    Interesting stuff. Whatever makes audio sound subjectively better is worth investigating and testing, in my opinion. I wouldn't think you would get into any copyright trouble if you're just sharing the files for testing/comparison purposes. I think it's only an issue if you're trying to profit off of it.

    I could be wrong though.
     
    • Like Like x 2
    • Agreed, ditto, +1 Agreed, ditto, +1 x 1
    • List
  5. Thad E Ginathom

    Thad E Ginathom Friend

    Pyrate
    Joined:
    Sep 27, 2015
    Likes Received:
    14,270
    Trophy Points:
    113
    Location:
    India
    I admit that ignorance often doesn't stop me, but how I can I judge that, when I understand barely nothing of this! All I can say is it sounds to me like you are doing science. It might turn out to be good, bad or indifferent, but it still smells (unlike a lot of stuff in audio) like science.
     
    • Like Like x 2
    • Agreed, ditto, +1 Agreed, ditto, +1 x 1
    • List
  6. Lyander

    Lyander Official SBAF Equitable Empathizer

    Pyrate Contributor
    Joined:
    Feb 25, 2017
    Likes Received:
    11,050
    Trophy Points:
    113
    Location:
    Philippines, The
    Drawing analogies with visuals again because that's easier to convey:

    Rather than keep using my phone (Samsung S20 FE) camera with default settings for photos I care to make look good, I capture in DNG and then edit in Lightroom to my tastes. The primary difference here besides stylistic hue shifts and such is I control the degree of sharpening and noise reduction, which I find to be overly aggressive on basically every smartphone nowadays.

    Thinking logically I can't be ekeing out that much more detail since I'm just using my puny phone sensor still, but the "feel" of those photographs, an actual single non-composited and hyperprocessed mishmash of multiple exposures, just has more IMPLIED detail in the image, specifically with fine detail like fur or foliage or the gradients in shadow.

    The state of "sterility" is unnatural in the world at large, IMO. Just makes more sense to me that something similar applies to audio.
     
  7. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    I just YOLOed out the files, link in post #3
     
  8. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    I share the same experience! Digital processings in images are getting even worse than in audio. Many phones now draws out the moon instead of actually taking a picture of it.

    Just realized I forgot to mention the filmgrain part of the title. As a side quest of making digital filters, I looked into image processing and filmgrain. The demoasicing algorithms and sharpening are horrendous with filmgrains. I now process my raws with RawTherapee, which gets me pretty eye pleasing film like results. To demonstrate, here's a boring photo of my table:
    DSC00184-1.jpg
    Yes there is noticable color noise, but I think it's at leat not disturbing. It will get even better when I overlay some black and white noise:
    DSC00184-1_filmgrain.jpg
    I think it feels more film like now when pixel peeped. Hopefully the jpeg compression isn't killing it.

    In my opinion, processing audio with pink noise has similar effect to processing images like this, hence the title.
     
  9. Jdriver

    Jdriver New

    Joined:
    Jun 12, 2020
    Likes Received:
    44
    Trophy Points:
    13
    Location:
    Milagro, NM
    Home Page:
    At the risk of getting a thumbs down, I wish I could get back the 2 minutes I spent reading this thread.
     
    • Respectfully Disagree Respectfully Disagree x 1
    • List
  10. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    @Jdriver Have you give the files a listen? I'm interested in your opinion about them if you could spend 20 min to listen. I don't know if that's too much to ask. Negative opinion would be helpful too. I've spent 200+ hours figuring out the sinc filter and windowing function, so I'm also curious to find out how people think about it comparied to the oringinal file.
     
  11. gixxerwimp

    gixxerwimp Professional tricycle rider

    Pyrate
    Joined:
    Sep 30, 2015
    Likes Received:
    5,776
    Trophy Points:
    113
    Location:
    small island claimed by China
    Just to make sure I'm understanding this, this is the pink noise dithering for a pure 1kHz signal. And you'd add this to all frequencies of the whole song, right?

    I guess this is similar to Sony's Vinyl Processor on their DAPs?
     
    • Like Like x 1
    • Agreed, ditto, +1 Agreed, ditto, +1 x 1
    • List
  12. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    Ah yeah I realize I've left out way too much technical details that things are misleading. It's done for all frquencies of the entire song. I choose 1kHz signal for the plots, because dead silent has no quantization error hence no noise floor, and broadband noise masks the characteristics of the noise floor. I could make it a multitone signal, but the noise floor will still be the same.
    (Pssst the noise floor is so bad that it will piss off anyone who only care about hitting a flat 150dB on 1kHz measurements too;))


    This is actually a noise shaping algorithm like you would find in HQPlayer, but done in an opposite way. I didn't "inject" the pink noise into the music, but instead shaping the already existing quantization noise into the shape of pink noise.

    For reference, here's a plot showing the noise floor of a first order noise shaper:
    ns1.jpg
    Note the noise floor is significantly lower than the TPDF dithering below 20kHz. My pink noise shaper actually has lower noise floor than the TPDF dither above 40kHz.


    Thanks a lot for letting me know about Sony's Vinyl Processor! I wasn't aware of it. Just found an interview about it of a Sony Engineer here, and I was fascinated to find that I'm not alone in the pink noise camp. Their theory about giving the diaphragms and cones a jump start on impulses with infrasound is very interesting. Their measurement for the vinyl noise floor certaily shows pink noise characteristics below 500Hz:
    [​IMG]
    I'm not sure how Sony implement their processor. Maybe they inject in the pink noise, or maybe they shape the quantization noise like I did. If the former, I would argure my algorithm is superior, since quantization noise is a necessary evil you can't avoid.
     
  13. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    The noise shape doesn't have to be pink noise too, you can pick any shape, albeit might be more troublesome in the design process.

    Just figured a noise shape inspried by blackbody radiation in incandescent light bulbs. I think it sounds softer and more pleasing than pink noise. I attached a 20s sample here. It's noise spectrum looks like this:
    blackbody.jpg
    It's approximatly shaped by a 5th order high pass filter plus a 2nd order low pass filter
     

    Attached Files:

  14. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    Ladies and gentlemen, may I propose the new industry standard for plotting noise floor measurement

    pink_dick.jpg
    :rolleyes:
     
    Last edited: Aug 19, 2023
  15. Chris Cables

    Chris Cables MOT: Chris Cables

    Joined:
    Apr 23, 2023
    Likes Received:
    281
    Trophy Points:
    63
    Location:
    Peoples Republic of Vleuten
    Home Page:
    Noise FTW.
    After borrowing a camera to take some product shots and not being able to replicate the below image on a camera/lens costing 10 times as much I decided to learn all about filters/noise.
    It's all in the algorithms and settings, which coincidentally reminded me of a good friend who shared his epic space-cake with us at a party this one time years ago.
    Someone asked him how he managed to put everyone into such a good and loving mood. His reply: 'It's all in the butter man, it's all in the buddurrrr!
    loool
    [​IMG]
     
  16. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    7,560
    Trophy Points:
    113
    Location:
    Winnipeg
    I mean... maybe this was his butter.
     
  17. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    Oh ghee! I only have a third jar of ghee left from last month. Have to get more butter to make more
    _DSC0916_filmgrain.jpg

    tbh it's not only the filmgrains but also the color science. Huge shout out to RawTherapee's developers and contributors. Their default profiles has very accurate color, totally bypassed the from factory color science. There is also a variety of film simulations that stacks well on top of that accurate color.
     
  18. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    Got some other tests done for the filters. In the real world, the LSB (smallest bit) of your DAC aren't always spot on. For example, the DAC8812 in the newer Schiits has +-1 LSB max nonlinearity. The temperature drift can cause trouble too. What will happen to your filter if the last bit got thrown out? What about throwing out 2 more bits? Let's find out. In my past tests, this LSB truncation resistance criteria had been highy cooralated to my filter preference.

    Without dithering:
    no_dither.jpg
    That's what you would expect. The quantization noise is always there.


    With good old TPDF dithering:
    tpdf.jpg
    The quantization noise is coming back once you throw out 2 or more bits. It should work well if your DAC has 1 LSB or less nonlinearity. If it messes a little more up than 2 LSB, you might begin to hear the quantization noise.

    First order noise shaper:
    ns1.jpg
    Ah ha, now we know why the aggressive noise shaping DACs are only taking 1 bit DSD signals at the final stage. They can't even afford losing a single bit! If they do, there's really not much difference from the TPDF dither in the lower frequencies, and it has the extra noise in the higher frequencies too :mad: This format is only good enough for you to send digital signals to your DAC for further processing, when you can't send 24 or 32 bits. I'd like to test this on higher order noise shapers when I figure one out.

    Pink noise shaper:
    pink.jpg
    It doesn't really care about it. High frequency noise rise up a little bit, but still not much distinguishable quantization noise. All of them are swollen under the power of pink:punk: In fact, it only start to show up when you throw away 6 bits:
    pink_6.jpg
    Voila! Now I've found the panacea for curing R2R DACs with shitty LSB nonlinearities. I hope I'll get to the point using it on cheapo tda1387 DACs I design myself.

    In summary, here are the truncation resistance of those algorithms:
    Without dither - 0 bit
    TPDF dither - 1 bit
    First order noise shaper - 1 bit
    Pink noise shaper - 5 bit
     
  19. Garns

    Garns Friend

    Pyrate
    Joined:
    Jul 9, 2016
    Likes Received:
    2,484
    Trophy Points:
    93
    Location:
    Sydney, AUS
    I took a listen. Pi2AES -> Wavedream -> EC Aficionado -> Omega 3i's + Rythmik subs. Turned off the internal dither for this. It upsamples internally to 705.6 I think.
    • The sinc upsampled TPDF sounds quite nice. It has a bit more soundstage depth, though I don't think there is heaps of soundstage depth in the recording.
    • I actually didn't really like the pink noise that much. As you say the tonal balance is tilted downwards and the top end is a bit muted. You can hear the compression on the drums much more easily at the start. But I found the soundstage was flattened out relative to even the non-upsampled original. Overall it seemed a bit more smeared together to me.
    • Compared your sinc to PGGB 64, which just does pure sinc coefficients to the length of the file with no window and a special sauce noise shaping algorithm. It was close but I did prefer the PGGB. I don't know what exactly but it seems to have some extra tonal colour to it and there is a slight extra clarity to transients. I wanted to hate PGGB but when I heard it I found that I actually liked it a lot.
     
    • Like Like x 1
    • Agreed, ditto, +1 Agreed, ditto, +1 x 1
    • List
  20. cameng318

    cameng318 Friend

    Pyrate
    Joined:
    Jun 14, 2020
    Likes Received:
    330
    Trophy Points:
    63
    Location:
    Wyoming
    @Garns Thanks a lot for the feedback! I totoally agree with what you heard for the first two points. I hear exactly the same thing, but have different preference due to gears. I was listening mostly on LCD2 with silver wires, and most of my gears are on the bright side. I specifically tuned everything to mute the sibilance with my LCD2/Focal Elex/RME ADI-2/DIY amp... I could easily see some system benefiting from the air and soundstage from longer sinc filters.

    Thanks for bringing up PGGB too. It's another thing I wasn't aware of, so I just looked it up. IMO plain sinc filter does have several benefits. Technically it can be made to preserve the oringinal signal, and reduce quantization noise by a few dB. If I didn't get it wrong, I think only PGGB 256 use no window. I had 64 bit running out of steam when I do more than 1M taps, quantization error accumulated so much that it begin to sound digitus. However, I could see 256 bit working in such manner and produce fantastic results. I wish I could have access to 256 bit computing with my toolkit.

    My problems with long filter is that it does some time smearing in the decay and/or attack, which synched horribly with my planars that already got that long decay with the "ortho walls". They need very dry sources to fix that. I did like longer filters with dynamic headphones though, so I would guess your speakers have very well controlled settling times. Maybe well implemented room reflections can mask the time smears in attack too. My speaker and room set up aren't really up to standards for these tests.

    Speaking of long filters, have you tried minimum phased versions of long filters? They can have great soundstages as well. The phase shift makes the sound a bit odd in the highs though, but I think they have the best attack and decay characteriscs. I've made butterworth filter of 1000+ orders. The computation is a bit lousy, but might be some interesting things to try.

    I meant to save the butterworht filter for my next thread, but I'm making a file for you to try. Very intrested to hear your thoughts on your setup. It's a 16384th order butterworth filter cutting off at 22kHz. Could've make a even longer filter for more decay, but I really ran out of precisions and computing power. The link is here.

    Edit: Scratched those words about bits. With my new understanding about dithering, and plugging every single hole that could cause quantization error, 64 bit is great for audio unless going significantly over 1M taps. I'm making a 69420th order butterworth filter, which should have interesting soundstage. File here. It's about 1.25M long tap length, which could provide more wetness than some concert halls. It actually doesn't need any windowing functions proven by math.
     
    Last edited: Aug 20, 2023

Share This Page