This module allows random playback of up to 12 tones, with probability set by sampling midi hits and arranging them into 12 bins corresponding the the 12 tones in the chromatic scale. The octave for each note is maintained for playback to allow chord extensions beyond the 7th or below the root.
The module samples note values, clocked in by pulses at the “sample^” input—presumably signals from a MIDI keyboard—and organizes the samples into bins. A histogram is produced, the value in each bin being the count of hits for that tone. To facilitate playback over a multi-octave range, each bin also contains the octave of the last addition to that bin.
A “key” input (log f/A440 format) allows one to determine which bin shall carry hits at the tonic of a particular key (or equivalently, the root note of a chord).
A “Rec” button (with indicator light) allows the user to stop sampling and play at will. Red: sampling.
A “Reset” input performs a histogram reset if pulsed, resetting all counts and octave values to zero. Reset is inoperable unless the module is sampling (red light).
Playback is accomplished by creating a set of all bins whose probability value matches or exceeds a randomly set value (displayed by the bar display “P”). From this set a custom scale is produced (# output, integer format, with tonic=LSB.) Scale query functions are used grab info needed for playback, such as number of tones (output “N”) and the tone represented by each degree in that custom scale.
Play commences with a querying of the scale with an integer value between 1 and N at input “Q:Degree?,” which produces the corresponding output at “A:o!” (log f/A440) octave format.)
As each note is played back, its octave, which was captured in the sampling stage, is added back on and presented at output “A:o!”
A trigger at the “Roll!” input sets a new random value for P, generating a new scale for playback.
Note that if you arpeggiate by scale degree, as is done in the demo, you will hear all notes in scale order, with the flat ninth played immediately after the root, and so on. Presumably, in an application one could quickly sort the resulting tones by pitch to get a straight arpeggio, then clock those out for playback, but I’ve not tried it yet. Most of my work has used “process at play speed,” and I don’t know of an “Insta-sort plus wayback machine” algorithm I could use!
Random Tones by Histogram v12.07.18.2.audulus (377.1 KB)
Scale by Histogram polyoctave.audulus (673.8 KB)