diff --git a/src/spessasynth_lib/midi_parser/midi_loader.js b/src/spessasynth_lib/midi_parser/midi_loader.js index 24ae04ec..9a1dd829 100644 --- a/src/spessasynth_lib/midi_parser/midi_loader.js +++ b/src/spessasynth_lib/midi_parser/midi_loader.js @@ -233,14 +233,14 @@ export class MIDI{ { const decoded = decoder.decode(messageData.slice(7, messageData.length - 3)) + "\n"; this.copyright += decoded; - console.log(`%cDecoded Roland SC message! %c${decoded}`, + console.info(`%cDecoded Roland SC message! %c${decoded}`, consoleColors.recognized, consoleColors.value) } } } this.tracks.push(track); - console.log(`%cParsed %c${this.tracks.length}%c / %c${this.tracksAmount}`, + console.info(`%cParsed %c${this.tracks.length}%c / %c${this.tracksAmount}`, consoleColors.info, consoleColors.value, consoleColors.info, @@ -260,7 +260,7 @@ export class MIDI{ } this.firstNoteOn = Math.min(...firstNoteOns); - console.log(`%cMIDI file parsed. Total tick time: %c${this.lastVoiceEventTick}`, + console.info(`%cMIDI file parsed. Total tick time: %c${this.lastVoiceEventTick}`, consoleColors.info, consoleColors.recognized); console.groupEnd(); @@ -300,7 +300,6 @@ export class MIDI{ message.messageStatusByte < messageTypes.systemExclusive ) === undefined) { - console.log("message", this.tracks[0]) let name = this.tracks[0].find(message => message.messageStatusByte === messageTypes.trackName); if(name) { diff --git a/src/spessasynth_lib/sequencer/sequencer.js b/src/spessasynth_lib/sequencer/sequencer.js index 49fb839e..568e7b67 100644 --- a/src/spessasynth_lib/sequencer/sequencer.js +++ b/src/spessasynth_lib/sequencer/sequencer.js @@ -257,7 +257,7 @@ export class Sequencer { */ this.duration = this.ticksToSeconds(this.midiData.lastVoiceEventTick); - console.log(`%cTOTAL TIME: ${formatTime(Math.round(this.duration)).time}`, consoleColors.recognized); + console.info(`%cTotal song time: ${formatTime(Math.round(this.duration)).time}`, consoleColors.recognized); this.midiPortChannelOffset = 0; this.midiPortChannelOffsets = {}; @@ -319,8 +319,6 @@ export class Sequencer { let elapsedTime = 0; let oneTickToSeconds = 60 / (120 * this.midiData.timeDivision); let eventIndex = 0; - - console.log("%cLoading note times for note rendering...", consoleColors.warn); while(eventIndex < events.length) { const event = events[eventIndex]; @@ -369,7 +367,7 @@ export class Sequencer { elapsedTime += oneTickToSeconds * (events[eventIndex].ticks - event.ticks); } - console.log("%cFinished loading note times and ready to render the sequence!", consoleColors.info); + console.info("%cFinished loading note times and ready to render the sequence!", consoleColors.info); this.renderer.connectSequencer(noteTimes, this); } @@ -823,7 +821,7 @@ export class Sequencer { break; default: - console.log(`%cUnrecognized Event: %c${event.messageStatusByte}%c status byte: %c${Object.keys(messageTypes).find(k => messageTypes[k] === statusByteData.status)}`, + console.info(`%cUnrecognized Event: %c${event.messageStatusByte}%c status byte: %c${Object.keys(messageTypes).find(k => messageTypes[k] === statusByteData.status)}`, consoleColors.warn, consoleColors.unrecognized, consoleColors.warn, diff --git a/src/spessasynth_lib/soundfont/chunk/modulators.js b/src/spessasynth_lib/soundfont/chunk/modulators.js index 11622233..f98473f0 100644 --- a/src/spessasynth_lib/soundfont/chunk/modulators.js +++ b/src/spessasynth_lib/soundfont/chunk/modulators.js @@ -1,7 +1,6 @@ import {signedInt16, readByte, readBytesAsUintLittleEndian} from "../../utils/byte_functions.js"; import { ShiftableByteArray } from '../../utils/shiftable_array.js'; import { generatorTypes } from './generators.js' -import { consoleColors } from '../../utils/other.js' import { midiControllers } from '../../midi_parser/midi_message.js' /** @@ -219,8 +218,6 @@ export const defaultModulators = [ }) ]; -console.log("%cDefault Modulators:", consoleColors.recognized, defaultModulators) - /** * Reads the modulator chunk * @param modulatorChunk {RiffChunk} diff --git a/src/spessasynth_lib/soundfont/soundfont_parser.js b/src/spessasynth_lib/soundfont/soundfont_parser.js index 79453a65..4eb7253d 100644 --- a/src/spessasynth_lib/soundfont/soundfont_parser.js +++ b/src/spessasynth_lib/soundfont/soundfont_parser.js @@ -238,7 +238,9 @@ export class SoundFont2 } } if(preset) { - console.info(`%cPreset at bank ${bankNr} not found. Replaced with ${preset.presetName}`, consoleColors.warn); + console.info(`%cPreset ${bankNr}.${presetNr} not found. Replaced with %c${preset.presetName} (${preset.bank}.${preset.program})`, + consoleColors.warn, + consoleColors.recognized); } } if(!preset) diff --git a/src/spessasynth_lib/synthetizer/synthetizer.js b/src/spessasynth_lib/synthetizer/synthetizer.js index 49c18d08..a5ff063e 100644 --- a/src/spessasynth_lib/synthetizer/synthetizer.js +++ b/src/spessasynth_lib/synthetizer/synthetizer.js @@ -28,7 +28,7 @@ export class Synthetizer { * @param soundFont {SoundFont2} */ constructor(targetNode, soundFont) { - console.log("%cInitializing SpessaSynth synthesizer...", consoleColors.info); + console.info("%cInitializing SpessaSynth synthesizer...", consoleColors.info); this.soundFont = soundFont; this.context = targetNode.context; @@ -89,7 +89,7 @@ export class Synthetizer { this.percussionPreset = this.soundFont.getPreset(128, 0); this.initializeSynthesisSystem(); - console.log("%cSpessaSynth is ready!", consoleColors.recognized); + console.info("%cSpessaSynth is ready!", consoleColors.recognized); } initializeSynthesisSystem() @@ -216,7 +216,7 @@ export class Synthetizer { * @param force {boolean} if we should instantly kill the note, defaults to false */ stopAll(force=false) { - console.log("%cStop all received!", consoleColors.info); + console.info("%cStop all received!", consoleColors.info); this.synthesisSystem.stopAllChannels(force); this.eventHandler.callEvent("stopall", {}); } @@ -240,7 +240,7 @@ export class Synthetizer { if(this.system === "gm") { // gm ignores bank select - console.log("%cIgnoring the Bank Select, as the synth is in GM mode.", consoleColors.info); + console.info(`%cIgnoring the Bank Select (${controllerValue}), as the synth is in GM mode.`, consoleColors.info); return; } let bankNr = controllerValue; @@ -295,7 +295,7 @@ export class Synthetizer { */ resetControllers() { - console.log("%cResetting all controllers!", consoleColors.info); + console.info("%cResetting all controllers!", consoleColors.info); for(let channelNumber = 0; channelNumber < this.synthesisSystem.channelsAmount; channelNumber++) { // reset @@ -478,7 +478,7 @@ export class Synthetizer { switch (type) { default: - console.log(`%cUnrecognized SysEx: %c${arrayToHexString(messageData)}`, + console.info(`%cUnrecognized SysEx: %c${arrayToHexString(messageData)}`, consoleColors.warn, consoleColors.unrecognized); break; @@ -490,17 +490,17 @@ export class Synthetizer { { if(messageData[3] === 0x01) { - console.log("%cGM system on", consoleColors.info); + console.info("%cGM system on", consoleColors.info); this.system = "gm"; } else if(messageData[3] === 0x03) { - console.log("%cGM2 system on", consoleColors.info); + console.info("%cGM2 system on", consoleColors.info); this.system = "gm2"; } else { - console.log("%cGM system off, defaulting to GS", consoleColors.info); + console.info("%cGM system off, defaulting to GS", consoleColors.info); this.system = "gs"; } } @@ -535,7 +535,7 @@ export class Synthetizer { if(messageData[7] === 0x00 && messageData[6] === 0x7F) { // this is a GS reset - console.log("%cGS system on", consoleColors.info); + console.info("%cGS system on", consoleColors.info); this.system = "gs"; return; } @@ -547,7 +547,7 @@ export class Synthetizer { const channel = [9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15][messageData[5] & 0x0F]; // for example 1A means A = 11, which corresponds to channel 12 (counting from 1) this.setDrums(channel, messageData[7] > 0 && messageData[5] >> 4); // if set to other than 0, is a drum channel - console.log( + console.info( `%cChannel %c${channel}%c ${this.synthesisSystem.midiChannels[channel].percussionChannel ? "is now a drum channel" : @@ -564,7 +564,7 @@ export class Synthetizer { if(messageData[4] === 0x40 && messageData[6] === 0x06 && messageData[5] === 0x00) { // roland master pan - console.log(`%cRoland Master Pan set to: %c${messageData[7]}%c with: %c${arrayToHexString(messageData)}`, + console.info(`%cRoland Master Pan set to: %c${messageData[7]}%c with: %c${arrayToHexString(messageData)}`, consoleColors.info, consoleColors.value, consoleColors.info, @@ -574,7 +574,7 @@ export class Synthetizer { else { // this is some other GS sysex... - console.log(`%cUnrecognized Roland %cGS %cSysEx: %c${arrayToHexString(messageData)}`, + console.info(`%cUnrecognized Roland %cGS %cSysEx: %c${arrayToHexString(messageData)}`, consoleColors.warn, consoleColors.recognized, consoleColors.warn, @@ -586,7 +586,7 @@ export class Synthetizer { { // this is a roland master volume message this.volumeController.gain.value = messageData[7] / 100 * DEFAULT_GAIN; - console.log(`%cRoland Master Volume control set to: %c${messageData[7]}%c via: %c${arrayToHexString(messageData)}`, + console.info(`%cRoland Master Volume control set to: %c${messageData[7]}%c via: %c${arrayToHexString(messageData)}`, consoleColors.info, consoleColors.value, consoleColors.info, @@ -595,7 +595,7 @@ export class Synthetizer { else { // this is something else... - console.log(`%cUnrecognized Roland SysEx: %c${arrayToHexString(messageData)}`, + console.info(`%cUnrecognized Roland SysEx: %c${arrayToHexString(messageData)}`, consoleColors.warn, consoleColors.unrecognized); } @@ -606,12 +606,12 @@ export class Synthetizer { // XG on if(messageData[2] === 0x4C && messageData[5] === 0x7E && messageData[6] === 0x00) { - console.log("%cXG system on", consoleColors.info); + console.info("%cXG system on", consoleColors.info); this.system = "xg"; } else { - console.log(`%cUnrecognized Yamaha SysEx: %c${arrayToHexString(messageData)}`, + console.info(`%cUnrecognized Yamaha SysEx: %c${arrayToHexString(messageData)}`, consoleColors.warn, consoleColors.unrecognized); } diff --git a/src/spessasynth_lib/synthetizer/worklet_system/worklet_system.js b/src/spessasynth_lib/synthetizer/worklet_system/worklet_system.js index b3a0c0e0..e5e260cc 100644 --- a/src/spessasynth_lib/synthetizer/worklet_system/worklet_system.js +++ b/src/spessasynth_lib/synthetizer/worklet_system/worklet_system.js @@ -584,7 +584,7 @@ export class WorkletSystem { setPitchBendRange(channel, semitones) { this.midiChannels[channel].channelPitchBendRange = semitones; - console.log(`%cChannel ${channel + 1} bend range. Semitones: %c${semitones}`, + console.info(`%cChannel ${channel} bend range. Semitones: %c${semitones}`, consoleColors.info, consoleColors.value); this.post({ @@ -628,6 +628,13 @@ export class WorkletSystem { switch(this.midiChannels[channel].NRPFine) { default: + console.info(`%cUnrecognized NRPN for %c${channel}%c: %c${this.midiChannels[channel].NRPCoarse} ${this.midiChannels[channel].NRPFine}%c data value: %c${dataValue}`, + consoleColors.warn, + consoleColors.recognized, + consoleColors.warn, + consoleColors.unrecognized, + consoleColors.warn, + consoleColors.value); break; // vibrato rate @@ -642,7 +649,7 @@ export class WorkletSystem { } addDefaultVibrato(); this.midiChannels[channel].vibrato.rate = (dataValue / 64) * 8; - console.log(`%cVibrato rate for channel %c${channel + 1}%c is now set to %c${this.midiChannels[channel].vibrato.rate}%cHz.`, + console.info(`%cVibrato rate for channel %c${channel}%c is now set to %c${this.midiChannels[channel].vibrato.rate}%cHz.`, consoleColors.info, consoleColors.recognized, consoleColors.info, @@ -668,7 +675,7 @@ export class WorkletSystem { } addDefaultVibrato(); this.midiChannels[channel].vibrato.depth = dataValue / 2; - console.log(`%cVibrato depth for %c${channel + 1}%c is now set to %c${this.midiChannels[channel].vibrato.depth} %ccents range of detune.`, + console.info(`%cVibrato depth for %c${channel}%c is now set to %c${this.midiChannels[channel].vibrato.depth}%c cents range of detune.`, consoleColors.info, consoleColors.recognized, consoleColors.info, @@ -694,7 +701,7 @@ export class WorkletSystem { } addDefaultVibrato(); this.midiChannels[channel].vibrato.delay = (dataValue / 64) / 3; - console.log(`%cVibrato delay for %c${channel}%c is now set to %c${this.midiChannels[channel].vibrato.delay} %cseconds.`, + console.info(`%cVibrato delay for %c${channel}%c is now set to %c${this.midiChannels[channel].vibrato.delay}%c seconds.`, consoleColors.info, consoleColors.recognized, consoleColors.info, @@ -747,7 +754,7 @@ export class WorkletSystem { setChannelTuning(channel, semitones) { this.midiChannels[channel].channelTuningSemitones = semitones; - console.log(`%cChannel ${channel + 1} tuning. Semitones: %c${semitones}`, + console.info(`%cChannel ${channel} tuning. Semitones: %c${semitones}`, consoleColors.info, consoleColors.value); this.post({ diff --git a/src/spessasynth_lib/utils/other.js b/src/spessasynth_lib/utils/other.js index fabe8576..09492786 100644 --- a/src/spessasynth_lib/utils/other.js +++ b/src/spessasynth_lib/utils/other.js @@ -43,7 +43,7 @@ export function calculateRGB(rgbString, operation) /** * Does what it says - * @param arr {ShiftableByteArray} + * @param arr {ArrayLike} * @returns {string} */ export function arrayToHexString(arr) { diff --git a/src/website/ui/synthesizer_ui/synthetizer_ui.js b/src/website/ui/synthesizer_ui/synthetizer_ui.js index ba906daf..b1a11511 100644 --- a/src/website/ui/synthesizer_ui/synthetizer_ui.js +++ b/src/website/ui/synthesizer_ui/synthetizer_ui.js @@ -409,11 +409,11 @@ export class SynthetizerUI LOCALE_PATH + "channelController.panMeter", this.locale, [channelNumber + 1], - -1, - 1, + 0, + 127, true, val => { - changeCCUserFunction(midiControllers.pan, (val / 2 + 0.5) * 127, pan); + changeCCUserFunction(midiControllers.pan, Math.round(val), pan); }, () => { this.synth.lockController(channelNumber, midiControllers.pan, true); @@ -421,7 +421,7 @@ export class SynthetizerUI () => { this.synth.lockController(channelNumber, midiControllers.pan, false); }); - pan.update(0); + pan.update(64); controller.appendChild(pan.div); // expression controller @@ -433,7 +433,7 @@ export class SynthetizerUI 127, true, val => { - changeCCUserFunction(midiControllers.expressionController, val, expression); + changeCCUserFunction(midiControllers.expressionController, Math.round(val), expression); }, () => { this.synth.lockController(channelNumber, midiControllers.expressionController, true); @@ -453,7 +453,7 @@ export class SynthetizerUI 127, true, val => { - changeCCUserFunction(midiControllers.mainVolume, val, volume); + changeCCUserFunction(midiControllers.mainVolume, Math.round(val), volume); }, () => { this.synth.lockController(channelNumber, midiControllers.mainVolume, true); @@ -473,7 +473,7 @@ export class SynthetizerUI 127, true, val => { - changeCCUserFunction(midiControllers.modulationWheel, val, modulation); + changeCCUserFunction(midiControllers.modulationWheel, Math.round(val), modulation); }, () => { this.synth.lockController(channelNumber, midiControllers.modulationWheel, true); @@ -493,7 +493,7 @@ export class SynthetizerUI 127, true, val => { - changeCCUserFunction(midiControllers.effects3Depth, val, chorus); + changeCCUserFunction(midiControllers.effects3Depth, Math.round(val), chorus); }, () => { this.synth.lockController(channelNumber, midiControllers.effects3Depth, true); @@ -513,7 +513,7 @@ export class SynthetizerUI 127, true, val => { - changeCCUserFunction(midiControllers.effects1Depth, val, reverb); + changeCCUserFunction(midiControllers.effects1Depth, Math.round(val), reverb); }, () => { this.synth.lockController(channelNumber, midiControllers.effects1Depth, true); @@ -685,17 +685,17 @@ export class SynthetizerUI case midiControllers.expressionController: // expression - this.controllers[channel].expression.update(Math.round(value)); + this.controllers[channel].expression.update(value); break; case midiControllers.mainVolume: // volume - this.controllers[channel].volume.update(Math.round(value)); + this.controllers[channel].volume.update(value); break; case midiControllers.pan: // pan - this.controllers[channel].pan.update((value - 63) / 64); + this.controllers[channel].pan.update(value); break; case midiControllers.modulationWheel: