2025-03-22 (Sa) EWC_Soother Finished with scales

I cleaned up the scaling code by removing a while() loop that should have been a modulus. Learning this also proved that I could use a simple division command to calculate any note's octave while ignoring the specific pitch.

My plan for the day was to write the command that would automatically play a pseudo-random note anytime I pressed a key. The generated note would be in the same octave so that I could partially control the pitch range. My function:
    1 calculated the octave through integer math
    2 added a prandom value based on the selected scale
    3 changed the serialMessage[]
    4 recorded the new value in a 128-byte array.
When I released the key, I checked the array to see which note I had remapped to that key and released it instead. This way, I could play a prandom note, sustain as long as I wanted, and release it at will. If I played multiple keys in the same octave and duplicated a note, I could release a note I was still holding, but that was better than stuck notes. The keytar had two full octaves and the first key of a third octave, so I could access three octaves' notes.

Programming these scales was the primary purpose of this project, so the heaviest work is behind me.
Function to pseud-randomly play a note in its octave

The rest of the posts for this project have been arranged by date.
First time here?

Completed projects from year 1
Completed projects from year 2
Completed projects from year 3
Completed projects from year 4
Completed projects from year 5
Completed projects from year 6
Completed projects from year 7
Completed projects from year 8
Completed projects from year 9
Completed projects from year 10
Completed projects from year 11

Disclaimer for http://24hourengineer.blogspot.com and 24HourEngineer.com

This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.

All information on this blog, or linked by this blog, is not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property, or similar, is the responsibility of those involved in the replication.

All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by  Brian McEvoy, cannot be used to claim property or assets.

Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim property or assets based on their post.

This blog, including pictures and text, is copyright to Brian McEvoy.
2025-03-21

Comments