Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a little chore, missing features and encoding #14

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

GottZ
Copy link

@GottZ GottZ commented Apr 15, 2024

Hello there.

I've tried to split my changes into separate commits but sadly git put individual changes into the same hunks so.. it is somewhat readable if you go through each commit one by one for review.

I'll extend the readme later, to document the new features a little.

in essence, this module is now auto-reconnecting to voicemeeter in case the api just got terminated for a moment.

apart from that, it will also expose a new api that can be used like this:

voicemeeter.api["Bus[0].FadeTo"] = "(-30, 200)";
console.log(voicemeeter.api["Bus[0].Device.name"]);
voicemeeter.api["Bus[0].Device.wdm"] = "Totally Amazing Soundbar 2000";
voicemeeter.api["Option.delay[0]"] = 23.515123;

and so on.

I've also replaced ansi with utf16 both ways so audio devices like in non-american languages like "Kopfhörer" are properly encoded now.

especially this commit also changes the encoding

@GottZ GottZ marked this pull request as draft April 15, 2024 20:56
@GottZ
Copy link
Author

GottZ commented Apr 15, 2024

just to give a sneak peek at what I'm adding right now:
image

this will translate all the api functions from docs to proper mappings.
I'm also writing a translation script, that generates a proper object structure, that can then both be served without post-computation and can also receive docblocks.

it would then allow usage like: voicemeeter.Strip[2].Comp(5.6) to set a value and voicemeeter.Strip[0].GainLayer[3]() to get a value

@GottZ
Copy link
Author

GottZ commented Apr 16, 2024

Finally some usable api documentation taken off this api documentation..

the following is just some dumb pseudocode I just came up with but it's not hard to translate, thus I'm going to write a translator that can easily be extended with new api calls in future.
it will just pop out a d.ts file.
I'll also figure out a way to shove this into a recursive proxy generator.

in essence, #define will set a named type.
each type is either int, float or string.
if it's float, it has to contain x.x notation
if it's a list, it has to be comma separated.
if it's a range, it has to contain ..
if it's a mix, that's also valid and can be used for api safeguarding.
if it has a "string" behind it, it's a comment for said argument.
the first part defines the call to the api. if a % is met, it will be replaced with the next arguments in order.
the last argument will be the return type / setter type
rw / r / w signals if this function can be read from, wrtitten to or interacted with.
the last "string" is a comment for the api call
#title defines the top line in the doctype comment
#comment defines the general section of the doctype comment
if either is encoutered, it overrides the previous.

#define bus 0..8 bus id
#define physicalbus 0..5 physical bus id
#define strip 0..8 strip id
#define physicalstrip 0..5 physical strip id
#define vban 0..8 vban id
#define gain -60.0..12.0 gain value (dB)
#define bool 0,1 boolean value
#define uint16 0..65535 uint16 value
#define uint53 0..9007199254740991 uint53 value. maximum safe integer in javascript
#define samplerate 11025,16000,22050,24000,32000,44100,48000,88200,96000 samplerate value
#define color 0..8 color index

#title Special Commands
#comment These commands trigger Voicemeeter actions
Command.Shutdown 1 w Shutdown Voicemeeter
Command.Show bool w Show Voicemeeter
Command.Restart 1 w Restart Audio Engine
Command.Eject 1 w Eject Cassette
Command.Reset 1 w Reset All configuration
Command.Save string "Complete filename (xml)" w Save configuration to file
Command.Load string "Complete filename (xml)" w Load configuration from file
Command.Lock bool w (Un)Lock GUI (Menu option)
Command.Button[%].State uint16 bool w Change Macro Button State
Command.Button[%].StateOnly uint16 bool w Change Button State only
Command.Button[%].Trigger uint16 bool w Change Trigger Enable State
Command.Button[%].Color uint16 color w Change the Button Color
Command.DialogShow.VBANCHAT bool w Show VBAN-Chat Dialog
Command.SaveBUSEQ[%] bus string "Complete filename (xml)" w Save BUSEQ to file
Command.LoadBUSEQ[%] bus string "Complete filename (xml)" w Load BUSEQ from file
Command.SaveStripEQ[%] strip string "Complete filename (xml)" w Save Strip EQ to file
Command.LoadStripEQ[%] strip string "Complete filename (xml)" w Load Strip EQ from file
Command.Preset[%].Recall uint16 1 w Recall Preset Scene

#title Input Strip Parameters
#comment Strip index is zero based. 3 strips on Voicemeeter, 5 on Banana, 8 on Potato.
Strip[%].Mono strip bool rw Mono Button
Strip[%].Mute strip bool rw Mute Button
Strip[%].Solo strip bool rw Solo Button
Strip[%].MC strip bool rw Mute Center Button
Strip[%].Gain strip gain rw Gain slider (dB)
Strip[%].GainLayer[%] strip bus gain rw Gain slider for a bus (dB)
Strip[%].Pan_x strip -0.5..0.5 rw -0.5 to 0.5 for 5.1 pan pot x-axis
Strip[%].Pan_y strip 0.0..1.0 rw 0.0 to 1.0 for 5.1 pan pot y-axis
Strip[%].Color_x physicalstrip -0.5..0.5 rw Physical Strip Only
Strip[%].Color_y physicalstrip 0.0..1.0 rw Physical Strip Only
Strip[%].fx_x physicalstrip -0.5..0.5 rw Physical Strip Only
Strip[%].fx_y physicalstrip 0.0..1.0 rw Physical Strip Only
Strip[%].Audibility strip 0.0..10.0 rw Voicemeeter 1 only
Strip[%].Comp strip 0.0..10.0 rw Compressor Knob
Strip[%].Comp.GainIn strip -24.0..24.0 rw COMP: Input Gain (dB)
Strip[%].Comp.Ratio strip 1.0..8.0 rw COMP: Ratio
Strip[%].Comp.Threshold strip -40.0..-3.0 rw COMP: Threshold (dB)
Strip[%].Comp.Attack strip 0.0..200.0 rw COMP: Attack Time (ms)
Strip[%].Comp.Release strip 0.0..5000.0 rw COMP: Release Time (ms)
Strip[%].Comp.Knee strip 0.0..1.0 rw COMP: Knee
Strip[%].Comp.GainOut strip -24.0..24.0 rw COMP: Output Gain
Strip[%].Comp.MakeUp strip bool rw COMP: Auto Make Up Option
Strip[%].Gate strip 0.0..10.0 rw Gate Knob (index)
Strip[%].Gate.Threshold strip -60.0..-10.0 rw GATE: Threshold (dB)
Strip[%].Gate.Damping strip -60.0..10.0 rw GATE: Damping Max (dB)
Strip[%].Gate.BPSidechain strip 100.0..4000.0 rw GATE: Band Pass Sidechain (Hz)
Strip[%].Gate.Attack strip 0.0..1000.0 rw GATE: Attack Time (ms)
Strip[%].Gate.Hold strip 0.0..5000.0 rw GATE: Hold Time (ms)
Strip[%].Gate.Release strip 0.0..5000.0 rw GATE: Release Time (ms)
Strip[%].Denoiser strip 0.0..10.0 rw Denoiser Knob
Strip[%].Denoiser.Threshold strip 0.0..10.0 rw Noise Floor Removal Threshold
Strip[%].Pitch.On strip bool rw Enable Pitch Fx
Strip[%].Pitch.DryWet strip -100.0..100.0 rw Dry / Wet Balance
Strip[%].Pitch.PitchValue strip -12.0..12.0 rw Pitch Value (semi tone)
Strip[%].Pitch.LoFormant strip -12.0..12.0 rw Pitch Value (semi tone)
Strip[%].Pitch.MedFormant strip -12.0..12.0 rw Pitch Value (semi tone)
Strip[%].Pitch.HiFormant strip -12.0..12.0 rw Pitch Value (semi tone)
Strip[%].Karaoke strip 0..4 rw OFF or one of 4 karaoke algorithms
Strip[%].Limit strip -40.0..12.0 rw Limiting Gain (dB)
Strip[%].EQGain1 strip -12.0..12.0 rw Virtual Strip Only (dB)
Strip[%].EQGain2 strip -12.0..12.0 rw Virtual Strip Only (dB)
Strip[%].EQGain3 strip -12.0..12.0 rw Virtual Strip Only (dB)
Strip[%].Label strip string "Microphone etc." rw Strip Label
Strip[%].A1 strip bool rw Out BUS Assignment
Strip[%].A2 strip bool rw Out BUS Assignment
Strip[%].A3 strip bool rw Out BUS Assignment
Strip[%].A4 strip bool rw Out BUS Assignment
Strip[%].A5 strip bool rw Out BUS Assignment
Strip[%].B1 strip bool rw Out BUS Assignment
Strip[%].B2 strip bool rw Out BUS Assignment
Strip[%].B3 strip bool rw Out BUS Assignment
Strip[%].FadeTo strip string "(dB Target, msTime)" rw Fade to Target Gain
Strip[%].FadeBy strip string "(dB relativechange, msTime)" rw Fade Gain by relative change
Strip[%].Reverb strip 0.0..10.0 rw Send Level to Reverb
Strip[%].Delay strip 0.0..10.0 rw Send Level to Delay
Strip[%].Fx1 strip 0.0..10.0 rw Send Level to External Fx1
Strip[%].Fx2 strip 0.0..10.0 rw Send Level to External Fx2
Strip[%].PostReverb strip bool rw Post Reverb button
Strip[%].PostDelay strip bool rw Post Delay button
Strip[%].PostFx1 strip bool rw Post Fx1 button
Strip[%].PostFx2 strip bool rw Post Fx2 button
Strip[%].EQ.on strip bool rw EQ Button
Strip[%].EQ.AB strip bool rw EQ Memory Slot A/B
Strip[%].VAIO physicalstrip bool rw Physical strip only
Strip[%].EQ.channel[%].cell[%].on strip 0..7 0..5 bool rw EQ cell On/Off
Strip[%].EQ.channel[%].cell[%].type strip 0..7 0..5 0..6 rw EQ cell Type
Strip[%].EQ.channel[%].cell[%].f strip 0..7 0..5 10.0..35000.0 rw EQ cell Frequency (Hz)
Strip[%].EQ.channel[%].cell[%].gain strip 0..7 0..5 -12.0..12.0 rw EQ cell Gain (dB)
Strip[%].EQ.channel[%].cell[%].q strip 0..7 0..5 1.0..100.0 rw EQ cell Quality
Strip[%].App[%].Gain strip string "Skype etc." 0.0..1.0 rw Application gain
Strip[%].App[%].Mute strip string "Skype etc." bool rw Application Mute
Strip[%].AppGain strip string "(AppName, Gain 0.0-1.0)" rw Application gain
Strip[%].AppMute strip string "(AppName, Mute 0/1)" rw Application Mute
Strip[%].device.name physicalstrip string "Device Name" r read physical strip device name
Strip[%].device.sr physicalstrip samplerate "Sample Rate" r read physical strip device sample rate
Strip[%].device.wdm physicalstrip string "Device Name" w Set physical strip WDM device
Strip[%].device.ks physicalstrip string "Device Name" w Set physical strip KS device
Strip[%].device.mme physicalstrip string "Device Name" w Set physical strip MME device
Strip[%].device.asio physicalstrip string "Device Name" w Set physical strip ASIO device

#title Bus Parameters
#comment Bus index is zero based. 2 buses on Voicemeeter, 5 on Banana, 8 on Potato.
Bus[%].Mono bus 0..2 "off/mono/stereo reverse" rw Mono Button
Bus[%].Mute bus bool rw Mute Button
Bus[%].EQ.on bus bool rw EQ Button
Bus[%].EQ.AB bus bool rw EQ Memory Slot A/B
Bus[%].Gain bus gain rw Gain slider (dB)
Bus[%].Label bus string "Bus Label" rw Bus Label
Bus[%].mode.normal bus bool rw Normal Mode
Bus[%].mode.Amix bus bool rw A Mix Mode
Bus[%].mode.Bmix bus bool rw B Mix Mode
Bus[%].mode.Repeat bus bool rw Repeat Mode
Bus[%].mode.Composite bus bool rw Composite Mode
Bus[%].mode.TVMix bus bool rw TV Mix Mode
Bus[%].mode.UpMix21 bus bool rw UpMix 2.1 Mode
Bus[%].mode.UpMix41 bus bool rw UpMix 4.1 Mode
Bus[%].mode.UpMix61 bus bool rw UpMix 6.1 Mode
Bus[%].mode.CenterOnly bus bool rw Center Only Mode
Bus[%].mode.LFEOnly bus bool rw LFE Only Mode
Bus[%].mode.RearOnly bus bool rw Rear Only Mode
Bus[%].EQ.channel[%].cell[%].on bus 0..7 0..5 bool rw EQ cell On/Off
Bus[%].EQ.channel[%].cell[%].type bus 0..7 0..5 0..6 rw EQ cell Type
Bus[%].EQ.channel[%].cell[%].f bus 0..7 0..5 10.0..35000.0 rw EQ cell Frequency (Hz)
Bus[%].EQ.channel[%].cell[%].gain bus 0..7 0..5 -12.0..12.0 rw EQ cell Gain (dB)
Bus[%].EQ.channel[%].cell[%].q bus 0..7 0..5 1.0..100.0 rw EQ cell Quality
Bus[%].FadeTo bus string "(dB Target, msTime)" rw Fade to Target Gain
Bus[%].FadeBy bus string "(dB relativechange, msTime)" rw Fade Gain by relative change
Bus[%].Sel bus bool rw Select Bus
Bus[%].ReturnReverb bus 0.0..10.0 rw Return Level from Reverb
Bus[%].ReturnDelay bus 0.0..10.0 rw Return Level from Delay
Bus[%].ReturnFx1 bus 0.0..10.0 rw Return Level from External Fx1
Bus[%].ReturnFx2 bus 0.0..10.0 rw Return Level from External Fx2
Bus[%].Monitor bus bool rw Monitor Button
Bus[%].VAIO physicalbus bool rw Physical bus only
Bus[%].device.name physicalbus string "Device Name" r read physical bus device name
Bus[%].device.sr physicalbus samplerate "Sample Rate" r read physical bus device sample rate
Bus[%].device.wdm physicalbus string "Device Name" w Set physical bus WDM device
Bus[%].device.ks physicalbus string "Device Name" w Set physical bus KS device
Bus[%].device.mme physicalbus string "Device Name" w Set physical bus MME device
Bus[%].device.asio physicalbus string "Device Name" w Set physical bus ASIO device

#title FX Settings
#comment Internal FX
Fx.Reverb.On bool rw Reverb On/Off
Fx.Reverb.AB bool rw Reverb Memory Slot A/B
Fx.Delay.On bool rw Delay On/Off
Fx.Delay.AB bool rw Delay Memory Slot A/B

#title System Settings
#comment Patch Options
patch.asio[%] 0..16 uint16 rw ASIO Patch
patch.OutA2[%] bus uint16 rw ASIO Patch A2 Bus
patch.OutA3[%] bus uint16 rw ASIO Patch A3 Bus
patch.OutA4[%] bus uint16 rw ASIO Patch A4 Bus
patch.OutA5[%] bus uint16 rw ASIO Patch A5 Bus
patch.composite[%] bus 0..22 "(0 off / 1..22 channels)" rw Composite Patch
patch.insert[%] 0..21 "0..21 channels" bool rw Virtual ASIO Insert
patch.PostFaderComposite bool "(0 PRE / 1 POST)" rw Composite Mode
patch.PostFxInsert bool "(0 PRE / 1 POST)" rw Virtual Insert Point

#comment System Settings
Option.sr samplerate rw Preferred samplerate
Option.ASIOsr bool "0 default / 1 preferred" rw For ASIO driver connected on output A1
Option.delay[%] physicalbus 0.0..500.0 "delay in ms" rw Output delay
Option.buffer.mme 128..2048 rw MME buffer size
Option.buffer.wdm 128..2048 rw WDM buffer size
Option.buffer.ks 128..2048 rw KS buffer size
Option.buffer.asio 0,128..2048 "0 default / 128..2048 custom" rw ASIO buffer size
Option.mode.exclusif bool rw WDM input exclusive
Option.mode.swift bool rw WDM swift mode
Option.MonitorOnSEL bool rw Monitor on selected bus
Option.SliderMode bool "0 ABS / 1 RELATIVE" rw Option Slider Mode

#title Tape Recorder Options
#comment Recorder Options
recorder.stop bool rw Stop Button
recorder.play bool rw Play Button
recorder.replay 1 rw Play from beginning
recorder.ff bool rw Fast Forward Button
recorder.rew bool rw Rewind Button
recorder.goto uint53 "absolute time in seconds" w set playback position
recorder.A1 bool rw play on Bus A1
recorder.A2 bool rw play on Bus A2
recorder.A3 bool rw play on Bus A3
recorder.A4 bool rw play on Bus A4
recorder.A5 bool rw play on Bus A5
recorder.B1 bool rw play on Bus B1
recorder.B2 bool rw play on Bus B2
recorder.B3 bool rw play on Bus B3
recorder.record bool rw Record Button
recorder.pause bool rw Pause Button
recorder.load string "filename" w Load Tape
recorder.samplerate samplerate rw Sample Rate
recorder.ArmStrip[%] strip bool rw Pre-Fader Inputs
recorder.ArmBus[%] bus bool rw Post-Fader Outputs
recorder.mode.recbus bool "0 pre-fader inputs / 1 post-fader outputs" rw Recorder Mode
recorder.mode.PlayOnLoad bool rw Play on Load
recorder.mode.Loop bool rw Loop Mode
recorder.mode.MultiTrack bool rw Multi Track Mode
recorder.bitResolution 8,16,24,32 "8/16/24 for int / 32 for float" rw Bit Resolution
recorder.Channel 1..8 rw number of channels
recorder.kbps uint16 rw kbps for mp3
recorder.FileType 1..3,100 "1 wav, 2 aiff, 3 bwf, 100 mp3" rw File Type
recorder.gain gain rw Playback Gain

#title VBAN Options
vban.Enable bool rw VBAN On/Off
vban.instream[%].on vban bool rw Stream On/Off
vban.instream[%].name vban string rw Stream Name
vban.instream[%].ip vban string rw source IP
vban.instream[%].port vban uint16 rw source Port
vban.instream[%].sr vban samplerate r source Sample Rate
vban.instream[%].channel vban 1..8 r source Channel Count
vban.instream[%].bit vban 1,2 "1 = 16 bit PCM, 2 = 24 bit PCM" r source Bit Resolution
vban.instream[%].quality vban 0..4 "0 optimal / 1..4 fast to very slow" rw stream Quality
vban.instream[%].route vban strip rw source Route
vban.outstream[%].on vban bool rw Stream On/Off
vban.outstream[%].name vban string rw Stream Name
vban.outstream[%].ip vban string rw destination IP
vban.outstream[%].port vban uint16 rw destination Port
vban.outstream[%].sr vban samplerate rw destination Sample Rate
vban.outstream[%].channel vban 1..8 rw destination Channel Count
vban.outstream[%].bit vban 1,2 "1 = 16 bit PCM, 2 = 24 bit PCM" rw destination Bit Resolution
vban.outstream[%].quality vban 0..4 "0 optimal / 1..4 fast to very slow" rw stream Quality
vban.outstream[%].route vban bus rw destination Route

@GottZ GottZ force-pushed the missing-features branch from 62e865a to dc2f5cf Compare April 16, 2024 17:25
GottZ added 6 commits April 16, 2024 19:57
Signed-off-by: Jan-Stefan Janetzky <[email protected]>
this change has no effect except for being less clutter

Signed-off-by: Jan-Stefan Janetzky <[email protected]>
Signed-off-by: Jan-Stefan Janetzky <[email protected]>
Signed-off-by: Jan-Stefan Janetzky <[email protected]>
@GottZ GottZ force-pushed the missing-features branch from dc2f5cf to f921c55 Compare April 16, 2024 18:05
Added a new case in the switch statement to handle -3 return value. This will throw an "out of range" exception when the parameter is outside the acceptable limits.

Signed-off-by: Jan-Stefan Janetzky <[email protected]>
@GottZ GottZ force-pushed the missing-features branch from f921c55 to c175c30 Compare April 16, 2024 18:06
@GottZ
Copy link
Author

GottZ commented Apr 16, 2024

milestone I guess..
image

The codebase has been refactored to use ES6 module syntax instead of CommonJS. This includes renaming files with .js extension to .mjs, replacing require statements with import, and changing module.exports to export default or named exports. Deprecated warnings have been added for certain imports.

In addition, the package.json file has been updated:
- The main entry point is now index.mjs
- Added a types field pointing to index.d.ts
- Set type as "module" to swap to es6 modules
- Updated version number from 0.5.0 to 0.6.0
- Added contributors list
- Included a link for reporting bugs
- Added "api" keyword
@GottZ
Copy link
Author

GottZ commented Apr 17, 2024

well.. I guess I've solved to parse every api call now..
will generate a mapper now that both spits out a index.d.ts as well as the api wrapper definitions itself.

Bus[%].FadeTo bus '(%, %)' gain 0.0..120000.0 "time in ms" rw Fade to Target Gain

turns into:

{
  "title": "Bus Parameters",
  "comment": "Bus index is zero based. 2 buses on Voicemeeter, 5 on Banana, 8 on Potato.",
  "description": "Fade to Target Gain",
  "command": "Bus[%].FadeTo",
  "parts": [
    "Bus",
    "FadeTo"
  ],
  "hasMultistring": true,
  "args": [
    {
      "type": "bus",
      "rule": "0..8",
      "description": "bus id"
    },
    {
      "type": "multistring",
      "rule": "(%, %)"
    },
    {
      "type": "gain",
      "rule": "-60.0..12.0",
      "description": "gain value (dB)"
    },
    {
      "type": "rule",
      "rule": "0.0..120000.0",
      "description": "time in ms"
    }
  ],
  "write": true,
  "read": true
}

@GottZ
Copy link
Author

GottZ commented May 4, 2024

image
getting there..
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant