-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Smoother waveforms through cubic interpolation! - Fixed unaccounted pixels for antialiasing trick - Real fix for repeated histogram tail values by ignoring last measure value and double padding ends of spectrum
- Loading branch information
1 parent
ca7a35f
commit 20a09e1
Showing
11 changed files
with
417 additions
and
33 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ MeasureName=MeasureAudioRepeat | |
Bands=96 | ||
Sensitivity=42 | ||
|
||
BarWidth=10 | ||
BarWidth=8 | ||
BarGap=6 | ||
|
||
X=0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,48 @@ | ||
-- Wave v1.1 | ||
-- Wave v1.2 | ||
-- LICENSE: Creative Commons Attribution-Non-Commercial-Share Alike 3.0 | ||
|
||
local Measure,MeasureBuffer,cos,PI={},{},math.cos,math.pi | ||
function Initialize() | ||
local Width=SKIN:ParseFormula(SKIN:ReplaceVariables("#Width#")) | ||
InterWidth=math.ceil(Width/SKIN:ReplaceVariables("#Bands#")) | ||
InterWidth=Width/SKIN:ReplaceVariables("#Bands#") | ||
Mu=1/InterWidth | ||
|
||
Sub,Index,Limit=SELF:GetOption("Sub"),SKIN:ParseFormula(SELF:GetOption("Index")),SKIN:ParseFormula(SELF:GetOption("Limit")) | ||
local MeasureName,gsub=SKIN:ReplaceVariables("#MeasureName#"),string.gsub | ||
for i=Index,Limit do Measure[i]=SKIN:GetMeasure((gsub(MeasureName,Sub,i))) end end | ||
|
||
-- http://paulbourke.net/miscellaneous/interpolation/ | ||
local function CosineInterpolate(y1,y2,mu) | ||
local mu2=(1-cos(mu*PI))/2 return (y1*(1-mu2)+y2*mu2) end | ||
local function CubicInterpolate(y0,y1,y2,y3,mu) | ||
local mu2,a0=mu*mu,y3-y2-y0+y1 | ||
local a1=y0-y1-a0 | ||
return (a0*mu*mu2+a1*mu2+(y2-y0)*mu+y1) end | ||
|
||
function Update() | ||
for i=Index,Limit do MeasureBuffer[i]=Measure[i]:GetValue() end | ||
|
||
for i=Index,Limit-2 do | ||
local y0,y1,y2,y3,LocalMu=MeasureBuffer[1],MeasureBuffer[1],MeasureBuffer[2],MeasureBuffer[4],0 | ||
for j=1,InterWidth*2 do | ||
LocalMu=LocalMu+Mu*0.5 | ||
SKIN:Bang("!SetOption","MeasureIter","Formula",CubicInterpolate(y0,y1,y2,y3,LocalMu)) | ||
SKIN:Bang("[!UpdateMeasure MeasureIter][!UpdateMeter MeterLine]") | ||
end | ||
|
||
for i=2,Limit-3 do | ||
SKIN:Bang("!SetOption","MeasureIter","Formula",MeasureBuffer[i]) | ||
SKIN:Bang("[!UpdateMeasure MeasureIter][!UpdateMeter MeterLine]") | ||
|
||
local y1,y2,LocalMu=MeasureBuffer[i],MeasureBuffer[i+1],0 | ||
for j=0,InterWidth do | ||
local y0,y1,y2,y3,LocalMu=MeasureBuffer[i-1],MeasureBuffer[i],MeasureBuffer[i+1],MeasureBuffer[i+2],0 | ||
for j=1,InterWidth do | ||
LocalMu=LocalMu+Mu | ||
SKIN:Bang("!SetOption","MeasureIter","Formula",CosineInterpolate(y1,y2,LocalMu)) | ||
SKIN:Bang("!SetOption","MeasureIter","Formula",CubicInterpolate(y0,y1,y2,y3,LocalMu)) | ||
SKIN:Bang("[!UpdateMeasure MeasureIter][!UpdateMeter MeterLine]") | ||
end | ||
end | ||
|
||
y0,y1,y2,y3,LocalMu=MeasureBuffer[Limit-4],MeasureBuffer[Limit-2],MeasureBuffer[Limit-1],MeasureBuffer[Limit-1],0 | ||
for j=1,InterWidth*2 do | ||
LocalMu=LocalMu+Mu*0.5 | ||
SKIN:Bang("!SetOption","MeasureIter","Formula",CubicInterpolate(y0,y1,y2,y3,LocalMu)) | ||
SKIN:Bang("[!UpdateMeasure MeasureIter][!UpdateMeter MeterLine]") | ||
end | ||
end |
Oops, something went wrong.