Last active
March 19, 2018 19:58
-
-
Save superna9999/ff0352698d73bff54a24b21871995b73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SPDX-License-Identifier: WTFPL | |
# Copyright © 2018 Neil "Superna" Armstrong | |
# This work is free. You can redistribute it and/or modify it under the | |
# terms of the Do What The Fuck You Want To Public License, Version 2, | |
# as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ | |
# for more details. | |
PREV="$(date +%s%N | cut -b1-13)" | |
TAPS="0" | |
COUNT="0" | |
while read -p "tapTempo : press any key (CTRL+D for quit)" tap ; do | |
CUR="$(date +%s%N | cut -b1-13)" | |
TAPS="$TAPS + $(($CUR-$PREV))" | |
PREV=$CUR | |
COUNT="$(($COUNT + 1))" | |
done | |
echo "" | |
echo BPM : $((60000 / $(($(($TAPS + 0)) / $COUNT)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment