I'm using jinja2 to template a supercollider startup file.
I have a variable {{ sc_option_numOutputBusChannels }}
from which I need to generate a list.
Specifically, if sc_option_numOutputBusChannels = 8
, then I need to create the following list:
[0, 2, 4, 6]
for use in the line:
~dirt.start(57120, [0, 2, 4, 6]);
The function range(0, sc_option_numOutputBusChannels, 2 )
outputs that list exactly as I need it, but I've been unable to find a way to use the output of range
directly as a string in my template - eg these don't work:
~dirt.start(57120, {% range(0, sc_option_numOutputBusChannels, 2 ) %} );
~dirt.start(57120, {{ range(0, sc_option_numOutputBusChannels, 2 ) }} );
Is there a way to do this?