EVEN BEAMS

Random Seeds in Orca

I can’t get Orca out of my mind. (Here’s a previous post if you haven’t seen it.) It’s been consuming my thoughts, in a good way. It’s weird but simple programing language offers a lot of constraints that lead to creativity and deep thought. It’s pretty fun thinking of something to try and do, trying to implement it, and stumbling on something else.

I started with another project, but then I veered off into adding a random seed to a project. The idea behind this is the seed for that session is set in stone, so the randomness is based off that seed. This means if you seed a random melody, it’ll stay the same throughout. Changing the seed gives you a whole new melody.

The first example, I must apologize for. There’s a lot of stuff that looks cool but does nothing. (This is a whole other side of Orca I love – just making it look cool. Probably will document more on this later.)

So the seed is in the upper right. It needs to be typed in every time you want to change seeds. It’s annoying, but the good part about this is that you can write down a seed, come back at a later date and input the same seed and it’ll be the same melody. Might be a cool idea for a live performance!

The seed does some needless adding and goes down until it’s assigned to a bunch of variables.

The next part has 5 lines with a bunch of notes (and some rests) all across. This is what the random seed will choose from. I made it this way, instead of writing a smaller script that randomly picks a note from the key, because 1) it looks cool and 2) I can determine the probability of each note. Like if I wanted the first note to be a 50% chance of a C, I could easily fill in half the line with Cs.

The variable picks a note from the line, and then it’s sent to a pretty small tracker on the bottom. You can change the patterns on how it rolls through this for more melody choices.

This next example took me a LOT of thinking and trial and error. I’m sure there’s a better way of doing this, but this is what I found.

For this script, I wanted to automatically generate a seed and keep it throughout the running of the program. The problem with Orca, is all the operands that generate things loop back around. And anything generated on the screen doesn’t clear when you reset the clock. I finally stumbled on using the $TIME function, which shows the current runtime of the script with a 4 digit number that ticks up every second.

I’m very bad at math, but I figured there was something there. So I found out if I add up all 4 digits, it’ll start out at 0 and not hit 0 again until 9999. (In Orca, when you add up numbers, it restarts at 36 because 26 letters + 10 digits. So 20 is j, and 20 + 20 = 4. Or j + j = 4. I know this doesn’t make sense. It doesn’t matter.)

Anyway, 0 doesn’t repeat again for a long time (2 hours and 46 minutes). So I used that to my advantage to start a row of Halts. This halts the operand under it, so it freezes my Random. It keeps sending H down the line, but doesn’t return to 0 for awhile. (When H bangs an operand again, it sets it off and freezes it again. So if you keep halting a random, it keeps picking a different value.)

I can do two frozen randoms on each line, so three lines give me a 6 digit seed. Then I just assign those to variables, and put it into my note-picker and tracker from the previous example.

If I want a new melody, I hit Ctrl+Shift+R which resets the clock and generates me a new seed! It’s much quicker than the previous script. The only downside is it’s harder to save a seed and put it back in.