# Bytebeat Synthesizer

a web-based audio experimentation tool that allows you to create unique sounds and music using simple mathematical formulas!

run Bytebeat Synthesizer in browser

link to github

## What is Bytebeat?

Bytebeat is a method of creating audio by using short algorithms that produce samples directly. Each sample is generated by evaluating a mathematical expression, usually involving the sample index (traditionally represented as `t`

). The result of this expression is then interpreted as an audio sample.

## Credits

This project is inspired by the work of Viznut (Ville-Matias Heikkilä) and the Bytebeat community.

Before we dive in, I've got to give a massive shoutout to Viznut (aka Ville-Matias Heikkilä).His groundbreaking work inspires this whole project in Bytebeat. If you're curious about the origins of this mind-bending audio technique, definitely check out his stuff!

## So, what the heck is Bytebeat?

Imagine creating music with math. Sounds crazy, right? Well, that's Bytebeat in a nutshell. It's like cooking up audio using really short recipes made of numbers and symbols. Each "ingredient" (or sample) of sound comes from solving a tiny math puzzle. Cool, huh?

## The Building Blocks

Here's what we're playing with:

`t`

: Think of this as the clock of our weird little audio universe. It keeps ticking up as time passes.- Bitwise operations: These are like secret handshakes for numbers. We've got
`&`

(AND),`|`

(OR),`^`

(XOR),`~`

(NOT),`<<`

(left shift), and`>>`

(right shift). - The usual math suspects: Addition (
`+`

), subtraction (`-`

), multiplication (`*`

), division (`/`

), and that quirky remainder thing (`%`

, aka modulo).

## Let's Make Some Noise!

Ready to try your hand at this? Let's start simple:

```
t & t >> 8
```

Go ahead, paste that into the formula box up there and hit play. Sounds like a grumpy robot, doesn't it? That's your first Bytebeat! Here's what's happening:

`t >> 8`

is shifting the bits of`t`

to the right by 8 positions. This creates a slower-changing version of`t`

.`&`

then combines this slower version with the original`t`

, creating a rhythmic pattern.

## Time to Get Weird

Now that you've got the basics, let's crank it up a notch:

```
(t * 5 & t >> 7) | (t * 3 & t >> 10)
```

This bad boy is like two beats having an argument. Here's the breakdown:

`t * 5`

and`t * 3`

create two different "melodies"`t >> 7`

and`t >> 10`

create two different rhythms- The
`&`

operations combine each melody with its rhythm - Finally,
`|`

mixes these two patterns together

## Pro-Gamer Moves

1. Want to sound like a malfunctioning synthesizer? Try this FM-style madness:

```
t * t >> 8 & 63
```

This creates a frequency modulation effect:

`t * t`

gives us a rapidly increasing value`>> 8`

brings it back into a reasonable range`& 63`

keeps our values between 0 and 63, creating a repeating pattern

2. How about some bleepy-bloopy arpeggios?

```
t * (t>>11 & t>>8 & 123 & t>>3)
```

This creates a complex, arpeggio-like sound:

`t>>11`

,`t>>8`

, and`t>>3`

create different rhythmic patterns`& 123`

adds some tonal variation- Multiplying by
`t`

at the end gives us our rising and falling tones

3. Let's wrap that sound in a cozy envelope:

```
t * ((t>>12 | t>>8) & 63 & t>>4)
```

This creates a sound with a more complex envelope:

`t>>12 | t>>8`

creates a pattern of different lengths`& 63`

keeps our values in a specific range`& t>>4`

adds a slower-changing element to our envelope- Multiplying by
`t`

gives us our base tone

## Even More Bytebeat Magic

4. Want a funky bassline? Try this:

```
(t<<1)^((t<<1)+(t>>7)&t>>12)|(t>>4)
```

This formula creates a complex, funky bass sound:

`t<<1`

doubles the frequency of our base tone`(t<<1)+(t>>7)&t>>12`

creates a rhythmic pattern- The
`^`

(XOR) operation combines these for a unique timbre `| (t>>4)`

adds a slower-changing element for variety

5. How about some chip-tune style music?

```
t * ((t>>9 | t>>13) & 15) & 129
```

This formula gives us a sound reminiscent of old-school video game music:

`t>>9 | t>>13`

creates a pattern of different note lengths`& 15`

limits this to 16 different values, creating a scale-like effect`& 129`

adds a rhythmic on/off pattern to our sound- Multiplying by
`t`

gives us our base frequency

## Go Forth and Make Some Noise!

The best way to get this stuff? Just mess around! Tweak those formulas, smoosh different techniques together, see what kind of beautiful chaos you can create. Try changing some numbers, swapping operators, or combining parts of different formulas. Remember, there's no such thing as a mistake in Bytebeat -- sometimes the coolest sounds come from happy accidents!

## Want to Dive Deeper?

If you're hungry for more Bytebeat goodness, check out these awesome resources:

- Pouet.net's Bytebeat Thread -- Where the cool kids hang out
- Viznut's Formula Goldmine -- More formulas than you can shake a stick at
- HTML5 Bytebeat on GitHub -- For when you want to get your hands dirty
- Bytebeats -- A Beginner's Guide on lines -- Perfect for newbies
- The Night's Machines Bytebeat Guide -- A deep dive into the madness
- Viznut's Blog -- Where it all began
- Algorithmic Symphonies from One Line of Code -- Mind-bending stuff