White Key Scale Play

White Key Scale Player

Maps the white keys to whatever scale you want, with a chromatic mode that allows you to set a key. The black keys operate five momentary or latched switches.


I/O

Input Signal Range Notes
g 0-1 The velocity signal from a MIDI keyboard node, typically
o A/440 oct.tone Any standard A/440Hz octave value
#Scale 0-4095 A scale, from one to twelve tones, represented by a twelve-bit binary value expressed as a positive integer with the tonic as the least significant bit (LSB). Note that for the quantizers and scale query modules used in my patches, a value of zero is interpreted as 4095, which is the code for the 12-tone chromatic scale. Note also that any 12-bit binary value will play, but only those values for which the decimal equivalent is odd will the tonic play in-key!
mode^ 0-1 trigger Switches the module in and out of chromatic mode (from scale play mode).
key_mod 0,±float Use to temporarily sharpen or flatten. 1==1/12th oct
black key input (5ea) any value These are the inputs to switches controlled by the black keys. Latched and momentary outputs are provided for each black key.

Output Signal Range Notes
g 0-1 A velocity signal. In Scale Play mode only white key hits are passed to the output. In Chromatic Mode, black key hits are also passed.
#scale (rotated) 0-4095 This is the input scale, bit-rotated to place the currently-played degree of scale in the tonic position (aka the LSB). This is necessary for bends or for “chording” modules to play all notes to scale, with that degree of the scale as root. (Think of it as climbing a ladder with rungs spaced according to a musical scale. The 3rd, 5th, 7th, etc above the root for that degree will be different depending on which rung [the root] you’re standing on!)
o(A/440 in key) floating-point Output as a standard A/440Hz octave value
o(Oct.deg no key) floating-point Output in the Octave.Degree format I have used with sequencers, where the output of the sequencer can be played in different keys

Size | 1-12 | The number of tones in the current scale

oct | ±integer | The current octave you’re in (remember, scales with fewer or more than 7 tones are possible. Only for seven-tone scales will all the tonic notes fall on the C key!
deg | 1-12 | The current degree of scale
Key | floating-point | The key (default is C below A440)
TRUE | 1 | Convenience output. Jumper to any of the Black Key Patch inputs to create TRUE/FALSE buttons.
momentary | zero or any value | Momentary output of the corresponding input, as long as the corresponding black key is pressed.
latched | zero or any value | Latched output of the corresponding input, until the corresponding black key is pressed again.

Controls

Button Function Notes
Mode Change play mode/change key Toggles into and out of Chromatic play mode. Whether the key is played in Scale Play or Chromatic mode, at the return to Scale Play mode the regular note of the last keyboard key hit is used as the tonic tone in scale play. In Chromatic mode, the black key patches are frozen at whatever state they were in at mode change. Momentary outputs are disabled. Time-varying signals at a black key patch will still appear at the latched output.
∆? Locks the Black Key Patches In White Key mode, the black key patches are frozen at their present state, as occurs in Chromatic mode. The button has no effect in Chromatic mode.

Displays

Name Note
White Keys Off-Tonic This tells you how many white keys you are away from the tonic white key at the original octave. Blue means you’re high. Flashing green/blue means you’re hi on-tonic. Flashing green/red means you’re low on-tonic. Red means you’re low. Green means you’re home!

ScreenShot 2021-05-17 at 10.01.19 PM



Version History

White Key Scale Player Module.audulus (222.2 KB)

Revision File
2021.05.13.01 Latched the tone output using a trigger that fires after the full interval and octave have been computed.
5 Likes

https://discourse.audulus.com/t/quick-quantizer-keyboard-version/1342/7

@stschoen made one that works with polyphony

1 Like

I saw that, then lost track of it somewhere in the subject hierarchy! Will take a look!

1 Like

I built it out and into a module format.

DEMO:
White Key Scale Module DEMO.audulus (625.6 KB)

MODULE:
White Key Scale Player Module v12.14.1.audulus (146.6 KB)

This completes the thought on this thing. I added a the black key functionality in the form of a patch bay, with a lockout feature.

The groups of five sharp/flat keys are mapped to five latching signal gates. In the demo I used the C# to drop you two octaves and the F#, G#, and Bb keys set alternate synth parameters. In the screenshot the gates are locked from changes (The ∆? light is red for “no!” and the active/inactive gates are showing yellow/violet—normally green/blue) but they default to active. These synths have a great “Boards of Canada” quality when you give them some hair, a fast attack, and a slow decay!

With short scales you’ll lay in more scales over the keyboard range, the effect of which is a rapid rise in pitch at positions far from key zero as you go down in your scales. Internally I made an attempt to keep the playing in the ballpark as you change scales by adjusting the octave in rough proportion to the size of the scale.

As you lay in non-standard scales, the root or tonic position will move around, which might be a nuisance if you’re trying to play in-key. If you’re not playing the tonic at your desired home/tonic position (by ear or by looking at the scale degree or the note display), wiggle the adjuster knob to set the degree of scale to one.

I also found that this thing can produce overwhelmingly high frequencies, and depending where you set the tonic, you may venture into areas where the keyboard remapping falls apart. To accommodate these ugly possibilities, I added a mute feature, with an indicator RGB light (everything has a cute indicator light—I love the dancing lights!) It’s either a lame patch to make up for lazy design or else it’s just a necessity. I’m not sure yet.

Key can be set by hitting the note you want, then tapping the button. After this, any white keys that are mapped to degree 1 will play that note. All keyboard keys are active for setting of the musical key, even if the black keys’ parallel functionality is currently active.

2 Likes

A very impressive execution of the same basic idea as my last effort. Certainly much more flexible since it has a much wider range of scales as well as the patch bay. I had experimented with making the shorter scales contiguous, but decided that for me it was easier to play if the octaves remained consistent. It also meant that I could normalize the octave, map a single octave and then just add the octave back in.

2 Likes

Thanks! I had to take it to completion, if only for the experience of accidently smoking the audio (not literally! A reboot fixed my ipad!) when I overlooked the simple fact that laying short scale octaves end to end and thoughtlessly playing would cause frequencies dogs can perhaps hear but the os can’t handle at all!

1 Like

Yeah, managing the contiguous short scales was a real pain. Setting a reference point — how to set the tonic at a desired key code — was tougher to implement than I’d expected. I’ll chalk that one up to sleep deprivation.
The other hurdle was a scheme for setting the octave reference for different scale lengths. My solution was a band-aid. Not well thought out. A decent solution, I think, would be to set octave zero to begin at the position of the midi key code the user pressed before setting the key. In my implementation of the key, I believe I was tossing that octave information.

1 Like

I find that often the things that appear the simplest, turn out to be the most difficult to implement. Because Audulus doesn’t have a defined order of execution, events that occur “simultaneously” can be difficult to deal with.

1 Like

I hear you. I’ve frequently used (cpu intensive, no doubt) little timers and the like to create intentional delays so I can specify order of operations, as well as controlling the state of things at start-up.

I built in that need, I guess, by designing my stuff around a play-speed clock, rather than by deriving the clock and other timing-critical processes from a higher-speed master clock.

Or not!

To your point, the assumption that some “easier method” is actally easier is only proven true by actually trying it!

In earlier times, before “visual programming” I would often build a state machine framework for just about anything timing-critical.

2 Likes

For clock timing delays I most often use a little one frame delay:
30%20PM
It utilizes the Feedback delay node to delay a clock by one frame

2 Likes

That’s great! I’ll have to try that. Obvious savings over any timer. I’ve used the feedback delay in the typical feedback situation, and in change testing

1 Like

Update to the white Key input module. Degree 1 (tonic) of the current scale is located an octave (seven white keys) below middle C. Set the key by pressing the white or black key corresponding to the desired root or tonic note and hitting the Key button. (At present, you must manually press the button, as mapping to a controller button results in the key changing to whatever midi note that button codes for—until the buttons in Audulus can be made midi channel-specific and not Omni, this will be a problem.)

White Key Scale Module DEMO 4.audulus (1.7 MB)

Changes: The scales are still contiguous. The starting point is just consistent now. If you change scales, the tonic will play at the same octave on the same specific white key.

Again, I followed convention by choosing a C key as the degree 1 key, even for scales that have fewer or greater than seven degrees. Of course only for seven-degree scales will all the tonics fall on a “C” key, but it’s convenient to have that one anchor white key remain the tonic as you change keys or scales.

One fun addition was the mapping of the modulation wheel to the loop controllers’ starting point controls. Each time a loop parameter changes, a sync pulse is generated by the loop controller. The pulses go to the “startup and external sync module” (just a big OR gate with one input a startup pulse generator). As you wiggle the modulation wheel, the loops reset to the the current startup sample and keep on playing. Setting the tone loop to less than 16 samples allows you to record different parts on different regions of the loop, in different scales even, with the subset loop length being a window on all the tones that you can move on the fly.

The diagram attempts to show the mappings I’ve set. Still, holding down a midi key (if in record mode) over 3 seconds will empty the part of the tone loop presently playing. It’s a second for the drum pads or buttons.

The rotary controllers set the upper and lower synth parameters and the tone- and drum-loop lengths. The pitch bend modifies the loop playback pitch.

To start recording, hit any Eb key and start playing white keys.

2 Likes

Next planned iteration will span the entire keyboard (less the very top octave, which is where the pads and buttons will reside and be stripped out of the midi keyboard stream—it’s currently the bottom of the keyboard).

Similar to what goes on here, except the white key values will start at zero (or 1, depending on implementation) and never go negative, and the white key to set scales’ tonic to is the first “C” to the left on the keyboard from the white or black key used to set the tonic pitch (aka “the key”. How annoying that in music, the “key” can be the pitch of the tonic of a scale as well as the physical “key” on a keyboard!)

I’ll still have limit-checking (especially for night pitches) to avoid overload for short scales, with the mute function to step in as protection.

I know this worry about setting the tonic to a C key on the keyboard would seem odd to an accomplished (or even passable) piano player, for whom the tonic falls on whatever physical key plays the tonic tone. In our case, the black keys don’t play, they’re just used to set the key of the piece. THe only sensible choice seems to be that C key, since even piano novices like me are familiar with the pattern.

1 Like

Hit the main goals on the player.

  1. The tonic will always fall on the first C key to the left of whichever key (black or white) you hit to set the musical key. That C key will always play the tonic (root) note, until you set a new key in a different octave on your keyboard.
  2. Any scale length, 1 to 12 tones, will work. Muting kicks in for frequencies too high. Tonic-only is kind of fun. Just that same note at each octave, up and down from the octave set when the key was set.
  3. To account for short scales, which can run frequencies up dangerously high, the mute function kicks in.
  4. The octave of play at the tonic remains the same as your swap scales.

White Key Scale Module DEMO 5.audulus (1.7 MB)

Set a key first! Hit any black or white key on the keyboard and tap the “Key” button. The note you just hit becomes the key. The keyboard is sampled chromatically when you set the key—you won’t always hear a tone, and the tone you hear when you set the key will be whatever the current settings let you hear. When you hit the tonic (degree1) you will hear the correct note.

Note: Eb key to turn on the looper.

3 Likes

White Key Scale Player Module v19.01.23.audulus (190.9 KB)

Hi y’all! I made some changes to the module and demo and added some text to explain operation. This should be it for a little while.

  1. Key setting portion.

a. Added a startup default key as C below A-440Hz, with tonic at the same physical C on the keyboard, so you can start making noise right away.

b. The “set key” button is now a mode switcher that happens to help you set the key. You hit the button to toggle the module from scale play mode into standard chromatic mode and again to switch back to scale play mode and set the key to the last note played. Tonic will be the C key to the left of whatever note you played, as before.

You don’t actually have to play any notes in chromatic mode to set the key. For example, If you know that you’ve just pressed the C# key—even if you didn’t hear anything because you were in scale play mode—hitting the mode switch twice will still set the key to C#.

In chromatic mode the black key patch states are locked, and the unaltered MIDI tones, including the black keys, will feed the solo synth and if it’s been set to receive midi, the looper.

  1. Other changes:

a. Some out-of-bounds sounds were getting out because I failed to effectively mute the gate signal. Out-of-bounds, as in freq too high (short scales), black key pressed, etc.
b. Moved the block of “no-play” midi notes from the bottom octaves below middle C to the top two above it. This won’t be necessary once we have selectable MIDI channels on the other control nodes.
c. Added lots of fairly detailed notes inside the module.
d. General cleanup.

  1. Demo

a. Added an octave up/down knob ahead of the looper.
b. Added some labelling text below each of the black key patches.
c. General cleanup.
d. Tap tempo module no longer does a sync of the phaser generating the output clock every time you tap. That was just a bad idea! Two taps within the timing tolerance will be accepted and will update the rolling average.

Don’s Tap Tempo v19.01.12.1.audulus (70.9 KB)

White Key Scale Module DEMO 8.audulus (1.8 MB)

Tonic-only scale works fine and it’s in there still. Just remember that it’s an octave per key with that scale, so you’ll need to restrict your playing to tonic, plus or minus three or four white keys.

1 Like

One bell and one whistle: A little RGB light and readout to tell you if your last key hit was on the tonic–which you would have set when setting key–or else how far away (in white keys) and in what direction. Red means you’re below it. Blue means you’re above it. Green means you’re on it. Otherwise same functionality. This is primarily useful if you’re using a 25-key controller and/or short scales.

White Key Scale Player Module v19.01.24.2.audulus (195.4 KB)

Demo:
White Key Scale Module DEMO 8.audulus (1.8 MB)

3 Likes

The keyboard for the demo was using midi channel 16. I switched it to Omni.

1 Like

Using the White Key Scale Player with on-the-fly scale swapping, scale bend, and in-scale bend

I decided that I wanted to be able to switch scales on a recorded looping sequence and have everything play properly. To do that I needed to record degrees of scale and octave, relative to the current key, rather than final intervals, which are basically set in stone.

Here’s a new clip, Done in A, pentatonic minor scale, demonstrating the “scale bend” and “in-scale bend” features. By “scale bend” I mean changing scale mid-song, with a loop already running. By “In-scale bend” I mean performing pitch bends that obey the current scale, rather than chromatic (or unquantized).

The main feature of this song is done by bit-rotation of the pentatonic scale, which has two empty chromatic tones from the first to the second degrees. That allows a one-bit then two-bit rotation to provide the lift (one bit rotetion) and drop back halfway down (2-bit rotation) to the ground (no rotation). I assigned the rotation fo my modulation wheel, limiting the patch to to two-bit max rotation over the 0 to 1 mod wheel range.

I’m posting this here because it has more to do with playing various scales than anything else.

White Key Scale Player - Tones Only 05.audulus (2.0 MB)

White Key Scale Player Demo

Demo features

  1. White Key Scale Player — maps any scale, from 1 to 12 tones — to the white keys only.
  2. 16-step looper — tap-tone, with a sustained tap removing earlier-recorded tones—up to and including itself if held down for one entire cycle of the looper (thus clearing the looper). Looper records tones in the sparkling new (and possibly unnecessary) hybrid format, with octave (above or below tonic octave) as a positive or negative integer, and a two-digit degree of scale to the right of the decimal point. If you switch scales while recording or playing a looped arpeggio, the loop will continue to play saved degrees of scale and octave offset from tonic from the sampler and set them to the new scale. After reconstituting in-scale tones from the sampler, the tones are then set to the saved key.
  3. In Chromatic mode, gate pulses to the looper are disabled.
  4. Solo channel has a new in-scale bend feature to give quantized bends, over a two octave total range, with a button to allow free-form bends over the same range. Chromatic bend can be done as well.
  5. Added a “scale bend” module, which in my setup is controlled by the modulation wheel. The default is zero, which leaves the scale unchanged. Maximum rotation is 11. Rotation is in one direction, with a rotation of one bit dropping the 2^nth bit to the 2^(n-1)th position, and raising the 2^0th bit (the tonic) to the 2^11th position. Since the scale queries and quantization modules honor the actual position
  6. Modified Pseudo Phaser, with a ModF input the set the rate off the LFO. A knob (set for me to track the modulation wheel) allows multiple parameters on the Pseudo Phaser to be controlled by the one midi controller wheel.
  7. Randomly (normally distributed about a mean) generated LFO for effects, the randomness coming by dividing the clock by random amounts. The internal phaser’s 0 to 2pi ramp is run through a spline to allow some wave shaping by dragging it around.
  8. A Hi/Lo velocity router, run from the LFO. LFO is scaled to span the range of velocities recorded, with the scaling performed anew with each new sample added to the looper. The router has two main outputs, one for hits higher than the current velocity threshold and another for those lower, that were rejected by the upper. Both can be turned off if desired.
  9. Two in-scale random tone walk generators (again normally distributed so they will have a melodic “home”) that add tones above or below the looper output. These also have a “follow the solo” mode that raises the current walk tone by the degree and octave being played.
  10. The scale selector now has lights to indicate the chosen scale. The selector has an external scale input which is fed by a custom scale input patch (which has independent scale display lights for reference . A value of zero at the ext input --no buttons pressed-- is interpreted by the scale selector patch as an instruction to use the scale indicated by the dial setting.
  11. Latest tap-tempo module. Larded up with new features. Open up the patch to read all about it. When you apply a trigger, it takes a five beats to complete its calculation of tempo. To change tempo, set the new drum machine tempo, then press the reset button for one second. The new tempo will be reached from 1 to
  12. Audio Beat Detector — basically a high-gain, tight bandwidth gain stage with an adjustable frequency and trigger level. I originally tried it as a handclap detector, but now it’s set to respond to the sync pulses from the drum generator.

Black Key Patch Bay

  • C# — connects the button-scale output to the scale selector’s ext input.
  • Eb — applies triggers from the scale player to the looper.
  • F# — enables the random tone walk feature.
  • Ab — enables the “follow the solo” mode.
  • Bb — connects the clock source to the tap-tempo generator.
5 Likes

Your music theory mathematics are next level dude! If I can learn a fraction of that amount in my lifetime, and figure out how to (usefully) apply it, I will be happy with myself lol. Great setup! :slightly_smiling_face:

2 Likes

Clearly the work of a mad scientist! I love it! :clap:

3 Likes