Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make detections in beepdetect.py more robust #3

Open
DrLex0 opened this issue Jun 22, 2018 · 0 comments
Open

Make detections in beepdetect.py more robust #3

DrLex0 opened this issue Jun 22, 2018 · 0 comments

Comments

@DrLex0
Copy link
Owner

DrLex0 commented Jun 22, 2018

Currently the detection algorithm is biased towards positive signals. Any series of three signal frequencies with acceptable timings is treated as a positive. There is only some awareness of negative indicators like harmonic detection. The result is that some of the tunes can still trigger a false positive. This is not really a problem when using the Sailfish build with the heater tune toggle option, but it is annoying.

Another problem is that playback of M300 commands will likely become less accurate in future releases of Sailfish. This means the detection parameters will need to be made more lenient which again increases the risk of false positives.

To both reduce the risk of false positives while allowing more sloppy timings, I propose to update the detection routine to evaluate groups of 3 possible signals as a whole instead of sequentially.
The false positives I have seen, all have a whole bunch of ignored simultaneous signals. The motivation for this was that a sharp bang on the printer housing must not cause a detection to be aborted, but a sharp bang will only cause 1 or maybe 2 FFT frames with multiple signals, not 10 like I often see in a false detection. So if a candidate sequence has more than 2 simultaneous signals, discard it.
Similar for timings: if the timing of one beep and one pause is somewhat too long but the other timings were perfect, the printer was probably slowed down while playing an actual sequence and it should be accepted. If all timings are suspicious, then it should be discarded.

This can be implemented as a penalty system where each simultaneous signal case adds a score, an each timing flaw adds another score. If the total score exceeds a threshold, discard. A fancy way to determine optimal scores would be to gather a lot of examples and then throw some learning algorithm against it, but good results can probably be obtained as well with some common sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant