All Projects → greggman → Html5bytebeat

greggman / Html5bytebeat

Bytebeats in HTML5

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Html5bytebeat

Ofxpdsp
openFrameworks addon for audio synthesis and generative music
Stars: ✭ 255 (-7.94%)
Mutual labels:  audio, sound
Libvlc Go
Go bindings for libVLC and high-level media player interface
Stars: ✭ 188 (-32.13%)
Mutual labels:  audio, sound
Torch Audiomentations
Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning.
Stars: ✭ 164 (-40.79%)
Mutual labels:  audio, sound
Ni Media
NI Media is a C++ library for reading and writing audio streams.
Stars: ✭ 158 (-42.96%)
Mutual labels:  audio, sound
Fdsoundactivatedrecorder
Start recording when the user speaks
Stars: ✭ 227 (-18.05%)
Mutual labels:  audio, sound
Vuejs Sound Player
▶️ 🎹 🎵 HTML5 <audio> tag sound player UI for Vue.js - supports single, loop, pause/stop modes etc
Stars: ✭ 164 (-40.79%)
Mutual labels:  audio, sound
Sof
Sound Open Firmware
Stars: ✭ 183 (-33.94%)
Mutual labels:  audio, sound
Sound
🔊 A Vue composable for playing sound effects
Stars: ✭ 116 (-58.12%)
Mutual labels:  audio, sound
Mimium
mimium (MInimal Musical medIUM) a programming language as an infrastructure for sound and music.
Stars: ✭ 212 (-23.47%)
Mutual labels:  audio, sound
Ableton Live Tools
A collection of useful additions to @Ableton Live, including better @Git integration.
Stars: ✭ 198 (-28.52%)
Mutual labels:  audio, sound
Img Encode
Encode an image to sound and view it as a spectrogram - turn your images into music
Stars: ✭ 157 (-43.32%)
Mutual labels:  audio, sound
Swift Radio Pro
Professional Radio Station App for iOS!
Stars: ✭ 2,644 (+854.51%)
Mutual labels:  audio, sound
Sonant X
Small JavaScript synthesizer library
Stars: ✭ 154 (-44.4%)
Mutual labels:  audio, sound
Sono
A simple yet powerful JavaScript library for working with Web Audio
Stars: ✭ 164 (-40.79%)
Mutual labels:  audio, sound
React Native Sound Player
Play sound file in ReactNative
Stars: ✭ 144 (-48.01%)
Mutual labels:  audio, sound
Aubio
a library for audio and music analysis
Stars: ✭ 2,601 (+838.99%)
Mutual labels:  audio, sound
Wad
Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
Stars: ✭ 1,540 (+455.96%)
Mutual labels:  audio, sound
Simple Sdl2 Audio
A simple SDL2 audio library without SDL_Mixer for playing music and multiple sounds natively in SDL2
Stars: ✭ 111 (-59.93%)
Mutual labels:  audio, sound
Wavefile
A Ruby gem for reading and writing sound files in Wave format (*.wav)
Stars: ✭ 193 (-30.32%)
Mutual labels:  audio, sound
Gwion
🎵 strongly-timed musical programming language
Stars: ✭ 235 (-15.16%)
Mutual labels:  audio, sound

HTML5 Bytebeat

Bytebeat is the name of type of music made from math.

You provide a function who's only input is time t and from that write some code to generate a sound.

In this particular case t is an 8000hz timer that counts up. For example

sin(t) * 127 + 127

You can choose traditional bytebeat where the output of your function is expected to be 0 to 255 or you can choose floatbeat where the output is expected to be -1 to +1.

Functions are just plain JavaScript though sin, cos, tan, floor, ceil and int will automatically be converted to Math.sin, Math.cos, Math.tan, Math.floor, Math.ceil, and Math.floor respectively.

Click here to try your hand at Bytebeat.

Here are a few sample songs

Instructions

Modes

There 2 modes

  • bytebeat: Your expression is expected to generate byte values from 0 to 255
  • floatbeat: Your expression is expected to generate float values from -1.0 to 1.0

Expression Types

  • Infix: Standard expressions eg. "(t * 2) / 4"
  • Postfix(rpn): Reverse Polish Notation eg "t 2 * 4 /"
  • glitch: glitch format or glitch urls.

Infix is standard JavaScript so all Math functions are available. Most math functions you can drop the "Math." part. In other words

sin(t)

is the same as

Math.sin(t)

Postfix requires that each element have at least one space between it.

t2*    // BAD!
t 2 *  // Good!

If you're unfamiliar with postfix see below

Glitch is a format used by glitch machine for sharing. Examples

These can be prefixed with "glitch://". For example

There's a bunch more here. I have a feeling there's a bug or 2 left for full glitch support

Postfix

Postfix in this case I guess can be described as forth like. It works with a stack. Each command either adds things to the stack or uses what's on the stack to do something. For example

123       // pushes 123 on the stack               stack = 123
456       // pushes 456 on the stack               stack = 123, 456
+         // pop the stop 2 things on the stack
          // adds them, puts the result on the
          // stack                                 stack = 569

Note the stack is only 256 elements deep. If you push 257 elements it wraps around. Similary if you use pick with a large value your pick will wrap around. The stack is neither cleared nor reset on each iteration of your function. Some postfix based bytebeat songs take advantage of this where each iteration leaves things on the stack for the next iteration.

The postfix operators are

>, < ,=

These take the top two things from the stack, do the comparision, then push 0xFFFFFFFF if the result is true or 0x0 if the result is false. Think of it has follows: If the TOP thing on the stack is >, <, or = to the next thing on the stack then 0xFFFFFFFF else 0x0

drop

removes the top thing from the stack

dup

duplicates the top thing on the stack.

swap

swaps the top 2 things on the stack

pick

pops the top thing from the stack and duplicates one item that many items back. In other words if the stack is 1,2,3,4,5,6,7,3 then pick pops the top thing 3 and duplicates the 3rd thing back counting from 0, which is no 4. The stack is then 1,2,3,4,5,6,7,4.

Another way to look at it is dup is the same as 0 pick.

put

sets the n'th element from the top of the stack to the current top. In other words if the stack is 1,2,3,4,5,6,7,3,100 then put will pull the top 100 and then set the 3 element back. The stack will then be 1,2,3,4,100,6,7,3.

abs, sqrt, round, tan, log, exp, sin, cos, tan, floor, ceil, int min, max, pow

These operators all pop the top value from the stack, apply the operator, then push the result on the stack

/, +, -, *, %, >>, <<, |, &, ^, &&, ||:

These operators pop the top 2 values from the stack, apply the operator, then push the result. The order is as follows

b = pop
a = pop
push(a op b)

In other words 4 2 / is 4 divided by 2.

~

Pops the top of the stack, applies the binary negate to it, pushes the result.

Extra

Comments can be both // or /* */ style

There are several extra inputs available

The mouse position is available as mouseX and mouseY

sin(t * mouseX * 0.001) + cos(t * mouseY * 0.003)

The size of the window is available width and height

The orientation of a device may be available as tiltX and tiltY.

(sin(t * 0.1 * tiltX) + cos(t * tiltY * 0.07)) * 0.5

Also note, using the comma operator you can write fairly arbitrary code. See this example.

For more info

Check out http://canonical.org/~kragen/bytebeat/ and be sure follow the many links.

Special thanks to:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].