Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Salomonsen petersalomonsen

View GitHub Profile
@petersalomonsen
petersalomonsen / song.js
Last active Jan 6, 2021
Physical modeling synthesis experiments with AssemblyScript
View song.js
/*
* Copyright (c) 2020 - Peter Johan Salomonsen
*/
setBPM(105);
addInstrument('piano');
addInstrument('string');
addInstrument('drums');
addInstrument('brass');
View song.js
/**
* "Fall"
*
* Spotify: https://open.spotify.com/track/0UtYDJwUGQO4OvCmPnGvZT?si=pB48erfcSeud45DKaWtfmQ
* Soundcloud: https://soundcloud.com/psalomo/fall
*
* Copyright 2020 - Peter Johan Salomonsen
*/
setBPM(100);
View song.js
// SONGMODE=YOSHIMI
setBPM(75);
createTrack(3).steps(4, [
controlchange(7, 83) // strings volume
]);
createTrack(1).steps(4, [
View song.js
/**
* Copyright 2020 - Peter Johan Salomonsen
*/
setBPM(120);
addInstrument('pad');
addInstrument('drums');
addInstrument('sawtap');
addInstrument('distlead');
View song.js
// SONGMODE=YOSHIMI
setBPM(75);
// ------- bass
createTrack(1).steps(4, [
d3(0.1),,d3(0.1),,
,d3(0.1),,d4(0.05),]);
// -------- piano
View song.js
/**
* Copyright 2020 - Peter Johan Salomonsen
*/
setBPM(100);
addInstrument('pad');
addInstrument('drums');
addInstrument('sawtap');
addInstrument('distlead');
@petersalomonsen
petersalomonsen / Makefile
Last active Jul 7, 2020
WebAssembly music to native executable
View Makefile
# replace with wasm2c location
WASM2C=/home/peter/git/wabt/wasm2c
all:
wasm2c song.wasm -o song.c
gcc -O3 -I$(WASM2C) main.c song.c $(WASM2C)/wasm-rt-impl.c -lm -lsoundio -o song
View song20200520.js
// SONGMODE=YOSHIMI
setBPM(80);
const lbd = () => c3(1/8,8);
const mbd = () => c3(1/8,35);
const bd = () => c3(1/8,45);
const lsd = () => e3(1/16,20);
const sd = () => e3(1/4,120);
View yoshimi_chill.js
// SONGMODE=YOSHIMI
/**
* "Chill And Feel" - (c) 2020 Peter Johan Salomonsen
*/
setBPM(100);
createTrack(5).steps(4,[controlchange(7, 120)]);
createTrack(2).steps(4,[controlchange(7, 100),controlchange(64, 0)]); // piano
View yoshimitest3.js
// SONGMODE=YOSHIMI
setBPM(75);
createTrack(0).steps(4, [e3]);
createTrack(2).play([[ 0.25, a5(0.15, 48) ],
[ 0.75, a5(0.26, 43) ],
[ 0.49, f6(0.58, 72) ],