# Bytebeat

Bytebeat is a music synthesis technique that was discovered by Ville-Matias Heikkilä (viznut/pwp). Kragen Javier Sitaker has a good writeup on the subject. The way it works is that you generate a stream of 8-bit audio with the samples calculated by a function of sample index. This means that the song is defined by the function. In pure-form bytebeat, the function corresponds to a computer program that employs bit-wise and basic arithmetic operators, meaning that a small-sized formula would also have a small-sized implementation if realized in machine language or something like that. It may have been vital to Viznut's discovery that he experimented with a low 8 kHz sampling frequency. With high sampling frequencies, the flat spectral envelope arising from bit-wise operations and numerical wrapping makes the sound thin and harsh. I regretfully admit that initially I had doubts that the methodology would be able to produce anything else than glitch-y noise, but it turns out that some formulas produce songs suitable for a wider audience.

My bytebeat formulas are quite orthodox, but their construction is largely deterministic. There is still a lot of random trial and error both in fine-tuning of numerical values and in testing different structures for sub-formulas. As a principle I shy from direct summing of voices, avoid floating point stuff, and use a 8 kHz sampling frequency. It helps that I don't know the syntax of Javascript well enough to use anything but elementary operations. The most interesting ones of my songs are available as 44.1 kHz ogg downloads. For the rest, there's a link to a Javascript-based player. Prior to encoding this kind of material it is good to eliminate any constant DC bias and to normalize the audio in a way that clipping of Gibbs effect overshoots (from 8 kHz to 44.1 kHz upsampling) is eliminated. A gain value of -5 dB may be needed in worst case.

In general, mathematical equations cannot be copyrighted. Use these any way you like.

It would be interesting to try out bytebeat in balanced ternary, arguably the most beautiful number system. Also it would be good to try out the 44.1 kHz sampling fequency with some filtering to make the average spectral envelope more agreeable.

## Songs

### No 1

t*(t>>((t>>11)&15))*(t>>9&1)<<2

Play as Javascript, 8 kHz.

Quite a primitive piece. This could be used as the "melody" in some hardcore acid trance maybe. Has an arpeggiator and gating. Originally published at pouët.net BBS 2012-02-24.

### No 2

u=t>>10,8*t*t*(t>>u%3+15)/(3+(u&(u>>5&3|4)))|t>>4

Play as Javascript, 8 kHz (ogg, 1096 KiB).

A song with progression and a repeating pattern of chords. It has a bass drum, an arpeggiator derived from song No 1, and uses division to arrive at approximate note frequencies generated by a formula. Unfortunately, it gets a bit dissonant in the 4th quarter of the repeating pattern. Originally published at pouët.net BBS, 2012-02-24.

### No 3

t>>4+!(-t>>13&7)+2*!(t>>17)|t*t*(t>>(t>>12^t>>11)%3+10)/(7+(t>>10&t>>14&3))*!(t&512)<<3+(t>>14&1)

Play as Javascript, 8 kHz (ogg, 1363 KiB).

Quite similar in form to song No 2, but the progression is done using the bass drum. Has gating to make the ti-ti-ti-ti-ti-ti-ti. Has additional elements for fine-tuning of the sound.

t>>4|t*t*(t>>6&8^8)*(t>>11^t/3>>12)/(7+(t>>10&t>>14&3))

Play as Javascript, 8 kHz.

A no-frills variant with a somewhat simpler arpeggiator.

Originally published at pouët.net BBS, 2012-02-25.

### No 4

v=t/2^(t&64?63:0),v=v>>v,v/(1+(v>>7))&t/32|(t>>11)%8%3*t*t&15

Play as Javascript, 8 kHz (ogg, 869 KiB).

Monotonic minimalistic trance. Features a poor man's "sinusoidal" bassline that has a nice development coming out of the formula, driving the whole song forward. On top of that there's a bass drum making the bassline duck, and then there's a bit of high-frequency spice. Originally published at pouët.net BBS, 2012-02-26.

### One million alarm clocks

t*t/(t>>12&t>>8&63)<<7

Play as Javascript, 8 kHz.

This would make a really nasty ringtone or an alarm clock buzz. Originally published at pouët.net BBS, 2012-02-27.

### No 5

u=3*t>>t/4096%4&-t%(t>>16|16)*t>>14&8191,u/(u>>6|1)*4

Play as Javascript, 8 kHz (ogg, 1035 KiB)

This uses a kind of "loop sampler" of a nice smack!-kinda sound to create both a bass and a bass drum sound. The loops don't repeat evenly, creating an interesting polyrhythm. There's also an additional high-pitched sound. Originally published at pouët.net BBS, 2012-02-28.

## One thought on “Bytebeat”

1. Anonymous says:

I don’t have permission to listen to the song. the /music endpoint returns permission denied