Skip to content

Commit

Permalink
Check duration as milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolson committed Nov 22, 2022
1 parent 6e2c158 commit 5f472ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ClapDetector {
const duration = get(stats, 'Length (seconds)')
const rms = get(stats, 'RMS amplitude')
const max = get(stats, 'Maximum amplitude')
return (duration < CLAP_MAX_DURATION && max > CLAP_AMPLITUDE_THRESHOLD && rms < CLAP_ENERGY_THRESHOLD)
return (duration < (CLAP_MAX_DURATION / 1000) && max > CLAP_AMPLITUDE_THRESHOLD && rms < CLAP_ENERGY_THRESHOLD)
}

handleClap() {
Expand Down

0 comments on commit 5f472ee

Please sign in to comment.