logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
mcook75  
#1 Posted : Sunday, November 8, 2020 11:59:24 PM(UTC)
mcook75

Rank: Member

Groups: Registered
Joined: 10/21/2020(UTC)
Posts: 13
United Kingdom
Location: Bulkington

Thanks: 5 times
So i have been trying to create a simple volume up button (increase/decrease by 3% for example!)

I'm most of the way there, but have hit a wall! The general idea is, put the current volume level into a variable, add/subtract "X" amount, done! However when you read the volume, it's looks like it is logarithmic, not linear! i.e. if set to 50%, it reads as 6.25%

it also doesn't help that when i search for how to convert the two, most answers require the Log function, which I don't think is supported within vMix!

So this is what i have so far;

Quote:

Dim vol as Double
Dim newvol as integer
Dim callerinput as integer = 1
Dim x as new system.xml.xmldocument
Dim xml as string

'.... RUN SCRIPT

xml = API.XML()
x.loadxml(xml)

'Get volume level

vol = x.selectsinglenode("//input[@number='" & callerinput & "']/@volume").value

'the maths that is missing!

newvol = vol-3

'set new volume level

API.Function("SetVolume",callerinput,newvol)



'to see if the maths works

Console.WriteLine (vol)
Console.WriteLine (newvol)


it works, right up until I need to sent the new number,

if you know of an easier way, or can fill in the maths blanks, it would be appreciated!
joedemax  
#2 Posted : Monday, November 9, 2020 5:19:24 AM(UTC)
joedemax

Rank: Member

Groups: Registered
Joined: 6/23/2017(UTC)
Posts: 17
United Kingdom

Was thanked: 6 time(s) in 3 post(s)
C#, but this is what we do in Central Control


Quote:
float logValue = (float)Math.Pow((e.Level * 1000000), 0.25) / 100;
thanks 1 user thanked joedemax for this useful post.
mcook75 on 11/9/2020(UTC)
mcook75  
#3 Posted : Monday, November 9, 2020 5:33:16 AM(UTC)
mcook75

Rank: Member

Groups: Registered
Joined: 10/21/2020(UTC)
Posts: 13
United Kingdom
Location: Bulkington

Thanks: 5 times
Originally Posted by: joedemax Go to Quoted Post
C#, but this is what we do in Central Control


Quote:
float logValue = (float)Math.Pow((e.Level * 1000000), 0.25) / 100;


Thanks Joe, I’ll try and see if I can work it out from this! I fear the biggest issue, is that the log maths function isn’t recognised by vMix! Although I may be using the wrong syntax... programming is certainly down on my list of skills
pm  
#4 Posted : Monday, November 9, 2020 6:13:19 AM(UTC)
pm

Rank: Advanced Member

Groups: Registered
Joined: 11/28/2015(UTC)
Posts: 148

Thanks: 9 times
Was thanked: 29 time(s) in 24 post(s)
thanks 1 user thanked pm for this useful post.
mcook75 on 11/9/2020(UTC)
mcook75  
#5 Posted : Monday, November 9, 2020 8:22:44 AM(UTC)
mcook75

Rank: Member

Groups: Registered
Joined: 10/21/2020(UTC)
Posts: 13
United Kingdom
Location: Bulkington

Thanks: 5 times
Originally Posted by: pm Go to Quoted Post
https://www.vmix.com/knowledgebase/article.aspx/144/vmix-api-audio-levels


That’s the puppy!!!... many thanks for this!!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.