home/ atoms/ code-generation-from-csv-schema

Audio plugin parameters can be defined in a CSV schema and the parameter boilerplate auto-generated to reduce repetition

SOURCE’s sampler engine has dozens of per-sound parameters (start/end position, ADSR, filter, pitch, pan, etc.). Writing getters, setters, serialization, and UI wiring for each by hand is error-prone and tedious. SOURCE solves this by defining all parameters in a single CSV file (data_for_code_gen.csv) with columns for name, type, min, max, and default. A Python script (generate_code.py) reads the CSV and emits the C++ boilerplate for each parameter. Adding a new parameter means adding a row to the CSV and re-running the script — the parameter is then available in SourceSound, serialised to the preset XML, and wired to the desktop UI automatically. This pattern separates specification from implementation: the CSV is the ground truth for what parameters exist. A common mistake is editing the generated code directly — changes would be overwritten on the next code generation run.

Examples

Adding a reverbSend parameter: add one row to data_for_code_gen.csv with min=0.0, max=1.0, default=0.0, run python generate_code.py -i. The parameter appears in the C++ SourceSound class, in preset files, and in the HTML UI, without writing any new code.

Assessment

What is the single file to edit when adding a new sound parameter to SOURCE? Why should you never manually edit the generated C++ files? What does generate_code.py -i do and when should it be run?

“editing the [data_for_code_gen.csv](https://github.com/ffont/source/blob/master/SourceSampler/data_for_code_gen.csv) CSV file”
corpus · source-a-freesound-community-sampler-open-source · chunk 11