Skip to content

Commit

Permalink
Add 'Antarctica' song. Fix typo (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
SthephanShinkufag committed May 2, 2022
1 parent f78cf90 commit 81b61e3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="JS algorhithmic music generator">
<meta name="description" content="JS algorithmic music generator">
<title>Bytebeat composer</title>
<link rel="canonical" href="https://dollchan.net/bytebeat/index.html"/>
<link rel="shortcut icon" href="favicon.png">
Expand Down
1 change: 1 addition & 0 deletions library/minified/SthephanShi - Antarctica.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions library/original/SthephanShi - Antarctica.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
t /= 44100, // Sample rate
bpm = 105, // Song speed
len = 256, // Song length
b = (bpm * t / 60) % len,

// Notes
C = 262, Db = 277, D = 294, Eb = 311, EE = 330, F = 349,
Gb = 370, G = 392, Ab = 415, A = 440, Bb = 466, B = 494,

// Wave modifier
wave = amp => amp * 1E-4 * sin(44 * t),

// Square arpeggiator
arp = echo => (i = b - echo, 25 * ((b & 16 ? 4 : 2) * (t + ((b & 32) && wave(6))) * [
C, D, G,
D, Gb, A,
EE, G, B,
D, Gb, A,
C * 2, D, G,
D * 2, Gb, B,
EE * 2, G, B,
D * 2, Gb, A
][3 * ((i >> 1) % 8) + int((b & 64 ? 22 : 2) * i) % 3] % 2 | 0)),

// Square bass pad
pad = (pitch, echo) => 20 * int(.7 * (pitch * (t + wave(4)) * [
C, D, EE, D, C, D, B / 2, C
][((b - echo) >> 1) % 8] % 2)),

// Hi-hats
((b & 16 | b & 32) &&
(1E4 * sin((128 * t * '11101000100010001100101010001000'[int(8 * b) % 32]) ** 2) & 255) / 10) +
// Kick
((b & 32) && 55 * int(b * (256 >> 32 * b) % 2)) +
// Arpeggio
arp(0) + .8 * arp(.4) + .6 * arp(.8) +
// Bass pad
pad(1, 0) + pad(1.5, 1) + .5 * pad(2, 1);
15 changes: 14 additions & 1 deletion library/sthephanshi.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
}]
}, {
"children": [{
"description": "Flying deep in dark space, you caught a distress signal and landed on an icy planet. In this frozen world, you have found an abandoned base of colonists. There is not a single survivor... "
"description": "\"Flying deep in dark space, you caught a distress signal and landed on an icy planet. In this frozen world, you have found an abandoned base of colonists. There is not a single survivor...\""
}, {
"description": "Frozen Planet",
"url": "https://battleofthebits.org/arena/Entry/Frozen+Planet/50767/",
Expand All @@ -306,5 +306,18 @@
"fileOriginal": true,
"starred": 2
}]
}, {
"children": [{
"description": "\"An endless world of snowy expanses, icebergs, and blue waters...\"<br>The instruments are the same as in \"Frozen Planet\", but the composition is based on playing with coefficients of square-wave arpeggiator and a sine modifier. A notes array is used to generate different sounds in different iterations."
}, {
"description": "Antarctica",
"url": "https://www.reddit.com/r/bytebeat/comments/ufxliq/antarctica/",
"date": "2022-05-01",
"sampleRate": 44100,
"file": "SthephanShi - Antarctica.js",
"fileMinified": true,
"fileOriginal": true,
"starred": 2
}]
}
]
3 changes: 2 additions & 1 deletion scripts/bytebeat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const loadScript = src => new Promise(resolve => {
}
});


globalThis.bytebeat = new class {
constructor() {
this.audioCtx = null;
Expand Down Expand Up @@ -448,6 +447,7 @@ globalThis.bytebeat = new class {
el.classList.contains('code-load-minified') ? 'minified' :
el.classList.contains('code-load-original') ? 'original' : ''
}/${ el.dataset.codeFile }`, true);
xhr.setRequestHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
xhr.send(null);
}
onclickCodeToggleButton(el) {
Expand Down Expand Up @@ -491,6 +491,7 @@ globalThis.bytebeat = new class {
containerEl.insertAdjacentHTML('beforeend', libraryHTML);
};
xhr.open('GET', `./library/${ containerEl.id.replace('library-', '') }.json`, true);
xhr.setRequestHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
xhr.send(null);
}
onresizeWindow() {
Expand Down

0 comments on commit 81b61e3

Please sign in to comment.