Bashrc.wiki: Added sing and note2freq section
This commit is contained in:
parent
5bf657c322
commit
84c1bc6b43
19
Bashrc.wiki
19
Bashrc.wiki
|
@ -187,6 +187,25 @@ As an added bonus, the `-l` option will print the url for that product's support
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
== `sing()` and `note2freq()` ==
|
||||||
|
|
||||||
|
https://git.thurstylark.com/vcsh/bashrc.git/tree/.bashrc.d/sing.bash
|
||||||
|
|
||||||
|
I was having trouble writing music scripts for the pcspkr because all the examples that I could find only used frequency numbers as arguments to `beep`, and it was difficult to map frequency numbers to musical note letters in the process of making my own tunes. `note2freq()` solves this issue by taking a musical note in the form of `<letter>[accidental]<octave>`, where:
|
||||||
|
|
||||||
|
* `<letter>` is one of `A` through `G`
|
||||||
|
* `[accidental]` is one of:
|
||||||
|
* `b` for flat
|
||||||
|
* `s` for sharp
|
||||||
|
* omitted for a natural note
|
||||||
|
* `<octave>` is `1` through `7`
|
||||||
|
|
||||||
|
`sing()` takes a list of notes in this same form along with note length in ms, uses `note2freq()` to translate each one to a frequency number and constructs a string of arguments that `beep` can use to play the entire tune in one go.
|
||||||
|
|
||||||
|
Both of these in tandem make beep tune writing way easier.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
==Weechat==
|
==Weechat==
|
||||||
|
|
||||||
https://git.thurstylark.com/vcsh/bashrc.git/tree/.bashrc.d/weechat.bash
|
https://git.thurstylark.com/vcsh/bashrc.git/tree/.bashrc.d/weechat.bash
|
||||||
|
|
Loading…
Reference in New Issue