Skip to content

Instantly share code, notes, and snippets.

View petersalomonsen's full-sized avatar

Peter Salomonsen petersalomonsen

View GitHub Profile
/**
* Copyright (c) 2019 - Peter Johan Salomonsen - All rights reserved
*/
global.bpm = 110;
global.pattern_size_shift = 4;
// global.looptimes = 100;
// soloInstrument('bass');
@petersalomonsen
petersalomonsen / grooveisinthecode.js
Last active October 4, 2019 20:38
Music: Groove is in the code
global.bpm = 120;
global.pattern_size_shift = 4;
global.WASM_SYNTH_LOCATION = 'https://gist.githubusercontent.com/petersalomonsen/e49e3b861b57a9bbb8769b7cace43311/raw/08b47509211dbec1f578bb9590dd7b03b3084e2d/grooveisinthecode.wasm';
// global.looptimes = 100;
/*soloInstrument('pad1');
soloInstrument('pad2');
soloInstrument('pad3');*/
// soloInstrument('lead1');
import { StereoSignal } from "../synth/stereosignal.class";
import { Freeverb } from "../fx/freeverb";
import { DelayLine } from "../fx/delayline";
import { SAMPLERATE } from "../environment";
import { TriBandStereoCompressor } from "../fx/tribandstereocompressor";
import { EQBand } from "../fx/eqband";
import { SubPiano } from "../instruments/piano/subpiano";
import { Kick2 } from "../instruments/drums/kick2.class";
@petersalomonsen
petersalomonsen / wasmsong2.js
Last active January 12, 2021 12:25
Intro song for the music talk at WebAssembly summit 2020. Also available on spotify / soundcloud, song name is "Hondarribia" ( by Peter Salomonsen ) Go to: https://petersalomonsen.com/webassemblymusic/livecodev2/?gist=5b795090ead4f192e7f5ee5dcdd17392
/**
*
* "Hondarribia" - Intro song for the music talk at WebAssembly summit 2020
*
* Also available at spotify / soundcloud
* https://open.spotify.com/track/72SIjtJwJWggfl2nvHPptE?si=xUh-n4h7QCuR2McQCYie3Q
* https://soundcloud.com/psalomo/hondarribia
*
* Copyright (c) 2019-2020 - Peter Johan Salomonsen - All rights reserved
*
/**
* "WASM song"
* Copyright (c) 2019-2020 - Peter Johan Salomonsen - All rights reserved
*/
global.bpm = 123;
global.pattern_size_shift = 4;
// global.looptimes = 100;
@petersalomonsen
petersalomonsen / mix.ts
Last active September 29, 2020 19:59
instrumentstemplate
import { SineOscillator } from '../synth/sineoscillator.class';
import { SawOscillator } from '../synth/sawoscillator.class';
import { Envelope } from '../synth/envelope.class';
import { StereoSignal } from "../synth/stereosignal.class";
import { notefreq } from '../synth/note';
import { Noise } from '../synth/noise.class';
import { BandPass } from '../fx/bandpass';
import { SAMPLERATE } from '../environment';
import { BiQuadFilter, FilterType, Q_BUTTERWORTH } from '../synth/biquad';
import { createInstrumentArray } from '../common/mixcommon';
/**
* Copyright (c) 2019 - Peter Johan Salomonsen - All rights reserved
*/
global.bpm = 110;
global.pattern_size_shift = 4;
var pianoVoices = [];
for(let n=1;n<=8;n++) {
pianoVoices.push('piano'+n);
@petersalomonsen
petersalomonsen / buildandrun.sh
Created February 11, 2020 19:04
sin vs math.sin benchmark
./node_modules/.bin/asc -O3 --use Math=JSMath --runtime none test.ts -o test.wasm
node test.js
@petersalomonsen
petersalomonsen / 4klangfirstattempt.js
Last active March 18, 2020 18:52
"4klang first attempt" remake for WASM livecode env
/**
*
* "4klang first attempt" - originally made for 4klang, remake for livecode wasm env.
*
* Copyright (c) 2019-2020 - Peter Johan Salomonsen - All rights reserved
*
*/
global.bpm = 106;
global.pattern_size_shift = 4;
// 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 ));