How to catch *lack of* volume with VC Audio widget

Ask a generic question about the usage of QLC+, not related to a particular operating system
Post Reply
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

Hello,

I've a bunch of scenes for a dance event. These kind of events usually requires rather static, or not too dynamic lights.

I'd like to change the color scheme at every new song. However I can't rely on the DJ as I'm not sure which software will be used. Also, often it's just a spotify playlist, in offline mode (so can't check with spotify API).
So my only solution seems to be VC Audio widget. However, I can't find how to trigger action when the volume goes *below* some level (usually sounds are not faded so a small time without music happens between songs).

Is that even possible ? Or do you think of any other solutions ?
User avatar
GGGss
Posts: 2733
Joined: Mon Sep 12, 2016 7:15 pm
Location: Belgium
Real Name: Fredje Gallon

hmm ... an inverse trigger - you might use a restarting chaser every time an audio trigger comes in. The last step of the chaser might be the do-the-other-thing-trigger (which never is reached when music plays). If you are unlucky (music being cut just after a beat and music plays very sowly) the chaser might need much time to reach its end...
It might also be needed that you create an music driven tap button setting the chasers' pace?
All electric machines work on smoke... when the smoke escapes... they don't work anymore
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

Not sure I understand what you're explaining . My goal is not to have a single scene during music and other between, but to have like 10/12 scenes, and switching to the next one every time a song ends (so everytime volume goes *under* some level).
User avatar
GGGss
Posts: 2733
Joined: Mon Sep 12, 2016 7:15 pm
Location: Belgium
Real Name: Fredje Gallon

I'll try again then ;-)
Create a chaser with 2 scenes. The first scene is a dummy, the 2nd a signal (call it no music).
Now, through the audio widget, let it (re)trigger the chaser over and over again so that the last step is never reached. When there is no retrigger no more, the first step reaches its hold time and the 2nd step is reached. When this happens, through loopback magic, the next scene of your 10/12 is set and go.
All electric machines work on smoke... when the smoke escapes... they don't work anymore
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

ohhh god, got it now, might give it a try.

In the meantime i discussed with my DJs, and most of them do / will be able to use Spotify only on Linux, so I'm giving dbus + osc a try (like I query current song with dbus, and when a changes occurs i send some order through osc)
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

Soooo,

finally I've written this : https://gitlab.com/Sp4rKy/spotify-to-osc/-/tree/main . This is still very early stage but does work (on my tests at least).

What it does is :

* it runs on the same computer than spotify (requires Linux)
* it uses dbus to query current song and grab track_id every second
* based on track_id, Spotify API is queried (using a local cache, so if you have playlist early enough you can just crawl it so even if you're offline during showtime, you'll get the needed info)
* depending on what you configure, trigger some OSC query with configured path

So, for ex, if you configure it with :
```
limit_config = {
"energy": [
{
50: [
"/color/blue",
"/color/green",
"/color/white",
], # If energy < 0.5, then picks one of the 3 scenes
80: [
"/color/pink",
"/color/yellow",
], # else if energy < 0.8, picks one of the 2 scenes
100: [
"/color/red",
"/color/scene/flash",
], # else go for one of the red or flash scenes
}
],
"tempo": [
{ # AND
100: [
"/pattern/beams/slow",
"/pattern/wash/slow",
], # if tempo < 100, choose one of the slow scenes
200: [
"/pattern/beams/fast",
"/pattern/wash/fast",
], # else if < 200, choose one of the fast moving scenes
}
],
}
```

Every time spotify changes song, it will get analytics of new song, and :
* if energy is < 50 (it is a percentage), will choose one of the 3 paths between /color/blue,green and white, if energy is between 50 and 80 will choose betwwen ping and yellow, etc ...
* if tempo is < 100, will choose one of the 2 slow patterns path

So at the end, with this config, you have 2 paths chosen based on new song characteristics. Script then sends the 2 paths to qlcplus osc input, which in turn can trigger buttons/scenes/etc ...
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

Output looks like:

```
2023-05-03 16:42:52 - [INFO] Need to auth on spotify
2023-05-03 16:42:52 - [INFO] Connecting to the session bus.
2023-05-03 16:42:52 - [INFO] Connecting to the session bus.
2023-05-03 16:42:56 - [INFO] Got new song (1bW75jzYfLn2lk3tqG2xFA -> 1clENYEDpqv4rlFhb935Dy)
2023-05-03 16:42:56 - [INFO] [1clENYEDpqv4rlFhb935Dy] energy = 0.506
2023-05-03 16:42:56 - [INFO] [1clENYEDpqv4rlFhb935Dy] tempo = 94.96
2023-05-03 16:42:56 - [INFO] [OSC] Next values: ['/color/pink', '/pattern/beams/slow']
2023-05-03 16:43:40 - [INFO] Got new song (1clENYEDpqv4rlFhb935Dy -> 74d3yEyNl807mtzttoKTbK)
2023-05-03 16:43:40 - [INFO] [74d3yEyNl807mtzttoKTbK] energy = 0.403
2023-05-03 16:43:40 - [INFO] [74d3yEyNl807mtzttoKTbK] tempo = 82.518
2023-05-03 16:43:40 - [INFO] [OSC] Next values: ['/color/green', '/pattern/wash/slow']
2023-05-03 16:43:48 - [INFO] Got new song (74d3yEyNl807mtzttoKTbK -> 64jOSUItUVftqCeAGDjb7R)
2023-05-03 16:43:48 - [INFO] [64jOSUItUVftqCeAGDjb7R] energy = 0.767
2023-05-03 16:43:48 - [INFO] [64jOSUItUVftqCeAGDjb7R] tempo = 129.914
2023-05-03 16:43:48 - [INFO] [OSC] Next values: ['/color/yellow', '/pattern/beams/fast']
2023-05-03 16:46:40 - [INFO] Got new song (64jOSUItUVftqCeAGDjb7R -> 09rAJ1Q1NNJSaUKEW3X9P6)
2023-05-03 16:46:40 - [INFO] [09rAJ1Q1NNJSaUKEW3X9P6] energy = 0.698
2023-05-03 16:46:40 - [INFO] [09rAJ1Q1NNJSaUKEW3X9P6] tempo = 126.001
2023-05-03 16:46:40 - [INFO] [OSC] Next values: ['/color/pink', '/pattern/wash/fast']
2023-05-03 16:47:31 - [INFO] Got new song (09rAJ1Q1NNJSaUKEW3X9P6 -> 7bqg7RANz4RaboN0Ga1Miq)
2023-05-03 16:47:31 - [INFO] [7bqg7RANz4RaboN0Ga1Miq] energy = 0.921
2023-05-03 16:47:31 - [INFO] [7bqg7RANz4RaboN0Ga1Miq] tempo = 124.981
2023-05-03 16:47:31 - [INFO] [OSC] Next values: ['/color/scene/flash', '/pattern/beams/fast']
2023-05-03 16:47:36 - [INFO] Got new song (7bqg7RANz4RaboN0Ga1Miq -> 4ZYAU4A2YBtlNdqOUtc7T2)
2023-05-03 16:47:36 - [INFO] [4ZYAU4A2YBtlNdqOUtc7T2] energy = 0.733
2023-05-03 16:47:36 - [INFO] [4ZYAU4A2YBtlNdqOUtc7T2] tempo = 98.355
2023-05-03 16:47:36 - [INFO] [OSC] Next values: ['/color/pink', '/pattern/wash/slow']
```
User avatar
GGGss
Posts: 2733
Joined: Mon Sep 12, 2016 7:15 pm
Location: Belgium
Real Name: Fredje Gallon

Wazaa ;-) Nice one Sparky...
and does the api detect the key of the song? A song in a Minor key would mean darkness and subdued, a major key, vivant and wide.
All electric machines work on smoke... when the smoke escapes... they don't work anymore
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

Yeah, the spotify api provides quite a lot of things, see https://developer.spotify.com/documenta ... o-features . This includes the key, but also the "valence" for ex.
Sp4rKy
Posts: 46
Joined: Fri Oct 12, 2018 6:36 am
Real Name:

Made a dedicated topic for that : http://www.qlcplus.org/forum/viewtopic.php?t=16378
Post Reply