Add module for mouth noise detection #936

merged 6 commits into from Aug 23, 2016


None yet

4 participants


This is the distilling of my thume.popclick module into a built-in extension. It contains high-accuracy low-latency audio recognizers for mouth noises suitable for miscellaneous simple computer control tasks. I personally use this module with eventtap to scroll documents hands free when I am lying down with my laptop reading. In the past I've used these recognizers in research for hands-free mouse clicking.

I apologize for the C++, but it's what I originally wrote the recognizers in, and the high speed collections make it nicer than Objective-C or C.

Because of the way the audio system I use works I had to have an unusual structure of an objective-C class containing an instance variable struct that the audio system takes direct pointers into.

It's decidedly hard to test automatically since it relies on microphone input, but I included a basic doesn't-crash automated test. I'm not sure if it crashes on Travis but if it does I'll add the skip travis call. But rest assured I've been testing this personally for the past week and it has worked fairly well.

See the docs in init.lua for more info, or the readme of the project I link above.

@cmsj @asmagill


Also, I couldn't run the tests myself because if I use Product->Test in XCode it crashes because it tries to look for Hammerspoon Tests.xctest in the Plugins folder of but it isn't there.


Interesting idea, I look forward to checking it out this weekend!

trishume added some commits Jul 16, 2016
@trishume trishume Tweak documentation to be better, and to actually build 54d579b
@trishume trishume Fix float promotion warning-errors f9e1f95
@trishume trishume Fix another float promotion error
codecov-io commented Jul 16, 2016 edited

Current coverage is 23.22%

Merging #936 into master will increase coverage by 0.40%

@@             master       #936   diff @@
  Files           123        126     +3   
  Lines         19642      19772   +130   
  Methods        2225       2233     +8   
  Messages          0          0          
  Branches       2328       2351    +23   
+ Hits           4482       4592   +110   
- Misses        14921      14935    +14   
- Partials        239        245     +6   

Powered by Codecov. Last updated by 33378a2...fe13371


The -Wall -Werror flags on Hammerspoon are brutal. I thought it would take an hour to port my module to Hammerspoon, I've now spent like 4 hours refactoring and fixing to avoid warnings. Including the most recent one which Travis has but my compiler doesn't.

When ready I can squash some/all of these commits together before merging if you'd like.

@trishume trishume Add MIT license
trishume commented Aug 6, 2016
asmagill commented Aug 8, 2016


@asmagill asmagill referenced this pull request Aug 18, 2016

Release 0.9.47 #957

cmsj commented Aug 23, 2016

@trishume sorry for the delay, and sorry that you had to feel the pain of -Wall -Werror. I think it's worth it, to keep our quality levels from slipping further! Thanks very much for writing this module, it's crazycool :)

I can imagine other uses for an FFT engine, in companion with things like a PushToTalk microphone muter that reminds you you're muted if you're speaking, but I know nothing about FFTs and have no idea how to do such things!

@cmsj cmsj merged commit 67136f0 into Hammerspoon:master Aug 23, 2016

3 checks passed

codecov/patch 48.14% of diff hit (target 22.81%)
codecov/project 23.22% (+0.40%) compared to 33378a2
continuous-integration/travis-ci/pr The Travis CI build passed
@cmsj cmsj added a commit that referenced this pull request Aug 27, 2016
@cmsj cmsj Revert "Allow __call metatable backed module in hotkey binds."
Opens #936
Opens #932

This reverts commit 41ca1ab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment