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

make it easy to play a sequence of chords with different durations and volumes #2

Open
roryokane opened this issue Feb 19, 2013 · 0 comments

Comments

@roryokane
Copy link
Contributor

This is a rather big suggestion, but it would be nice if it were easier to enter familiar music patterns and then add elements on top of them. To do this, you would need objects or data structures for holding those patterns, and helper functions for playing them.

Each chord might be specified as [[frequencies], duration, volume], or perhaps an object containing those values as properties. Omitted values would have defaults, so it might reduce to the current syntax in the simple case – frequency is like [[frequency], 1, 1]. Rough sketch of example use:

my_seq = bseq_advanced(['C4', 'A3', ['C4', 0.5], ['D4', 0.5, 0.75], [['G3','B3']]])
player = (chord, duration, volume) ->
  for note in chord
    bcon(bsimple_advanced(note, duration, volume))
bplay_advanced my_seq, player

For example, the third “chord” in my_seq is a single note “C4”, lasting for duration 0.5 (half of normal), with volume 1 (normal volume). Normal duration might be the duration of a quarter note at 120 BPM. Normal volume would not be the maximum volume; it would leave room in the scale for higher volumes.

bsimple_advanced would make the tone last just for the given duration, and play it at the given volume. A graph of the volume envelope of a 5-unit-long note might be “▅███▅”.

The given player variable seems general enough that perhaps bplay_advanced would supply it as a default if no function were given.

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

1 participant