bytebeat home

references

a cheat sheet for when you're writing your own songs. new to bytebeat? start with the guide first.

operators

tthe sample counter. goes up by 1, 8000 times a second.
+ - * /normal math. + also mixes two sounds together.
%remainder. t % 256 does the same wrap bytebeat does anyway.
&bitwise and. keeps only the bits both sides share. & 128 makes a square wave.
|bitwise or. keeps bits from either side. gives a crunchy, glitchy mix.
^bitwise xor. keeps bits that are on in only one side.
>>shift right. >> 1 halves, >> 2 quarters, and so on. used for slow counters.
<<shift left. << 1 doubles.
~flips every bit. ~t counts down instead of up.
a > bcomparison. gives 1 if true, 0 if false.
[a, b, c][i]array. picks the item at position i (starting at 0).

operators run in this order, from first to last:

  1. * / %
  2. + -
  3. >> <<
  4. > <
  5. &
  6. ^
  7. |

if you're unsure, add brackets.

timing

at 8000 samples a second, each shift doubles how long a step lasts:

counterone stepgood for
t >> 10~0.13 sfast notes
t >> 11~0.26 sone beat
t >> 12~0.5 sa melody note
t >> 13~1 sa bar
t >> 14~2 sa chord
t >> 16~8 sa song section

add & 3, & 7 or & 15 to make the counter loop over 4, 8 or 16 steps.

snippets

building blocks you can copy into your song.

sawtooth

square

triangle

sine

noise

kick drum

beat pattern

things to know

  • the output wraps at 256, so keep the parts you add together small.
  • a line that starts with ( or [ joins onto the line above. end the line above with ;.
  • math functions work without Math., like sin(t), random() or PI.
  • doubling a number moves a note up one octave. 4 : 5 : 6 is a major chord.

turn your volume down

make sure to lower your sound! this is REALLY loud.