PWM Help

Hey all, I’d really like to implement a simple sound engine like the one from RETRO Invaders ( RETROINVADERS - Retro Invaders a space invaders clone by Chris Fa… | Mbed ) or UZEBOX ( GitHub - Uzebox/uzebox: A retro-minimalist game console engine for the ATMega644 ) but converting from C++ to C# really isn’t my strong suit, especially when timers and PWM are involved.

Any of the rockstars care to lend a hand?