[ubuntu-studio-users] PS: BPM to ms calculation by command line

Ralf Mardorf ralf.mardorf at alice-dsl.net
Fri Feb 3 05:28:03 UTC 2017


On Fri, 3 Feb 2017 06:01:21 +0100, Ralf Mardorf wrote:
>[weremouse at moonstudio ~]$ bpm2ms | head -9
>(60000ms/120BPM)*4*(1/1)= 2000ms
>(60000ms/120BPM)*4*(3/4)= 1500ms
>(60000ms/120BPM)*4*(1/2)= 1000ms
>(60000ms/120BPM)*4*(1/4)= 500ms
>(60000ms/120BPM)*4*(1/8)= 250ms
>(60000ms/120BPM)*4*(1/12)= ~166.66666666666666666667ms
>(60000ms/120BPM)*4*(1/16)= 125ms
>(60000ms/120BPM)*4*(1/24)= ~83.33333333333333333333ms
>(60000ms/120BPM)*4*(1/32)= 62.5ms

I was thinking in four-four time, it's better to changed "1/1" to "4/4"
and "1/2" to "2/4".

[weremouse at moonstudio ~]$ bpm2ms | head -9
(60000ms/120BPM)*4*(4/4)= 2000ms
(60000ms/120BPM)*4*(3/4)= 1500ms
(60000ms/120BPM)*4*(2/4)= 1000ms
(60000ms/120BPM)*4*(1/4)= 500ms
(60000ms/120BPM)*4*(1/8)= 250ms
(60000ms/120BPM)*4*(1/12)= ~166.66666666666666666667ms
(60000ms/120BPM)*4*(1/16)= 125ms
(60000ms/120BPM)*4*(1/24)= ~83.33333333333333333333ms
(60000ms/120BPM)*4*(1/32)= 62.5ms
[weremouse at moonstudio ~]$ ls -l /usr/local/bin/bpm2ms 
-rwxr-xr-x 1 root root 503 Feb  3 06:17 /usr/local/bin/bpm2ms

The script contains a weak typo protection, I reduced the regex
"[0-9][0-9]" to "[0-9]", so it became weaker, but now it's possible to
use one-digit BPM values.

The improved script is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bpm2ms
Type: application/octet-stream
Size: 503 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-studio-users/attachments/20170203/454d222e/attachment.obj>


More information about the ubuntu-studio-users mailing list