Build 1505 - Lots of audio improvements


Build 1505 has just gone live, this includes masses of audio changes, you can now play multiple voices (polyphonic audio), and create tracks and patterns for music (or sound effects).

As with the rest of Prism, this is still a bit rough around the edges (you can't yet create sequences of patterns to create an actual song yet, and there's no nice way to edit music) but it's all exposed to JavaScript so you can create music through code.  The following is included as tune.js

var Audio = require("Audio")
var bell = Audio.env(Audio.square())
                .setAttack(1, 0.01)
                .setDecay(0.01)
                .setSustain(0.5, 0.25)
                .setRelease(0.5);
var snare = Audio.env(Audio.mul(Audio.sine(), Audio.noise()))
                .setAttack(1, 0.01)
                .setDecay(0.01)
                .setSustain(0.5, 0.01)
                .setRelease(0.125);
var p = Audio.pattern();
p.trackCount = 2;
      
//////
var t = p.tracks[0];
t.length = 16;
var r = t.rows;
r[8].set("C-6", bell);
r[9].set("G-6", bell);
r[10].set("C-6", bell);
r[11].set("E-6", bell);
r[12].set("C-6", bell);
r[13].set("D-6", bell);
r[14].set("C-6", bell);
//////
t = p.tracks[1];
t.length = 16;
r = t.rows;
r[0].set("C-4", snare);
r[1].set("E-4", snare);
r[2].set("A-4", snare);
r[4].set("C-4", snare);
r[5].set("E-4", snare);
r[6].set("A-4", snare);
r[8].set("C-4", snare);
r[9].set("E-4", snare);
r[10].set("A-4", snare);
r[12].set("C-4", snare);
r[13].set("E-4", snare);
r[14].set("A-4", snare);
//////
Screen.print(p);
p.beep(); // beep makes playback wait till the track has played

This should make a reasonable amount of sense to anyone who has experienced Tracker type music programs in the past.   First we define  two voices (a digital bell sound and a percussive snare).  Then we ask the Audio system to create a pattern, tell it that pattern contains two tracks, each track has 16 rows, then we push in notes and voices accordingly.

Build 1505 also now uses the SDL gamecontroller interface for the gamepad - this should hopefully standardise button mappings.   See the gamepad.js example.

Files

prism-384-win32-prealpha.zip 2.8 MB
Version 1505 May 13, 2018

Get Prism-384

Buy Now$5.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.