Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 02-07-2020, 11:32 AM   #1
Cedrik0s
Human being with feelings
 
Join Date: Oct 2014
Posts: 77
Default Reascript: GetPeakInfo and GetPeakHoldDB returning dubious values

Using Reascript Python on Windows (but Lua does the same), the 2 functions have a weird behaviour, or at least not the one I'd expect.

Sending a steady signal on a track (be it a tone or a DC), and polling repeatedly the Peak value with GetPeakInfo does not return a constant value as I would expect.

Just try that:
Code:
def Loop():
  tr = RPR_GetTrack(0, 0)
  msg(RPR_Track_GetPeakInfo(tr, 0))
  time.sleep(0.5)
  RPR_defer("Loop()")
    
Loop()
You'll get values like these for an sine at -12dB (so I'd expect peaks at 0.25):
0.25
0.0001699551212368533
0.001268418156541884
0.25
1.0375602869316936e-05
0.001502196304500103
0.0014873228501528502
0.0014873228501528502
0.0017440064111724496
0.0014873228501528502
0.25
0.25
0.25
8.937004167819396e-06
0.25

What are those small values between the 0.25s?


The other function, GetPeakHoldDB is weird too:
If you use this code:
Code:
def Loop():
  tr = RPR_GetTrack(0, 0)
  msg(RPR_Track_GetPeakHoldDB(tr, 0, False))
  RPR_Track_GetPeakHoldDB(tr, 0, True) # clear the peak hold
  time.sleep(0.5)
  RPR_defer("Loop()")
    
Loop()
You get values like these:
-120.0
-0.121
-120.0
-0.121
-0.121
-0.121
-0.121
-0.121
-0.121
-120.0
-0.121
-120.0
-0.121
-120.0
-120.0
-120.0
-0.121
-120.0
-0.121
-120.0

Here the correct value is the -0.121.
The fact that the function has DB in its name but returns cents of DBs seems like a first inconsistency.
The fact that it returns -120 many times doesn't really make sense (that would be -12000dB!!) and this looks like a bug too.
Also by calling RPR_Track_GetPeakHoldDB(tr, 0, True), I would expect it to return the peak value and then clear the hold. Instead it will only return -120, always...

I think both function misbehave (and must be punished).

Thanks.

C

Last edited by Cedrik0s; 02-08-2020 at 08:12 AM. Reason: Make title clearer
Cedrik0s is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.