Skip to content

Commit

Permalink
New units Xfade and Ladder BPF2
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperNiCd committed Sep 27, 2020
1 parent 7177893 commit 49d5781
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 1 deletion.
145 changes: 145 additions & 0 deletions LadderBPF.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
-- GLOBALS: app, os, verboseLevel, connect, tie
local app = app
local Class = require "Base.Class"
local Unit = require "Unit"
local Fader = require "Unit.ViewControl.Fader"
local GainBias = require "Unit.ViewControl.GainBias"
local Pitch = require "Unit.ViewControl.Pitch"
local Encoder = require "Encoder"
local ply = app.SECTION_PLY

local BespokeBPF = Class{}
BespokeBPF:include(Unit)

function BespokeBPF:init(args)
args.title = "Ladder BPF"
args.mnemonic = "LB"
Unit.init(self,args)
end

function BespokeBPF:onLoadGraph(channelCount)
local lpfilter = self:createObject("StereoLadderFilter","filter")
local hpfilter = self:createObject("StereoLadderHPF","filter")
if channelCount==2 then
connect(self,"In1",lpfilter,"Left In")
connect(lpfilter,"Left Out",hpfilter,"Left In")
connect(hpfilter,"Left Out",self,"Out1")
connect(self,"In2",lpfilter,"Right In")
connect(lpfilter,"Right Out",hpfilter,"Right In")
connect(hpfilter,"Right Out",self,"Out2")
else
connect(self,"In1",lpfilter,"Left In")
connect(lpfilter,"Left Out",hpfilter,"Left In")
connect(hpfilter,"Left Out",self,"Out1")
end

local tune = self:createObject("ConstantOffset","tune")
local tuneRange = self:createObject("MinMax","tuneRange")

local f0 = self:createObject("GainBias","f0")
local f0Range = self:createObject("MinMax","f0Range")

local res = self:createObject("GainBias","res")
local resRange = self:createObject("MinMax","resRange")

local clipper = self:createObject("Clipper","clipper")
clipper:setMaximum(0.999)
clipper:setMinimum(0)

local bw = self:createObject("GainBias","bw")
local bwRange = self:createObject("MinMax","bwRange")

local negate = self:createObject("ConstantGain","negate")
negate:hardSet("Gain",-1)

local addBw = self:createObject("Sum","addBw")
local subBw = self:createObject("Sum","subBw")

connect(tune,"Out",lpfilter,"V/Oct")
connect(tune,"Out",hpfilter,"V/Oct")
connect(tune,"Out",tuneRange,"In")


connect(f0,"Out",addBw,"Left")
connect(bw,"Out",addBw,"Right")
connect(addBw,"Out",lpfilter,"Fundamental")
--connect(addBw,"Out",hpfilter,"Fundamental")

connect(f0,"Out",subBw,"Left")
connect(bw,"Out",negate,"In")
connect(negate,"Out",subBw,"Right")
--connect(subBw,"Out",lpfilter,"Fundamental")
connect(subBw,"Out",hpfilter,"Fundamental")

connect(f0,"Out",f0Range,"In")
connect(bw,"Out",bwRange,"In")

connect(res, "Out",clipper,"In")
connect(clipper,"Out",lpfilter,"Resonance")
connect(clipper,"Out",hpfilter,"Resonance")
connect(clipper,"Out",resRange,"In")

self:createMonoBranch("tune",tune,"In",tune,"Out")
self:createMonoBranch("Q",res,"In",res,"Out")
self:createMonoBranch("f0",f0,"In",f0,"Out")
self:createMonoBranch("bw",bw,"In",bw,"Out")
end

local views = {
expanded = {"tune","freq","resonance","bandwidth"},
collapsed = {},
}

function BespokeBPF:onLoadViews(objects,branches)
local controls = {}

controls.tune = Pitch {
button = "V/oct",
branch = branches.tune,
description = "V/oct",
offset = objects.tune,
range = objects.tuneRange
}

controls.freq = GainBias {
button = "f0",
branch = branches.f0,
description = "Fundamental",
gainbias = objects.f0,
range = objects.f0Range,
biasMap = Encoder.getMap("filterFreq"),
biasUnits = app.unitHertz,
initialBias = 440,
gainMap = Encoder.getMap("freqGain"),
scaling = app.octaveScaling
}

controls.resonance = GainBias {
button = "Q",
branch = branches.Q,
description = "Resonance",
gainbias = objects.res,
range = objects.resRange,
biasMap = Encoder.getMap("unit"),
biasUnits = app.unitNone,
initialBias = 0.25,
gainMap = Encoder.getMap("[-10,10]")
}

controls.bandwidth = GainBias {
button = "bw",
branch = branches.bw,
description = "Bandwidth",
gainbias = objects.bw,
range = objects.bwRange,
biasMap = Encoder.getMap("filterFreq"),
biasUnits = app.unitHertz,
initialBias = 1,
gainMap = Encoder.getMap("freqGain"),
-- scaling = app.octaveScaling
}

return controls, views
end

return BespokeBPF
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Accents v0.4.26.2
# Accents v0.5.03.1
This repo contains units for the Orthogonal Devices ER-301 Sound Computer. It currently contains:

* Ring Modulator
Expand Down Expand Up @@ -28,6 +28,7 @@ This repo contains units for the Orthogonal Devices ER-301 Sound Computer. It c
* XXXXXX (6 op phase mod synth)
* Rotary Speaker Simulator
* Phaser
* XFade

For more details and discussion about these units, please visit:

Expand Down
112 changes: 112 additions & 0 deletions XFade.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
-- GLOBALS: app, os, verboseLevel, connect, tie
local app = app
local Class = require "Base.Class"
local Unit = require "Unit"
local ModeSelect = require "Unit.ViewControl.OptionControl"
local GainBias = require "Unit.ViewControl.GainBias"
local BranchMeter = require "Unit.ViewControl.BranchMeter"
local MenuHeader = require "Unit.MenuControl.Header"
local Gate = require "Unit.ViewControl.Gate"
local Encoder = require "Encoder"
local ply = app.SECTION_PLY

local XFade = Class{}
XFade:include(Unit)

function XFade:init(args)
args.title = "XFade"
args.mnemonic = "XF"
Unit.init(self,args)
end

function XFade:onLoadGraph(channelCount)
local a = self:createObject("ConstantGain","a")
local b = self:createObject("ConstantGain","b")
local crossfade = self:createObject("CrossFade","crossfade")
a:hardSet("Gain",1.0)
b:hardSet("Gain",1.0)
a:setClampInDecibels(-59.9)
b:setClampInDecibels(-59.9)
local level = self:createObject("GainBias","level")
local levelRange = self:createObject("MinMax","levelRange")
self:createMonoBranch("inA", a, "In", a,"Out")
self:createMonoBranch("inB", b, "In", b,"Out")
self:createMonoBranch("xfade",crossfade,"In",crossfade,"Out")

-- local vcaA = self:createObject("Multiply","vcaA")
-- local vcaB = self:createObject("Multiply","vcaB")




-- connect(a,"Out",vcaB,"Left")
-- connect(b,"Out",vcaA,"Left")
connect(a,"Out",crossfade,"A")
connect(b,"Out",crossfade,"B")
connect(level,"Out",levelRange,"In")
connect(level,"Out",crossfade,"Fade")
connect(crossfade,"Out",self,"Out1")

if channelCount > 1 then
connect(crossfade,"Out",self,"Out2")
end


end

local function linMap(min,max,superCoarse,coarse,fine,superFine)
local map = app.LinearDialMap(min,max)
map:setSteps(superCoarse,coarse,fine,superFine)
return map
end

local fadeMap = linMap(0,1,1,0.1,0.01,0.001)

local views = {
expanded = {"a","b","crossfade"},
collapsed = {},
input = {}
}

function XFade:onLoadViews(objects,branches)
local controls = {}

controls.a = BranchMeter {
button = "a",
branch = branches.inA,
faderParam = objects.a:getParameter("Gain")
}

controls.b = BranchMeter {
button = "b",
branch = branches.inB,
faderParam = objects.b:getParameter("Gain")
}

controls.crossfade = GainBias {
button = "xfade",
description = "Crossfade",
branch = branches.xfade,
gainbias = objects.level,
biasMap = fadeMap,
biasUnits = app.unitNone,
range = objects.levelRange,
initialBias = 0.0,
}

self:addToMuteGroup(controls.a)
self:addToMuteGroup(controls.b)

return controls, views
end

local menu = {
"infoHeader",
"rename",
"load",
"save",
"edit"
}


return XFade
4 changes: 4 additions & 0 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2029-09-27 Accents v0.5.03.1
NEW UNIT: XFade
NEW UNIT: Ladder BPF2 - changes bandwidth (BW) controller from log to linear response

2019-11-14 Accents v0.4.26.2
FIXED: Xoxo and Xo units not loading correctly

Expand Down
5 changes: 5 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ local units = {

{category="Essentials"},
{title="Linear Sampling VCA", moduleName="LinearSamplingVCA",keywords="modulate, utility"},
{title="Xfade",moduleName="XFade",keywords="utility"},

{category = "Delays and Reverb"},


{category="Filtering"},
{title="Comb Filter",moduleName="CombFilter",keywords="filter"},
{title="Ladder BPF",moduleName="BespokeBPF",keywords="filter"},
{title="Scorpio Vocoder", moduleName="Scorpio", keywords="filter, modulate"},

Expand All @@ -29,13 +31,15 @@ local units = {
{title="Voltage Bank 4",moduleName="VoltageBank4",keywords="mapping"},
{title="Voltage Bank 2",moduleName="VoltageBank2",keywords="mapping"},
{title="Octave CV Shifter", moduleName="OctaveCVShifter",keywords="mapping"},
{title="Inverse", moduleName="Inverse",keywords="mapping"},

{category="Timing"},
{title="Carousel Clock Divider",moduleName="CarouselClockDivider",keywords="timing"},
{title="Timed Gate", moduleName="TimedGate",keywords="timing"},

{category="Experimental"},
{title="AB Switch", moduleName="ABSwitch",keywords="control"},
{title="Ladder BPF2",moduleName="LadderBPF",keywords="filter"},



Expand All @@ -50,6 +54,7 @@ local units = {
{title="Phaser", moduleName="Phaser4",keywords="effect"},
{title="Ensemble",moduleName="StereoEnsemble",keywords="modulate, pitch"},
{title="Flanger",moduleName="Flanger",keywords="modulate, pitch"},
{title="Dirt",moduleName="Dirt",keywords="distortion"}
}

return {
Expand Down

0 comments on commit 49d5781

Please sign in to comment.