If you see any errors or omissions, feel free to fix them by either creating an issue or (even better!) a pull request on the github repo for this tutorial.
Hi Mads. Thanks so much for this tutorial!
Iāve followed the instructions but keep on getting this error message: āexception in GraphDef_Recv: UGen āRampUpGenā not installed.ā Iām sure there might be a crucial step Iām missing (being a total novice).
However, Iām working on a Linux terminal and trying to test the plugin on SuperCollider on Windows, but Iām not getting any scx files. Anything I should add to either cmake command?
Iād like to contribute with a draft āreferenceā to the C++ plugin interface. Iām just copy/pasting function signatures and their comments from include/plugin_interface/SC_Plugin.hpp, reordering them a little bit, and letās see if a list makes it easier to access this info.
Traditionally, UGens are written C-style, as a set of three functions and a Unit struct. The cookie-cutter approach brings in a nice C++ interface, through the SCUnit class. Here is a list of things SCUnit can do for you:
Getting inputs and outputs:
/// get input signal at index
const float* in(int index) const
/// get input signal at index (to be used with ZXP)
const float* zin(int index);
/// get first sample of input signal
float in0(int index) const;
/// get output signal at index
float* out(int index) const;
/// get output signal at index (to be used with ZXP)
float* zout(int index) const;
/// get reference to first sample of output signal
float& out0(int index) const;
/// get number of inputs
int numInputs() const;
/// get number of outputs
int numOutputs() const;
Getting input rates:
/// get rate of input signal
int inRate(int index) const;
/// test if input signal at index is scalar rate
bool isScalarRateIn(int index) const;
/// test if input signal at index is demand rate
bool isDemandRateIn(int index) const;
/// test if input signal at index is control rate
bool isControlRateIn(int index) const;
/// test if input signal at index is audio rate
bool isAudioRateIn(int index) const;
Sample/Control Rates and Block Size:
/// get sample rate of ugen
double sampleRate() const;
/// get sample duration (1 / sampleRate)
double sampleDur() const;
/// get sampling rate of audio signal
double fullSampleRate() const;
/// get control rate
double controlRate();
/// get duration of a control block
double controlDur() const;
/// get buffer size of ugen
int bufferSize() const;
/// get buffer size of audio signals
int fullBufferSize() const;
/// get the blocksize of the input
int inBufferSize(int index) cons;
Slopes:
/// calculate slope value (used internally by SlopeSignal)
template <typename FloatType>
FloatType calcSlope(FloatType next, FloatType prev) const;
Make and register calc functions:
template <typename UnitType, void (UnitType::*PointerToMember)(int)> static UnitCalcFunc
make_calc_function(void);
/// set calc function & compute initial sample
template <typename UnitType, void (UnitType::*PointerToMember)(int)>
void set_calc_function(void);
/// set calc function & compute initial sample
template <typename UnitType, void (UnitType::*VectorCalcFunc)(int), void (UnitType::*ScalarCalcFunc)(int)>
void set_vector_calc_function(void);
Using the tutorial I managed to successfully make a first plugin
Thanks!
Some further questions:
Could it be extended with the instructions to make github build releases from tags (I vaguely remember seeing something pass by, but I donāt remember when/where)?
One question about the development of SC: should the main C++ be more documented or this is something to avoid ? I am curious to know how this work for other FLOSS projects, I was thinking if this, on the one hand, could lead to a more dense and difficult code to read/work or if this, on the other hand, would help other developers to quickly understand, remember and fix code sections.
BTW, I though that the Blip UGen would be something simpler, somehow like a sync function, but I found a really dense code. Can someone explain basically how the Blip UGen works (OscUGens.cpp) ?
Hi. Thanks for the tutorial. I canāt seem to find any information on the syntax/specification for the .sc file. Can you point me to a resource on that topic?
Fist of all thanks to Mads for this tutorial, unfortunately Iām a bit stuck at generating the cookie cutter templateā¦
Iām on an M1 Mac, and I made sure to install python3.7 first, but maybe there is a problem between that version and M1 Macs? Iām a noob at python so any pointers appreciated!
Hereās how it looks when I try:
$ cookiecutter https://github.com/supercollider/cookiecutter-supercollider-plugin
You've downloaded /Users/bimjozz/.cookiecutters/cookiecutter-supercollider-plugin before. Is it okay to delete and re-download it? [yes]:
full_path_to_supercollider_source [/home/wendy/supercollider (if you haven't cloned it yet, do that first! Press Ctrl-C to exit this script)]: /Users/bimjozz/tmp/supercollider
project_name [Simple Gain]: Simple Ramp
project_namespace [SimpleRamp]:
repo_name [simpleramp]:
plugin_name [SimpleRamp]:
plugin_description [A simple audio volume gain plugin]: A simple ramp generator
full_name [Wendy Carlos]:
github_username [wendy.carlos]:
email [wendy.carlos@site.com]:
Running pre-project-generation hook...
Checking Python version...
Checking for SuperCollider repository...
Running post-project-generation hook...
Initializing new Git repository
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /Users/bimjozz/simpleramp/.git/
Running CMake generation script
Traceback (most recent call last):
File "/var/folders/1y/vvdm91yj107606d5q6zpm0580000gn/T/tmpg6zzilfa.py", line 25, in <module>
'--install-cmake'
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python': 'python'
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)