sugarlabs / musicblocks

Music Blocks -- A musical microworld
https://musicblocks.sugarlabs.org/
GNU Affero General Public License v3.0
558 stars 757 forks source link

Adjust pitches by cents #3919

Closed pikurasa closed 2 months ago

pikurasa commented 3 months ago

Current Behavior

Right now, we have ways of changing pitch, as well as calculating pitch changes, by scale degree and semi-tones. However, someone wouldn't be able to adjust a single pitch, where the change is expressed in cents. This can be useful to make small adjustments to make something sound more human, more vocal. It can be useful for microtonal music.

Desired Behavior

I imagine two new blocks:

  1. Transpose by cents -- In pitch palette; intended to adjust a single pitch by cents; useful in conjunction with Phrase Maker; perhaps adjustments made via Arbitrary in Temperament Widget would be expressed using this (as these pitches are derived neither by exponents nor ratios)
  2. Bend by cents -- In ornaments palette; intended as an ornament, where the pitch is shifted over a length of time. (Design TBD)
walterbender commented 2 months ago

@pikurasa do we really need a new block for transpose by pitch? Why not just use a real number for the existing semi-tone transpose block? e.g. 1.00 is one half-step. 0.10 is 10 cents.

pikurasa commented 2 months ago

Oh, that makes perfect "cents" to me. (Hadn't thought of doing it that way.)

walterbender commented 2 months ago

Screenshot from 2024-07-04 16-53-12 Screenshot from 2024-07-04 16-52-39

This'll need some testing... I imagine there are lots of corner cases. But it is basically working. I'll push it to a branch.

walterbender commented 2 months ago

Screenshot from 2024-07-05 07-17-20

This works too.

walterbender commented 2 months ago

Not been tested on temperaments with other than 12 notes. But in theory it should work.

pikurasa commented 2 months ago

I'll keep testing later, but it passes this somewhat ridiculous test:

cents-test.webm

Test file: cents-test.zip

walterbender commented 2 months ago

fun.