SArpnt / bytebeat-composer

Bytebeat player with playlist that contains many interesting formulas from the Internet.
https://sarpnt.github.io/bytebeat-composer/
MIT License
13 stars 2 forks source link

THIS REPO IS NO LONGER USED!

the new website is at bytebeat.ficial.net, and the new repository is on disroot

bytebeat-composer

modern bytebeat player with a library of many formulas from around the internet.

originally forked from StephanShi's website to fix bugs and add features, now maintained independently with different codebases.

afaik this was the first bytebeat program that didn't have any major playback bugs (the two common ones are being unable to access functions like escape, and editing strings like "sin")
this program also works well with storing persistent variables, in this example b is used to store persistent variables

this.b??={a:0,b:0}, // this, window, and globalThis are all the same in this context
w=((t/(+"8654"[t>>11&3]+(t>>15&1))/10%1>.5)+1.5)*64,
c=sin(t/2e3)/6+.3,
b.b+=c*((b.a+=c*(w-b.a+(b.a-b.b)/.7))-b.b)

all iterable variables are deleted when the bytebeat is input, so variables between bytebeats don't conflict

Longline Theory and Information Theory are played correctly since a signed bytebeat mode has been added

syntax highlighting has been added, with a good amount of useful settings but nothing intrusive

stereo is supported by returning an array

warning

this website runs arbitrary code!

i've taken many security measures, but i can't guarantee what i've done is foolproof. as far as i can tell, this website should be secure, but this doesn't prevent:

on a secure browser the website should be safe, but i can't guarantee anything. If i've messed up anywhere then results could be much worse

to judge yourself, these are the security measures i've taken:

embedding

https://sarpnt.github.io/bytebeat-composer/embeddable.html is an embeddable version of the page, designed to be used in other projects. it doesn't have the library, doesn't save settings, and can recieve commands via postMessage

command format:

{
    show: { // show / hide webpage elements
        codeEditor: boolean,
        timeControls: boolean, // also prevents clicking the canvas to start/stop song
        playbackControls: boolean,
        viewControls: boolean,
        songControls: boolean,
        error: boolean,
        scope: boolean,
    },
    forceScopeWidth: number?, // force the scope width, non-numbers set back to auto
    getSong: boolean, // song will be sent to parent page in the format
    setSong: {
        code: string,
        sampleRate: number, // default 8000
        mode: string, // default "Bytebeat"
        // changes will be made later so that any settings that don't exist here won't be changed
    },
    // commands to control playback aren't implemented yet
}

any messages recieved will be in this format:

{
    song: { // sent on getSong
        code: string,
        sampleRate: number,
        mode: string,
    },
}

dead links

if any previously working links stop working, LET ME KNOW. link compatibility is supposed to stay permenantly.
if i'm unavalible or you're in a hurry, you can decode the links manually: