GlitchMachine 12-Dec-2011 10:49 PM
Edit FancyEdit New New Blog Upload All Recent Home Logout

Scott's Glitch Machine noise and sound programs

GlitchMachine is a cool programmable bytebeat app made by madgarden.

You can share your creations with it through a twitter interface, being that it uses a custom glitch: schema -- so you can click on the links in twitter, which loads the programs immediately into the app. Very nifty feature. Here is a saved twitter search of shared programs.

If you'd like to join a contest, you can check out the GlitchMachine Contests that might be currently running.

You can also use my Processing-based glitch player, which is available right here.

Some cool patterns

Here I will collect some songs and patterns that I've found from using it.

Simple Sequencer

One way to play "notes" is to store them as numbers on the stack, then walk through them using the PICK opcode to put those values on the stack. Here's an example of a 4 step sequencer that walks through 10,11,12,13. I'll annotate this one a bit. To enter the multiple numbers on one line, press: [1] [0] [EDIT] [1] [1] [EDIT]... and so on.

glitch:link

0   10 11 12 13      Our list of note data
1   t 11 >> 3 &      "Slow down" the ticks A LOT, and mask it off to be just 0..3
2   PICK             Use the above 0..3 as references onto the stack

At this point, the top of the stack contains 13, 12, 11, or 10, as time progresses. To slow it down change the "11" on line 1 to a different number. To add more items to the list, add them in line 0, and then change the '3' in line 1 to be a different number.

For example, this one walks through 8 items, and goes slower:

0   19 20 21 20 19 20 21 99
1   t 13 >> 7 & PICK

From here, to hear rudimentary tones, add the following to multiply it out.

3   t *

In the above, we're masking the value with 3 and 7. (b0011 and b0111) If you want to have a non-power-of-2 count to your list, you can modulo it instead, as shown in the following:

0   99, 98, 97, 10, 3
1   t 10 >> 5 % PICK

Triangle With Sequencer

After trying to make another triangle generator, I decided to add a sequencer to it. I'll annotate what every line in it does here.

glitch:link

It's currently set to show off the sequencer. Toggle line 6 "t" to switch back to the triangle generator.

0   t 2 *               Set up an input ramp wave for the triangle generator   (0..MAX*29)
1   511 & DUP DUP        Mask off just the lower 512 values                     (0..511), (0..511)
2   256 < DUP            build a conditional if it's in the lower half          (<256?), (0..511)           
3   2 PICK &             One half of the triangle generator is now done.        (TRI-A), (<256?), (0..511)
4   3 PICK ~ 2 PICK ~ &  Build the other half of the triangle                   (TRI-B), (TRI-A), (<256?), (0..511)
5   |                    Assemble the triangle wave.  (done with tri gen now)   (TRI), (<256?), (0..511)

The above is the triangle generator

6   t                    Re-insert the ramp, for testing the sequencer          t, (TRI), (<256?), (0..511)

But in line 6 here, we ignore the triangle generator, and re-insert the tick ramp. Toggle this line to switch back to the triangle waveform.

7   1 2 3 4 5 6 7 8      Notes for the sequencer                                8, 7, 6, 5, 4, 3, 2, 1, t, (TRI), (<256?), (0..511)
8   t 11 >> 7 & PICK     Pick a note from the above slowly (s)                  s, 8, 7, 6, 5, 4, 3, 2, 1, t, (TRI), (<256?), (0..511)
9   9 * PICK *           use that number * (TRI) to generate the waveform (n)   n, 8, 7, 6, 5, 4, 3, 2, 1, t, (TRI), (<256?), (0..511)

Triangle Wave 1

This is an attempt at a triangle wave. It's 4 lines of code, the first line is the "input" as it were.

glitch:link

  1. t 10 *
  2. 255 &
  3. DUP 128 < 1 & DUP
  4. 2 PICK 2 * *
  5. 1 PICK 0 = 1 &
  6. 3 PICK ~ 2 * * |

26 units, not including the first line.

I know i can get this significantly shorter. I'm working on that.

Fancy Pattern

glitch:link

  1. t 777 % t | t -

7 units

Spikeys

Some fun looking morphing spikes. glitch:link

  1. t 2 * t 3 << >>

7 units

Digital Static

Some kind of noise! I'm sure there's a more concise version that can be made. glitch:link

  1. t 2 / 7 *
  2. t 2 / 3 >> ^
  3. 20 % 6 << 6 % 6 <<

19 units

Phaser

Pew! Pew! glitch:link

  1. t
  2. DUP 255 % 128 <
  3. 1 PICK 2 * ^

11 units

Alarm

glitch:link

  1. t 10 *
  2. DUP 255 % 128 <
  3. 1 PICK 2 * ^

13 units

Looks Nifty

This one just kinda looks cool...

glitch:link

  1. t
  2. 255 % DUP *

5 units

Glitch: schema encoding

From what I can tell, this is the format:

-

a    t     time value
b    PUT   stack put
c    DROP  discards the top of the stack
d    *     multiply
e    /     divide
f    +     plus
g    -     minus
h    %     modulo
i    ?     (NOT USED)
j    <<    less than
k    >>    shift right
l    &     and
m    |     or
n    ^     xor
o    ~     invert
p    DUP   duplicate stack
q    PICK  stack pick
r    SWAP  swap stack
s    <     less than
t    >     greater than
u    =     equals
v    N/A
w    N/A
x    N/A
y    N/A
z    N/A

so the program: "t DUP 9 8 >> &" would encode to: "!ap9.8kl" for the full schema of glitch://example!ap9.8kl

(unsupported) DROP example: glitch://drop_Example!a!a!c