petersalomonsen / javascriptmusic

A.K.A. WebAssembly Music. Live coding music and synthesis in Javascript / AssemblyScript (WebAssembly)
https://petersalomonsen.com
GNU General Public License v3.0
380 stars 32 forks source link

yoshimi web-audio-modules #8

Closed petersalomonsen closed 4 years ago

petersalomonsen commented 4 years ago

add support for yoshimi web-audio-modules synth

example song and synth configuration:

http://localhost:5000/?gist=fa27d56299a3475e90e8128b75df8f17

video demo:

https://youtu.be/HH92wXnP4WU

add new sequencer type which is midi oriented, and simpler way of coding a song:

// SONGMODE=YOSHIMI
setBPM(120);
const drums = createTrack(1, 4); // channel 1, 4 steps per beat
const base = createTrack(7, 4);  // channel 7, 4 steps per beat
const pad = createTrack(0, 4);   // channel 0, 4 steps per beat

const drumtrack = async () => drums.steps(4,[
        [c3,gs3(1,40)],,gs3(1,20),,
        [d3(1,127),gs3(1,40)],,gs3(1,20),,
        [c3,gs3(1,40)],,[c3,gs3(1,40)],,
        [d3(1,127),gs3(1,40)],,[c3,gs3(1,40)],,
      ]);

for(let n=0;n<2;n++) {  
  pad.steps(2, [
    ,a5,d6,f6,
    e6,,c6,d6
  ]);

  base.steps(4, [
    d3,,d4,,f3,,a4,,
    a2,,a3,,c3,,c4
  ]);

  await drumtrack()

  base.steps(4, [
    d3,,d4,,f3,,a4,,
    a2,,a3,,c3,,c4
  ]);

  await drumtrack();
}

pad.steps(2, [
  ,g5,c6,g5,
  f6,,e6,c6
]);

base.steps(4, [
  c3,,c4,,e3,,g4,,
  g2,,g3,,as3,,as4
]);

await drumtrack();
base.steps(4, [
  c3,,c4,,e3,,g4,,
  g2,,g3,,as3,,as4
]);

await drumtrack();

pad.steps(2, [
    ,a5,d6,f6,
    e6,,c6,d6
  ]);

base.steps(4, [
  d3,,d4,,f3,,a4,,
  a2,,a3,,c3,,c4
]);

await drumtrack();

base.steps(4, [
  d3,,d4,,f3,,a4,,
  a2,,a3,,c3,,c4,d4(1/8)
]);

await drumtrack();

loopHere();