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

support for VU meter values #139

Merged
merged 7 commits into from
Sep 9, 2024
Merged

support for VU meter values #139

merged 7 commits into from
Sep 9, 2024

Conversation

fmalcher
Copy link
Owner

@fmalcher fmalcher commented Sep 2, 2024

This PR adds support for VU information.


Discussion points

  1. Is there anything that should be renamed or restructured?
  2. VU messages are sent in a 30-60 ms interval. Should we throttle them to keep the processing load lower?
  3. Is anything missing in the documentation or in the API?

Docs (from the README)

Volume levels can be consumed through the VuProcessor class, fully separated from the MasterChannel class.
The VU information is published through streams, separated by channel.
Please be aware that only channels on the master bus are available.

conn.vuProcessor.input(1);
conn.vuProcessor.aux(2);
Call on VuProcessor Description
master() Master
input(2) Input 2
line(1) Line Input 1
player(1) Player channel 1
aux(2) AUX channel 2
fx(3) FX channel 3
sub(3) Sub group 3

Each of the method calls directly returns an Observable that can be subscribed to.
The streams emit objects with different VU values.
They are always published as linear values between 0 and 1.

// for input channels
{
  vuPre: 0.5; // input level before processing (EQ, Gate, Comp)
  vuPost: 0.5; // level after processing, represented by the blue bars in the Web UI
  vuPostFader: 0.5; // actual channel output level, represented by the colored bars in the Web UI
}

The vuPre field is only available on input channels (input, player and line).
Master, FX and Sub groups publish stereo information, so the object is structured as follows:

// for FX, sub group and master
{
  vuPostL: 0.3,
  vuPostR: 0.3,
  vuPostFaderL: 0.4,
  vuPostFaderR: 0.4,
}

Processing of the VU information happens lazily: VU messages from the mixer are ignored until the first VU stream is subscribed to. The messages are only processed if VU information is actually consumed.

All channels

The vuData$ field on VuProcessor publishes a raw object with all channel VU information available.
This can be used to process all information at once, e.g. for a VU meter dashboard across all channels.

conn.vuProcessor.vuData$;

VU values in dB

All VU values are linear values between 0 and 1. To express the level in dB you need to project the value to the dB range of the meter (-80..0 dB).
The exported utility function vuValueToDB() helps with that task and can be used as follows:

conn.vuProcessor
  .master()
  .pipe(map(data => vuValueToDB(data.vuPostFaderL)))
  .subscribe(/* ... */);

@fmalcher fmalcher linked an issue Sep 2, 2024 that may be closed by this pull request
Copy link

nx-cloud bot commented Sep 2, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit c5c2235. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@fmalcher fmalcher changed the title experiments with VU meter support for VU meter values Sep 6, 2024
@fmalcher fmalcher marked this pull request as ready for review September 7, 2024 07:59
@fmalcher
Copy link
Owner Author

fmalcher commented Sep 7, 2024

@yleguern64 Can you please review this, especially the API surface?
Can you also test this on a Ui12? If you don't want to install the project on your machine, I can deploy the testbed application publicly for testing.

@fmalcher fmalcher mentioned this pull request Sep 7, 2024
@fmalcher fmalcher force-pushed the vumeter branch 2 times, most recently from 091f648 to 25f0d18 Compare September 7, 2024 08:32
@yleguern64
Copy link

yleguern64 commented Sep 7, 2024

I'm going to test that, and I'll reply soon for confirmation or add code for changes.

Thank you for this great feature !

@yleguern64
Copy link

Capture d’écran du 2024-09-08 21-54-53
Capture d’écran du 2024-09-08 21-55-17
Capture d’écran du 2024-09-08 21-55-50

For me, everything works perfectly !

Thank you.

    try {
       mixer = new SoundcraftUI(config.mixer.ip);
       await mixer.connect();
    } catch (e) {
        console.log(`Cannot connect to mixer : ${e}`);
        process.exit(-1);
    }

    const modulo = 50;
    let iModuloL = 0;
    let iModuloR = 0;
    mixer.vuProcessor.line(1).subscribe(value => {
        if (iModuloL % modulo === 0) {
            const v = Math.round(value.vuPost * 10000) / 100;
            if (v > 3 || v === 0) {
                console.log("L : " + v);
            }
        }
        iModuloL++;
    });
    mixer.vuProcessor.line(2).subscribe(value => {
        if (iModuloR % modulo === 0) {
            const v = Math.round(value.vuPost * 10000) / 100;
            if (v > 3 || v === 0) {
                console.log("R : " + v);
            }
        }
        iModuloR++;
    });

@yleguern64
Copy link

Great job !

Next step ;) Merge to main and tag 👍

@fmalcher fmalcher merged commit cff10be into main Sep 9, 2024
2 checks passed
@fmalcher fmalcher deleted the vumeter branch September 9, 2024 07:30
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.

Get VU meter values
2 participants