From 47dd2262f7c13bf4618028922267a67f07d0bfb3 Mon Sep 17 00:00:00 2001 From: Francisco Demartino Date: Sun, 12 Apr 2020 02:41:05 -0300 Subject: [PATCH 1/2] Noise channels at 4 and 5 --- desktop/sources/scripts/interface.channel.js | 17 ++++++++++++----- desktop/sources/scripts/mixer.js | 12 +++++++----- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/desktop/sources/scripts/interface.channel.js b/desktop/sources/scripts/interface.channel.js index 990ea10..e94cff9 100644 --- a/desktop/sources/scripts/interface.channel.js +++ b/desktop/sources/scripts/interface.channel.js @@ -7,8 +7,8 @@ const Tone = require('tone') const OCTAVE = ['C', 'c', 'D', 'd', 'E', 'F', 'f', 'G', 'g', 'A', 'a', 'B'] const MAJOR = ['C', 'D', 'E', 'F', 'G', 'A', 'B'] const MINOR = ['c', 'd', 'F', 'f', 'g', 'a', 'C'] -const WAVCODES = ['si', 'tr', 'sq', 'sw', '2i', '2r', '2q', '2w', '4i', '4r', '4q', '4w', '8i', '8r', '8q', '8w'] -const WAVNAMES = ['sine', 'triangle', 'square', 'sawtooth', 'sine2', 'triangle2', 'square2', 'sawtooth2', 'sine4', 'triangle4', 'square4', 'sawtooth4', 'sine8', 'triangle8', 'square8', 'sawtooth8'] +const WAVCODES = ['br', 'pi', 'wh', 'si', 'tr', 'sq', 'sw', '2i', '2r', '2q', '2w', '4i', '4r', '4q', '4w', '8i', '8r', '8q', '8w'] +const WAVNAMES = ['brown', 'pink', 'white', 'sine', 'triangle', 'square', 'sawtooth', 'sine2', 'triangle2', 'square2', 'sawtooth2', 'sine4', 'triangle4', 'square4', 'sawtooth4', 'sine8', 'triangle8', 'square8', 'sawtooth8'] export default function ChannelInterface (pilot, id, node) { Interface.call(this, pilot, id, node, true) @@ -63,7 +63,11 @@ export default function ChannelInterface (pilot, id, node) { if (this.lastNote && performance.now() - this.lastNote < 100) { return } const name = `${data.note}${data.sharp}${data.octave}` const length = clamp(data.length, 0.1, 0.9) - this.node.triggerAttackRelease(name, length, '+0', data.velocity) + if (this.node.noise) { + this.node.triggerAttackRelease(length, '+0', data.velocity) + } else { + this.node.triggerAttackRelease(name, length, '+0', data.velocity) + } this.lastNote = performance.now() } @@ -87,6 +91,9 @@ export default function ChannelInterface (pilot, id, node) { if (data.mod && this.node.modulation) { this.node.modulation._oscillator.set('type', data.mod) } + if (data.wav && this.node.noise && data.wav != 'sine') { + this.node.set('noise.type', data.wav) + } this.lastOsc = performance.now() this.updateOsc(data) } @@ -108,7 +115,8 @@ export default function ChannelInterface (pilot, id, node) { this.updateOsc = function (data, force = false) { if (pilot.animate !== true) { return } if (force !== true && (!data || !data.isOsc)) { return } - setContent(this.osc_el, `${this.node.oscillator ? wavCode(this.node.oscillator._oscillator.type) : '--'}${this.node.modulation ? wavCode(this.node.modulation._oscillator.type) : '--'}`) + const oscCode = this.node.noise ? wavCode(this.node.noise._type) : (this.node.oscillator ? wavCode(this.node.oscillator._oscillator.type) : '--') + setContent(this.osc_el, `${oscCode}${this.node.modulation ? wavCode(this.node.modulation._oscillator.type) : '--'}`) } this.randEnv = function () { @@ -149,7 +157,6 @@ export default function ChannelInterface (pilot, id, node) { const velocity = msg.length >= 3 ? from16(msg.substr(2, 1)) : 0.66 const length = msg.length === 4 ? from16(msg.substr(3, 1)) : 0.1 const transposed = transpose(note, octave) - console.log(transposed) return { isNote: true, octave: transposed.octave, note: transposed.note, sharp: isUpperCase(transposed.note) === false ? '#' : '', string: `${octave}${note}`, length: length, velocity: velocity } } diff --git a/desktop/sources/scripts/mixer.js b/desktop/sources/scripts/mixer.js index 4ba0ad6..16b23b8 100644 --- a/desktop/sources/scripts/mixer.js +++ b/desktop/sources/scripts/mixer.js @@ -21,12 +21,14 @@ export default function Mixer (pilot) { this.channels[1] = new ChannelInterface(pilot, 1, new Tone.AMSynth({ 'harmonicity': 1.5, 'oscillator': { 'type': 'triangle8' }, 'modulation': { 'type': 'sawtooth' } })) this.channels[2] = new ChannelInterface(pilot, 2, new Tone.AMSynth({ 'harmonicity': 1.75, 'oscillator': { 'type': 'sawtooth8' }, 'modulation': { 'type': 'triangle' } })) this.channels[3] = new ChannelInterface(pilot, 3, new Tone.AMSynth({ 'harmonicity': 2, 'oscillator': { 'type': 'square8' }, 'modulation': { 'type': 'square' } })) - // AM - this.channels[4] = new ChannelInterface(pilot, 4, new Tone.AMSynth({ 'harmonicity': 1.25, 'oscillator': { 'type': 'sine4' }, 'modulation': { 'type': 'square8' } })) - this.channels[5] = new ChannelInterface(pilot, 5, new Tone.AMSynth({ 'harmonicity': 1.5, 'oscillator': { 'type': 'triangle4' }, 'modulation': { 'type': 'sawtooth8' } })) + + // Noise + this.channels[4] = new ChannelInterface(pilot, 4, new Tone.NoiseSynth({ 'type': 'white'})) + this.channels[5] = new ChannelInterface(pilot, 5, new Tone.NoiseSynth({ 'type': 'brown' })) + + // FM this.channels[6] = new ChannelInterface(pilot, 6, new Tone.FMSynth({ 'harmonicity': 1.75, 'modulationIndex': 10, 'oscillator': { 'type': 'sawtooth4' }, 'modulation': { 'type': 'triangle8' } })) this.channels[7] = new ChannelInterface(pilot, 7, new Tone.FMSynth({ 'harmonicity': 2, 'modulationIndex': 20, 'oscillator': { 'type': 'square4' }, 'modulation': { 'type': 'sine8' } })) - // FM this.channels[8] = new ChannelInterface(pilot, 8, new Tone.FMSynth({ 'harmonicity': 0.5, 'modulationIndex': 30, 'oscillator': { 'type': 'sine' }, 'modulation': { 'type': 'sawtooth4' } })) this.channels[9] = new ChannelInterface(pilot, 9, new Tone.FMSynth({ 'harmonicity': 2.5, 'modulationIndex': 40, 'oscillator': { 'type': 'sine' }, 'modulation': { 'type': 'triangle8' } })) this.channels[10] = new ChannelInterface(pilot, 10, new Tone.MonoSynth({ 'volume': -20, oscillator: { 'type': 'sawtooth4' } })) @@ -171,7 +173,7 @@ export default function Mixer (pilot) { }) } // Return to Osc Presets - this.run('0OSC8ISI;1OSC8RSW;2OSC8WTR;3OSC8QSQ;4OSC4I8Q;5OSC4R8W;6OSCTR8R;7OSCTR8I;8OSCTR4W;9OSCTR8R;AOSC4W--;BOSC4I--;COSCSI--;DOSCSW--;EOSCTR--;FOSCSQ--') + this.run('0OSC8ISI;1OSC8RSW;2OSC8WTR;3OSC8QSQ;4OSCWH--;5OSCBR--;6OSCTR8R;7OSCTR8I;8OSCTR4W;9OSCTR8R;AOSC4W--;BOSC4I--;COSCSI--;DOSCSW--;EOSCTR--;FOSCSQ--') // Return to Effects Presets this.run('BIT07;DIS00;WAH0F;CHE07;FEE00;TRE07;REV00;PHA0F;VIB01;CHO07') } From dd702f2914ad619bccbf52a605f3428483cd3fc0 Mon Sep 17 00:00:00 2001 From: Francisco Demartino Date: Sun, 12 Apr 2020 02:44:25 -0300 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cddb633..21c9a34 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The Play commands allows you to play synth notes. #### Settings -The Settings commands allow you to change the sound of the synth. The settings command format is a **channel** value between `0-G`, a 3 characters long **name**, followed by four values between `0-G`. The possible waveforms are `si`, `2i`, `4i`, `8i`, `tr`, `2r`, `4r`, `8r`, `sq`, `2q`, `4q` `8q`, `sw`, `2w`, `4w` and `8w`. +The Settings commands allow you to change the sound of the synth. The settings command format is a **channel** value between `0-G`, a 3 characters long **name**, followed by four values between `0-G`. The possible waveforms are `si`, `2i`, `4i`, `8i`, `tr`, `2r`, `4r`, `8r`, `sq`, `2q`, `4q` `8q`, `sw`, `2w`, `4w` and `8w`, and for noise `wh`, `pi`, `br`. | Command | Channel | Name | Info | | :- | :- | :- | :- |