Lets say that I am counting pixels over time. Each pixel is either the color red or blue. Let's say that I make up some threshold for the number of red pixels that I count and that when I reach this threshold I need to stop. If this is all that I needed to do then I could just count the pixels and be done. But there is a problem.

I need to also count the blue pixels that I receive because if I get some blue pixels I need to reset my count of red pixels. It is not enough to simply reset my count of red pixels when I receive a blue pixel. No, I need to count to a threshold of blue pixels and only then reset my count of red pixels back to 0. Key point there. If I receive a threshold of blue pixels. It's not merely enough that I receive a single pixel. It must be some already determined threshold count of blue pixels. Likewise, if I receive a certain threshold of red pixels, then I need to also reset my count of blue pixels back to 0.

Programming this is easy enough and I have a procedure written out in Rust. The application is to detect a significant enough threshold of silence between speech utterances. I'm using a Voice Activity Detector and it looks at 20ms at each pixel of sound and determines if it is silent or not. But this effect does not detect silence in a conversation. You need to look at longer periods and you need to account for bumps in a sequence of silence marked detections. You don't want to reset your threshold just because someone made a small noise with their lip or mouth or breathed a little too loudly in-between utterances. There needs to be a significant enough density of continuous silence.


And this does the job. But it seems hacky and besides, I am learning math precisely so that I can solve these problems in interesting and efficient ways by using appropriate models. Here is a picture of the program at work. Notice the red marks on the blue waveform. That's the determined cutoff points for silence https://imgur.com/Yg7An9X. Another image shows our analogy of blue and red pixels with red pixels representing a sequence of detected silences of 20ms each and blue pixels of non silence 20 ms each https://imgur.com/IbsMAzg. Notice a sequence of red or blue pixels has breaks of the opposite color. The objective here is to ignore small breaks. Only when the breaks are packed close enough together and in large enough number do we decide to reset either blue or red.

​My question is, what mathematics topic could I recruit to help me model the solution to this problem? I was looking into density estimation and some statistical distributions, but I'm not even sure if they are relevant. I'm not asking for a solution, just a point in the right direction to a topic in math that works for these kinds of problems.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.