Debugging watcher? What is this watcher?

According to this page, there’s a ‘watcher’:

I have no clue what this watcher is and don’t see it on the Pixelblaze editor (when using Chrome). Is it something I need to enable in Chrome? Maybe it’s something in a newer version of Pixelblaze? How would one determine which version they have? Either way, it’s not documented below the Edit Pattern page or anywhere I can find on:

What I’m trying to do is to try and figure out how the AGC works in the sound routines and want to see what the range of values are. For instance there’s energyAverage, but I have no idea if it’s a floating point number from 0 to 1 or int or even a uint. . . but that’s just a start for the debugging.

Update: Turn out from this ‘Discovery’ link I clicked, I have version 2.7.

Hi Andrew,
Yep, that was added afterward. It will show you any exported variable in a side panel.
It looks like this:

Version info is also shown on the top right next to other status info. Shoot me an email if you’d like to update firmware.

energyAverage is a fractional value between 0 and 1.0, usually with a fairly low value.
Most of the variables from the sensor expansion board are fractional values, with the exception of maxFrequency which is in Hz and always an integer value. The accelerometer values can go negative.

Thanks. Once I receive my new PB with sound, I’ll spend more time trying to figure out your PI controlled sound routines. Although I understand the basics of a PID loop, I’m not there yet with your implementation or how to apply that loop to a sampled sound. Have been agonizing over sound-blinkfade.

So, really, I’m just looking to understand/create a good Automatic Gain Control.

The sensor board does sample sound, but that isn’t directly fed into pattern data. The samples are processed, and only data about it are used. For energyAverage all samples are converted to absolute values, added up, then divided by the frame size.

I don’t want to cheat you out of any fun discovery time, so if you don’t want any PID spoilers you can skip the rest of this message :slight_smile:

It uses 2/3 of the PID controller, just proportional and integral, and skips the derivative.

The goal is to adjust sensitivity (gain) to get targetFill (20%) of the possible brightness active on average. All the values sent to HSV are accumulated into brightnessFeedback which is then divided by pixelCount to get an average brightness from the last frame of animation. The difference between that and targetFill is the error which is input to the PI controller. You might want to put that in an exported var to watch. So if the last frame was too dark, error will be positive, if it was too bright, error will be negative. That error will accumulate into pic[2] (the integral), the rest of the pic[] structure is static and used as parameters for the PI controller.

Thanks much. Looking forward to receiving the new PB so I can go through this with a fine tooth comb.

The fact that I’m a senior citizen is going to slow me down somewhat, but I’ll persist.

Have gleaned a lot from your comments and again with the code. Now that I have received a sound reactive PB, I’ve been able to view the range for many of the variables.

It’s interesting that you clamp pic[2], whereas I would’ve thought it’s the cumulative area under the signal over time.

Also interesting is that you turn ON the LED and fade at a rate associated with the sensitivity. Higher sensitivity value (~120) is quiet and it fades quickly, whereas a low sensitivty value (~30) is loud and the LED fades slowly.

I never would’ve thought of that in a million years.

Still got more work to do to understand sound-blinkfade, but at least with the watcher, I can see what the range of each value is.