Skip to content

Instantly share code, notes, and snippets.

View petersalomonsen's full-sized avatar

Peter Salomonsen petersalomonsen

View GitHub Profile
setBPM(90);
addInstrument('piano');
addInstrument('string');
addInstrument('drums');
addInstrument('guitar');
addInstrument('bass');
addInstrument('tubelead');
addInstrument('flute');
addInstrument('padsynth');
@petersalomonsen
petersalomonsen / shader.glsl
Created September 13, 2023 04:50
WebAssembly Music: "Much"
precision highp float;
uniform vec2 resolution;
uniform float time;
uniform float targetNoteStates[128];
float wave(float x, float freq, float speed, float amp) {
return amp * sin(x * freq + time * speed);
}
void main() {
@petersalomonsen
petersalomonsen / song.js
Last active August 21, 2023 19:36
sointu test song
global.bpm = 110;
global.pattern_size_shift = 4;
// global.looptimes = 100;
//soloInstrument('kick');
/*soloInstrument('pad1');
soloInstrument('pad2');
soloInstrument('pad3');*/
// soloInstrument('lead1');
@petersalomonsen
petersalomonsen / build.sh
Last active April 6, 2023 14:03
sointu renderer
../sointu/sointu-compile -arch amd64 ../sointu/temp_song_file.yml
# if you just want to redner a short version
# node rendershort.mjs
yasm -f macho64 -a x86 temp_song_file.asm --objfile=temp_song_file.o
MACOSX_DEPLOYMENT_TARGET=11 gcc -Wl,-no_pie -arch x86_64 temp_song_file.o test.c -o test
@petersalomonsen
petersalomonsen / song.js
Created May 21, 2022 06:17
WebAssembly Music - Veronika's Waltz
/*
* Copyright (c) 2022 - Peter Johan Salomonsen
*/
setBPM(50);
addInstrument('piano');
addInstrument('string');
addInstrument('drums');
addInstrument('guitar');
#version 100
precision highp float;
uniform vec2 resolution;
uniform float time;
vec3 hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
/*
* Copyright (c) 2021 - Peter Johan Salomonsen
*/
setBPM(85);
addInstrument('piano');
addInstrument('string');
addInstrument('drums');
addInstrument('guitar');
/*
* Copyright (c) 2021 - Peter Johan Salomonsen
*/
setBPM(100);
addInstrument('BoltToysPluck');
addInstrument('SphericalBowl');
addInstrument('KnotPressureModeled');
addInstrument('empty1');
@petersalomonsen
petersalomonsen / song.js
Last active September 4, 2021 10:23
Protracker Scripting - Amiga protracker module created in Javascript / Assemblyscript https://petersalomonsen.com/webassemblymusic/livecodev2/?gist=b9f7239aebb0c22d1d82a55520775afc
// SONGMODE=PROTRACKER
import { writeMod, cmd, clr } from './lib/protrackermodwriter.js';
import { createSamples } from './lib/instrumentgenerator.js';
import { createSampleEcho, insertNotesIntoPattern, insertSampleNotesIntoPattern, toPatternArray, createEmptyPatternArray } from './lib/patterntools.js';
onmessage = function(msg) {
const samples = createSamples(msg.data.WASM_SYNTH_BYTES, [
(instance) => {
instance.setChannelValue(0, 69 - (12 ));
@petersalomonsen
petersalomonsen / .gitignore
Last active April 5, 2021 10:58
WebAssembly music Revision 2021 Executable music competition entry by Peter Salomonsen
node_modules