beatsio icon indicating copy to clipboard operation
beatsio copied to clipboard

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

Open roryokane opened this issue 12 years ago • 0 comments

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.

roryokane avatar Feb 19 '13 01:02 roryokane