This page attempts to explain how the sample ModulatePNG() function works
The ModulatePNG() sample function is included in the sample scripts you pasted into Global Functions or Local Functions earlier
The next slide will show a different way to do the same modulation using a series of if-then-else statements