It is currently March 19th, 2024, 6:57 am

AudioLevel

Share and get help with Plugins and Addons
Post Reply
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan
Contact:

AudioLevel

Post by dgrace »

AudioLevel
Rainmeter Plugin
v1.1.4

Overview:

AudioLevel lets you monitor the amplitude of the post-mixer signal at a Windows audio endpoint. (i.e. sound card speaker output, USB audio interface, headphone port, microphone input) It does this by creating a WASAPI capture client in loopback mode. (see http://msdn.microsoft.com/en-us/library/windows/desktop/dd316551%28v=vs.85%29.aspx)
The capture client streams audio data to the plugin where it gets measured and filtered - the resulting volume level is returned by the plugin for use in Rainmeter measures/meters.

TL;DR:

AudioLevel lets you make meters that respond to your music.

Usage:

AudioLevel follows the WebParser paradigm and uses a parent-child setup. The parent AudioLevel measure does the actual calculations on the audio data - you only want one of these per sound card input/output. The child measures request data from the parent so that you can get individual values. Example:

Code: Select all

; This parent measure processes the default audio output.
[measureAudioRaw]
Measure=Plugin
Plugin=AudioLevel

; This child measure gets the current approx RMS (http://en.wikipedia.org/wiki/Root_mean_square) value of the left channel (0.0 to 1.0).
[measureAudioRMS_L]
Measure=Plugin
Plugin=AudioLevel
Parent=measureAudioRaw
Channel=L
Type=RMS
Parameters:

There are a few parameters - some go on the parent, some go on the children. These are described here:

Parent Parameters:

Port:
values: Input, Output
default: Output

This specifies whether you want to measure the input or output for the given device.

ID:
values: (see notes)
default: (none)

This specifies the audio device to which you want to connect. If unspecified, it will use
the default device for the specified port, that is, if you specify Port=Output and no ID,
the plugin will try to connect to your default audio output device. (you can control this
with "Manage Audio Devices" from the start menu.) To specify a device, you'll need to find
the Windows device ID. See the DeviceList parameter for more info.

RMSAttack:
values: time in ms
default: 300
RMSDecay:
values: time in ms
default: 300
RMSGain:
values: gain factor (number)
default: 1.0

During measurement, the signal is filtered so that you don't see the tiny spikes of each sample value and it responds more like a traditional VU meter. You can control this filtering with these parameters. RMSAttack specifies the time in milliseconds over which to interpolate as the signal level increases (how quick the needle jumps up for a new peak). RMSDecay specifies the time in ms over which the level decays when the signal gets lower. RMS measurement squares the value of each sample, filters the squared values, then returns the square root of the filtered value. The RMSGain value is multiplied to the final value before it is returned. To disable all filtering, just specify 0 for the attack/decay constants and 1.0 for the gain.
RMS is the square root of the mean of the square. It is a meaningful way of calculating the average of values over a period of time. With audio, the signal value (amplitude) is squared, averaged over a period of time, then the square root of the result is calculated. The result is a value, that when squared, is related (proportional) to the effective power of the signal.
PeakAttack:
values: time in ms
default: 50
PeakDecay:
values: time in ms
default: 2500
PeakGain:
values: gain factor (number)
default: 1.0

The peak values work just like the RMS values, except peak measurements are made by taking the absolute value of each sample, rather than squaring. To disable all filtering, just specify 0 for the attack/decay constants and 1.0 for the gain.

FFTSize:
values: size of FFT to process (even integer >= 0, usually power of 2)
default: 0

Optionally, you can have the plugin run an FFT analysis on the audio to transform it to the frequency domain. The returned values are accessed with the child param FFTIdx. FFT's are a big topic, you can start here: http://en.wikipedia.org/wiki/Discrete_Fourier_transform. Typical values for this are 256, 512, 1024. The higher the value, the better the frequency resolution of the output data, but the worse the CPU impact and the delay between the audio and the measure's response.

FFTOverlap:
values: # of samples to overlap per FFT window (integer between 0 and FFTSize-1)
default: 0

Optionally, the FFT can be windowed to overlap successive sections. A Hann function is used to shape the data pre-FFT. Typical values are half the FFTSize. Increasing this value will lower the latency between the audio and the measure's response, at the cost of extra CPU.

Bands:
values: number of frequency bands to generate (integer >= 0)
default: 0

Optionally, the FFT data can be smoothed into a number of log-spaced frequency bands, similar to a typical spectrum analyzer. This parameter specifies the number of bands.

FreqMin:
FreqMax:
values: min and max frequencies of frequency band calculations, in Hz
defaults: 20 and 20000, respectively

If band processing is enabled (see above), these parameters specify the frequency range over which the bands should be calculated.

Sensitivity
values: dynamic range, in dB
default: 35.0

This value specifies over what dB range the measure will return FFT and Band data. Increasing this value will cause the measure to respond on quieter sounds, decreasing it will make only loud sounds trigger the measure.

Child Parameters:

Parent:
values: parent measure name
default: (none)

This specifies the parent measure from which you want to extract data.

Channel:
values: L/FL/0, R/FR/1, C/2, LFE/Sub/3, BL/4, BR/5, SL/6, SR/7, Sum/Avg
default: Sum

This specifies which channel's level you'd like to extract from the parent. Channels can be
identified by name or number, e.g. Channel=0 is the same as Channel=L or Channel=FL.

FFTIdx: (only if FFTSize enabled on parent)
values: FFT frequency bin number, from 0 to FFTSize/2
default: 0

This specifies which FFT bin you want to extract from the parent.

BandIdx: (only if FFTSize and Bands enabled on parent)
values: Frequency band number, from 0 to (Bands-1)
default: 0

This specifies which frequency band you want to extract from the parent.

Type:
values: RMS, Peak, FFT, Band, FFTFreq, BandFreq, Format, DeviceStatus, DeviceName, DeviceID, DeviceList
default: (none)

This specifies the particular data you want from the parent:

RMS:
Get the current RMS level for the specified channel as a numerical value.

Peak:
Get the current Peak level for the specified channel as a numerical value.

FFT:
Get the raw FFT bin value specified by the FFTIdx param.

Band:
Get the frequency band value specified by the BandIdx param.

FFTFreq:
Get the frequency corresponding to the particular FFTIdx.

BandFreq:
Get the frequency corresponding to the particular BandIdx.

Format:
Get a string describing the device audio format.

DeviceStatus:
1 if the parent is connected to the specified device, else 0.

DeviceName:
(string value) Get the display name of the parent's connected device, if any.

DeviceID:
(string value) Get the ID of the parent's connected device (for use with specifying ID in a parent).

DeviceList:
(string value) Get the list of all available devices for the specified Port. Each item in the list is an ID:name pair. You can copy the ID from your Rainmeter->About Skins window into the ID field of your parent measure to specify a particular device. Should look something like this: {0.0.0.00000000}.{83b88ba1-6140-482e-adbf-fb729d9b1839} Note: this may be an expensive call - you probably want to disable this measure once you've figured out the ID you need.

Example Skin:
VUMeter_1.1.4.rmskin
(28.73 KiB) Downloaded 5388 times
Note, this requires the latest (at least 3.2.0 r2317) 3.2 beta of Rainmeter. The AudioLevel plugin is now included in the Rainmeter build, and all future changes to the plugin will be supported in beta and final releases of Rainmeter.
Last edited by jsmorley on September 9th, 2014, 7:18 pm, edited 13 times in total.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Plugin: AudioLevel

Post by jsmorley »

Thanks. Seems to work fine on my system.
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan
Contact:

Re: New Plugin: AudioLevel

Post by dgrace »

Cool. I bet someone could go crazy with Arcs with this one. The Plugin should return a double between 0.0 and 1.0. My VU meter converts that to log scale but you could just as easily use the raw value to drive some interesting stuff. Rainmeter meets Winamp visualization.

dave
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan
Contact:

Re: New Plugin: AudioLevel

Post by dgrace »

Update: fixed a couple of bugs (most notably a missing sqrt which threw off the values, and a crash on mono devices). It also now supports monitoring the default input device, by specifying Port=Input. Updated the attachment in the OP.

dave
Stan
Posts: 65
Joined: January 24th, 2013, 9:09 pm

Re: New Plugin: AudioLevel

Post by Stan »

I can't seem to get this working.

My sound card is a Realtek High Definition Audio with the default playback being the speakers.

Do I need to change something?

Being an old reel to reel guy I like the old style VU meters. This is exactly what I've been looking for so any help will be appreciated.

Thanks
User avatar
Dank420
Posts: 145
Joined: April 3rd, 2013, 1:04 am
Location: O-High-O

Re: New Plugin: AudioLevel

Post by Dank420 »

Thanks for working on this first of all .......
second, works for me, getting an invalid type error thou...
third , if you could add the audio indexing like volume plugin so as to set 1 2 3 or what have you to monitor both speakers and headphones (with different skins or meters/measures)that'd be sweet... but still Nice work!!!
Attachments
Capture.PNG
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Plugin: AudioLevel

Post by jsmorley »

No good deed goes unpunished.
-- Clare Boothe Luce
User avatar
Dank420
Posts: 145
Joined: April 3rd, 2013, 1:04 am
Location: O-High-O

Re: New Plugin: AudioLevel

Post by Dank420 »

Well the plugin can handle it. starting one app (on speakers) pluging in second (headphones) after start and starting second app(refreshing only one copy of VU) got both copies responding to correct audio lvls on correct devices just have to avoid refreshing....


Edit: well maybe im pushing it ... vlc out speakers playing music... browser(or games) on headphones, starting vlc first vu working, plug in headphones start second audio source(whaterever it maybe) refreshing the copy of vu all fine working linked to corrrect device. now close vlc and Vu stoped moveing and loopback sticks with last sound. Beep becomes beeeeeeeeeeeeeeeeeeeeeeeeeeeee.................. restart vlc and picks right back up.
pause/play dosent cause it but closing vlc will. pausing music them closing vlc seems not to cause
have to refresh first vu assigning it to current default(headphones) then stop vlc and goes quiet. during which headphones vu stays fine(after refresh now both VU on phones) Seems to not like stopping using non default audio... IM still Impressed thou.
Attachments
Capture.PNG
Last edited by Dank420 on July 14th, 2014, 4:10 pm, edited 2 times in total.
User avatar
Mordasius
Posts: 1166
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: New Plugin: AudioLevel

Post by Mordasius »

Neither the dead nor good deeds go unpunished.
-- Anon.

This plugin works a treat with my Realtek High Definition Audio on Windows 7 (64 bit).

Thanks dgrace..
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Plugin: AudioLevel

Post by jsmorley »

Mordasius wrote:Neither the dead nor good deeds go unpunished.
-- Anon.

This plugin works a treat with my Realtek High Definition Audio on Windows 7 (64 bit).

Thanks dgrace..
doh!
Post Reply