Closed marcobn closed 2 years ago
Thanks!
Hi Daniel, I have another question for you… I noticed that the return values for volume in track or gain in clips is apparently on a linear scale between 0 and 1. Now, the levels in Live are of course on a dB log scale of some sort (-inf to 6 in tracks and -inf to 20 in clips). In this way, 0 dB in tracks returns 0.85, while 0 dB in clips returns 0.4. Any insight? Thanks, marco
Marco Buongiorno Nardelli (he/him) Regents Professor, University of North Texas External Professor, Santa Fe Institute CEMI, Center for Experimental Music and Intermedia iARTA, Initiative for Advanced Research in Technology and the Arts ArtSciLab, ATEC @ the University of Texas at Dallas http://ermes.unt.edu http://www.materialssoundmusic.com
From: Daniel Jones @.> Date: Sunday, October 9, 2022 at 3:51 AM To: ideoforms/AbletonOSC @.> Cc: Buongiorno Nardelli, Marco @.>, Author @.> Subject: [EXT] Re: [ideoforms/AbletonOSC] easy fix for get/volume get/panning in track.py (PR #15)
Thanks!
— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fideoforms%2FAbletonOSC%2Fpull%2F15%23issuecomment-1272491841&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7Ce742f7e233f848a4206408daa9d3833a%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638009023152198941%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=j9xBq2bvrjuT%2BstkKysasLIDkUgGGUYfwvJX8cEz2Y4%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFQOHKQOKX3EE76R4J3S4M3WCKBSRANCNFSM6AAAAAAQ75WSUU&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7Ce742f7e233f848a4206408daa9d3833a%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638009023152198941%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=llouMc5suSJ2F5Q1pkO97YXls4DhYKBTHAlGufOU8zk%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
Hmm, it's a good question. Looking at the track-level volume sliders in Live, it looks like it ranges from -70dB to +6dB. But, the negative portion of this (in dB) isn't linearly mapped to the 0..1 float scale, so it is not as simple as a linear/logarithmic scaling - there's some additional curve going on. I don't see anything in the LOM docs that immediately jumps out as helpful.
What are you trying to achieve?
Hi. If it helps, there's a Max abstraction call M4L.api.db2value that implements the dB to Live parameter linear scale.
Here is a pythonic way to convert Live linear values to dB.
For track volume:
def db2value(db):
if db <= 6 and db >= -18:
return (db+34)/40
elif db < -18 and db >= -41:
alpha = 799.503788
beta = 12630.61132
gamma = 201.871345
delta = 399.751894
return -(np.sqrt(-alpha*db - beta) - gamma) / delta
elif db < -41:
alpha = 70.
beta = 118.426374
gamma = 7504./5567.
return np.power(((db+alpha)/beta),gamma)
else:
print('out of bounds')
and its reciprocal:
def value2db(vl):
if vl <= 1 and vl >= 0.4:
return 40*vl -34
elif vl < 0.4 and vl >= 0.15:
alpha = 799.503788
beta = 12630.61132
gamma = 201.871345
delta = 399.751894
return -((delta*vl - gamma)**2 + beta)/alpha
elif vl < 0.15:
alpha = 70.
beta = 118.426374
gamma = 7504./5567.
return beta*np.power(vl,1/gamma) - alpha
else:
print('out of bounds')
For gain in clips
def db4value(db):
db -= 18
if db <= 6 and db >= -18:
return (db+34)/40
elif db < -18 and db >= -41:
alpha = 799.503788
beta = 12630.61132
gamma = 201.871345
delta = 399.751894
return -(np.sqrt(-alpha*db - beta) - gamma) / delta
elif db < -41:
alpha = 70.
beta = 118.426374
gamma = 7504./5567.
return np.power(((db+alpha)/beta),gamma)
else:
print('out of bounds')
for the reciprocal, one can retrieve /live/clip/get/gain_display_string. It will return the value in dB. marco
Marco Buongiorno Nardelli (he/him) Regents Professor, University of North Texas External Professor, Santa Fe Institute CEMI, Center for Experimental Music and Intermedia iARTA, Initiative for Advanced Research in Technology and the Arts ArtSciLab, ATEC @ the University of Texas at Dallas http://ermes.unt.edu http://www.materialssoundmusic.com
From: Daniel Jones @.> Date: Sunday, October 9, 2022 at 1:42 PM To: ideoforms/AbletonOSC @.> Cc: Buongiorno Nardelli, Marco @.>, Author @.> Subject: [EXT] Re: [ideoforms/AbletonOSC] easy fix for get/volume get/panning in track.py (PR #15)
Hmm, it's a good question. Looking at the track-level volume sliders in Live, it looks like it ranges from -70dB to +6dB. But, the negative portion of this (in dB) isn't linearly mapped to the 0..1 float scale, so it is not as simple as a linear/logarithmic scaling - there's some additional curve going on. I don't see anything in the LOM docshttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.cycling74.com%2Fmax8%2Fvignettes%2Flive_object_model&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7Ce6eec04a9974480d2bcc08daaa2611fc%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638009377755561808%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=EPN9iBj1Zx234qaaquGIazouTkpER%2Fh%2FXoOj6Ok0Zx8%3D&reserved=0 that immediately jumps out as helpful.
What are you trying to achieve?
— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fideoforms%2FAbletonOSC%2Fpull%2F15%23issuecomment-1272604423&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7Ce6eec04a9974480d2bcc08daaa2611fc%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638009377755561808%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JpOOxnMaxAyx%2BDvxWbd4KJQP0hETrNxnnW5TdKqZJjs%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFQOHKTVUCDWCY5B3RFH3KTWCMG2VANCNFSM6AAAAAAQ75WSUU&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7Ce6eec04a9974480d2bcc08daaa2611fc%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638009377755561808%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WLtorejnA%2BWANJiic326xNQC15RIW2tW9%2BVcwZhrISo%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
Hi Daniel, as promised... Thanks, marco