Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better way to specify notes? #19

Open
ndim opened this issue Jan 13, 2021 · 4 comments
Open

A better way to specify notes? #19

ndim opened this issue Jan 13, 2021 · 4 comments
Assignees

Comments

@ndim
Copy link
Member

ndim commented Jan 13, 2021

Traditionally, beep has been using a combination of the -f, -l, -D, -d, and -n parameters to specify notes and sequences of notes.

I am certain there are better ways to write notes in a way which is both less verbose, and easier to read and write at the same time. I am also certain that over the last 20 to 40 years, there must have been utilities using notations which at least give good ideas.

This issue is to discuss and document better ways to write notes, and to discuss integrating a better note notation into beep.

@dawidi
Copy link

dawidi commented Mar 26, 2021

Here's what I did with shell script wrappers around beep:
sound
This is just a slightly more elegant way to specify frequency,duration pairs - named after the SOUND command in BASIC.
spkplay
This interprets a music-oriented notation similar to the PLAY command in BASIC, setting the tempo, note lengths, octaves, staccato/legato playing styles, sharp/flat notes etc.
Like so:
spkplay t114 mn l16 o4 c d f d l8 a. a. l4 g ms l16 c d f d l8 g. g. f mn l16 e l8 d l16 c d f d l4 f l8 g e. l16 d l4 c l8 c l4 g l2 f

@ndim
Copy link
Member Author

ndim commented Mar 26, 2021

Thank you for that information.

Also, a quick remark on the command line argument checks:

if [[ "$@" == "" ]]; then

The "$@" expands to multiple arguments if the script is called with multiple arguments like script.bash foo bar bla, which results in the test expression being evaluated to be [[ "foo" "bar" "bla" == "" ]] which does not appear to be what you intended here.

Are you sure you did not want to check "$*" == "" here instead, or maybe even "$#" -lt 1?

@dawidi
Copy link

dawidi commented Mar 26, 2021

Indeed, "$#" -lt 1 would be better, that's what I meant to do. The "wrong" way still coincidentally does the right thing, but not for the right reason. Thanks!

@ndim
Copy link
Member Author

ndim commented Sep 23, 2021

The BSDs appears to have a kernel implementation reminding me of the IBM BASIC way of specifying notes, which the speaker(4) man page describes pretty well:

https://www.freebsd.org/cgi/man.cgi?query=speaker&sektion=4&manpath=FreeBSD+13.0-RELEASE+and+Ports
https://man.netbsd.org/speaker.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants