-
Notifications
You must be signed in to change notification settings - Fork 122
New plugin: BFold (was: Timbre) (wavefolder) #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
georgezachos
wants to merge
21
commits into
supercollider:main
Choose a base branch
from
georgezachos:3.10
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2904031
appveyor: add artifacts and github deployment
mossheim 63a5f76
Merge pull request #227 from supercollider/appveyor/deploy-gh
a980a83
cmake: remove refs to missing dirs
mossheim 2bd9a9e
travis: add build for linux
gusano f2ec7aa
appveyor: don't clone supercollider recursively
mossheim 123848b
Update DWGPluckedStiff.schelp
redFrik 09587c4
Merge pull request #232 from supercollider/topic/cleanup-dirs
mossheim b73571a
Merge pull request #235 from brianlheim/cherry-230
mossheim a34e6cf
Merge pull request #233 from supercollider/cherry/220
patrickdupuis 10b2e86
travis: minor improvements
mossheim 7576620
travis: build supernova plugins
mossheim 1b58c16
Merge pull request #237 from supercollider/travis-plus
mossheim c2a3104
Wavefolder Timbre plugin
georgezachos 042d288
typo
georgezachos 1509a6b
change Timbre name to BFold
georgezachos 32f51e1
'fold' input parameter is now audio rate
georgezachos 7428ca8
Merge branch '3.10' of https://github.com/georgezachos/sc3-plugins in…
georgezachos 1b29877
update help file
georgezachos 9e485a0
schelp up to date with latest changes
georgezachos bbc6a90
check for valid inputs
georgezachos 388a903
forgotten PluginLoad name from previous naming convention
georgezachos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#include "SC_PlugIn.hpp" | ||
#include <math.h> | ||
|
||
// InterfaceTable contains pointers to functions in the host (server). | ||
static InterfaceTable *ft; | ||
|
||
// declare struct to hold unit generator state | ||
struct BFold : public SCUnit{ | ||
|
||
// Constructor usually does 3 things. | ||
// 1. set the calculation function. | ||
// 2. initialize the unit generator state variables. | ||
// 3. calculate one sample of output. | ||
public: | ||
BFold() { | ||
// 1. set the calculation function. | ||
set_calc_function<BFold,&BFold::next>(); | ||
|
||
// 3. calculate one sample of output. | ||
next(1); | ||
|
||
} | ||
|
||
private: | ||
// The calculation function executes once per control period | ||
// which is typically 64 samples. | ||
|
||
// calculation function for an audio rate frequency argument | ||
void next(int inNumSamples) | ||
{ | ||
// get the pointer to the output buffer | ||
float *outBuf = out(0); | ||
|
||
// get the pointer to the input buffer | ||
const float *sig = in(0); | ||
const float *fold = in(1); | ||
const float offset = in0(2); | ||
|
||
// perform a loop for the number of samples in the control period. | ||
// If this unit is audio rate then inNumSamples will be 64 or whatever | ||
// the block size is. If this unit is control rate then inNumSamples will | ||
// be 1. | ||
for (int i=0; i < inNumSamples; ++i) | ||
{ | ||
float sgn; | ||
float sigNorm; | ||
float sigAbs; | ||
float fold1 = 0.f; | ||
float fold2 = 0.f; | ||
float fold3 = 0.f; | ||
float fold4 = 0.f; | ||
float fold5 = 0.f; | ||
|
||
sigNorm = offset*0.6 + (fold[i]*5.4 +0.6)*sig[i]; | ||
// sigNorm = 0.5 + 2.f*sig[i]*0.6; | ||
sigAbs = fabs(sigNorm); | ||
sgn = copysignf(1.0, sig[i]); | ||
|
||
if (sigAbs >= 0.6) { | ||
fold1 = 0.8333*sigNorm - 0.5*sgn; | ||
fold1 *= -12.f; | ||
if (sigAbs >= 1.8) { | ||
fold2 = 0.5743*sigNorm - 1.0338*sgn; | ||
fold2 *= 17.647; | ||
if (sigAbs >= 2.994) { | ||
fold3 = 0.3768*sigNorm - 1.1281*sgn; | ||
fold3 *= -27.777; | ||
if (sigAbs >= 4.08) { | ||
fold4 = 0.2673*sigNorm - 1.0907*sgn; | ||
fold4 *= 36.363; | ||
if (sigAbs >= 5.46) { | ||
fold5 = 0.2829*sigNorm - 1.5446*sgn; | ||
fold5 *= -21.438; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
// out must be written last for in place operation | ||
outBuf[i] = (fold1 + fold2 + fold3 + fold4 + fold5 + 5.f * sigNorm)/3.f; | ||
} | ||
} | ||
|
||
}; | ||
|
||
// the entry point is called by the host when the plug-in is loaded | ||
PluginLoad(VAfxUGens) | ||
{ | ||
// InterfaceTable *inTable implicitly given as argument to the load function | ||
ft = inTable; // store pointer to InterfaceTable | ||
|
||
// registerUnit takes the place of the Define*Unit functions. It automatically checks for the presence of a | ||
// destructor function. | ||
// However, it does not seem to be possible to disable buffer aliasing with the C++ header. | ||
registerUnit<BFold>(ft, "BFold"); | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
BFold : UGen { | ||
*ar { arg in, fold=0.0, offset=0.0; | ||
^this.multiNew('audio', in, fold, offset) | ||
} | ||
checkInputs { | ||
[0, 1].do { |i| | ||
(inputs[i].rate != 'audio').if { | ||
^(" input at index " + i + "(" + inputs.at(i) + | ||
") is not audio rate"); | ||
}; | ||
}; | ||
^this.checkValidInputs; | ||
} | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class:: BFold | ||
summary:: Wavefolder virtual analog model | ||
categories:: UGens>Filters | ||
|
||
patrickdupuis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Description:: | ||
A model of the "timbre" circuit of the Buchla 259 Complex Wave Generator. The model follows the circuit modelling as seen on the paper link::http://www.dafx17.eca.ed.ac.uk/papers/DAFx17_paper_82.pdf::, using 5 folds. | ||
|
||
|
||
classmethods:: | ||
|
||
method::ar | ||
|
||
argument::in | ||
Input signal. | ||
|
||
argument::fold | ||
Folding amount (audio rate). Useful range: [0, ..] | ||
|
||
argument::offset | ||
Input offset (control rate). Useful range: [-1, 1]. | ||
|
||
|
||
Examples:: | ||
|
||
code:: | ||
{BFold.ar(SinOsc.ar(200), K2A.ar(MouseX.kr(0,3)), MouseY.kr(-1,1))}.scope | ||
:: |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.