Configuration#
Many defaults can be configured via csoundengine.config.config (an instance
of configdict.ConfigDict, see https://configdict.readthedocs.io).
Note
To modify defaults in a persistent manner, call ConfigDict.save()
to save the current version. The changes will be loaded the next time this
module is imported
Example#
import csoundengine as ce
# Modify the default number of channels, force it to 2
ce.config['nchnls'] = 2
# Set default A4 value
ce.config['A4'] = 443
# Larger number of audio buses
ce.config['num_audio_buses'] = 200
# If you would like to set these as defaults, call save. The next time using
# csoundengine, these settings will be the default.
ce.config.save()
# To revert the changes to the default, use reset:
ce.config.reset()
Any Engine created after this will pick up these
new defaults:
>>> from csoundengine import *
>>> engine = Engine()
>>> engine.numAudioBuses
200
>>> engine.A4
443
Edit the config interactively#
from csoundengine import *
config.edit()
This will open the config in a text editor and any changes there will be reflected back in the config. Which application is used depends on the os settings for handling yaml files.
Keys#
- sr:
- Default: 0 –
intChoices:0, 22050, 24000, 44100, 48000, 88200, 96000, 144000, 192000samplerate - 0=default sr for the backend
- rec_sr:
- Default: 44100 –
intChoices:0, 22050, 24000, 44100, 48000, 88200, 96000, 144000, 192000default samplerate when rendering
- nchnls:
- Default: 0 –
intBetween 0 - 128Number of output channels. 0=default for used device
- nchnls_i:
- Default: 0 –
intBetween 0 - 128Number of input channels to use. 0 = default for used device
- ksmps:
- Default: 64 –
intChoices:16, 32, 64, 128, 256, 512, 1024corresponds to csound’s ksmps
- rec_ksmps:
- Default: 64 –
intChoices:16, 32, 64, 128, 256, 512, 1024samples per cycle when rendering
- rec_sample_format:
- Default: float –
(int, str)Choices:16, 24, 32, floatSample format used when rendering
- rec_suppress_output:
- Default: False –
boolSupress debugging output when rendering offline
- buffersize:
- Default: 0 –
int-b value. 0=determine buffersize depending on ksmps & backend
- numbuffers:
- Default: 0 –
intdetermines the -B value as a multiple of the buffersize. 0=auto
- linux_backend:
- Default: jack, pulse, pa_cb –
stra comma separated list of backends (possible backends: jack, pulse, pa_cb, alsa)
- macos_backend:
- Default: pa_cb –
stra comma separated list of backends (possible backends: pa_cb, auhal)
- windows_backend:
- Default: pa_cb –
stra comma separated list of backends (possible backends: pa_cb, pa_bl)
- A4:
- Default: 442 –
intBetween 410 - 460Frequency for A4
- numthreads:
- Default: 1 –
intNumber of threads to use for realtime performance. This is an experimental feature if csound and might not necessarily result in better performance
- rec_numthreads:
- Default: 0 –
intNumber of threads to use when rendering online. If not given, the value set in `numthreads` is used
- check_pargs:
- Default: False –
boolCheck number of pargs passed to instr
- max_pfields:
- Default: 1900 –
intThe size limit for pfields in an event
- offline_score_table_size_limit:
- Default: 1900 –
intsize limit when writing tables as f score statements via gen2. If a table is bigger than this size, it is saved as a datafile as gen23 or wav
- dynamic_pfields:
- Default: True –
boolIf True, use pfields for dynamic parameters (named args starting with k). Otherwise, dynamic controls are implemented via a global table
- fail_if_unmatched_pargs:
- Default: False –
boolFail if the number of passed arguments doesnt match the number of defined arguments
- set_sigint_handler:
- Default: True –
boolSet a sigint handler to prevent csound crash with CTRL-C
- disable_signals:
- Default: True –
boolDisable atexit and sigint signal handler
- generalmidi_soundfont:
- Default: ‘’ –
strDefault soundfont used for general midi rendering
- suppress_output:
- Default: True –
boolSuppress csound´s debugging information
- unknown_parameter_fail_silently:
- Default: True –
boolDo not raise if a synth tries to set an unknown parameter
- define_builtin_instrs:
- Default: True –
boolIf True, a Session with have all builtin instruments defined
- sample_fade_time:
- Default: 0.02 –
floatFade time (in seconds) when playing samples via a Session
- prefer_udp:
- Default: True –
boolIf true and a udp server was defined, prefer UDP over the API for communication
- start_udp_server:
- Default: False –
boolStart an engine with udp communication support
- num_audio_buses:
- Default: 64 –
intNum. of audio buses in an Engine/Session
- num_control_buses:
- Default: 512 –
intNum. of control buses in an Engine/Session. This sets the upper limit to the number of simultaneous control buses in use
- html_theme:
- Default: light –
strChoices:dark, lightStyle to use when displaying syntax highlighting in jupyter
- html_args_fontsize:
- Default: 12px –
strFont size used for args when outputing html (in jupyter)
- synth_repr_max_args:
- Default: 12 –
intMax. number of pfields shown when in a synth’s repr
- synth_repr_show_pfield_index:
- Default: False –
boolShow the pfield index for named pfields in a Synths repr
- synthgroup_repr_max_rows:
- Default: 4 –
intMax. number of rows for a SynthGroup repr. Use 0 to disable
- synthgroup_html_table_style:
- Default: font-size: smaller –
strInline css style applied to the table displayed as html for synthgroups
- jupyter_synth_repr_interact:
- Default: True –
boolWhen inside jupyter, add interactive widgets if a synth hasnamed parameters
- jupyter_instr_repr_show_code:
- Default: True –
boolShow code when displaying an Instr inside jupyter
- ipython_load_magics_at_startup:
- Default: True –
boolLoad csoundengine.magic at startup when inside ipython. If False, magics can still be loaded via `%load_ext csoundengine.magic`
- magics_print_info:
- Default: False –
boolPrint some informative information when the csounengine.magic extension is loaded
- jupyter_slider_width:
- Default: 80% –
strCSS Width used by an interactive slider in jupyter
- timeout:
- Default: 2.0 –
floatTimeout for any action waiting a response from csound
- sched_latency:
- Default: 0.05 –
floatTime delay added to any event scheduled to ensure that simultameous events arenot offset by scheduling overhead
- datafile_format:
- Default: gen23 –
strChoices:gen23, wavFormat used when saving a table as a datafile
- max_dynamic_args_per_instr:
- Default: 10 –
intBetween 2 - 512Max. number of dynamic parameters per instr
- session_priorities:
- Default: 10 –
intBetween 1 - 99Number of priorities within a session
- dynamic_args_num_slots:
- Default: 10000 –
intBetween 10 - 9999999Number of slots for dynamic parameters. args slices. Dynamic args are implemented as a big array divided in slices. This parameter sets the max. number of such slices, and thus the max number of simultaneous events with named args which can coexist. The size of the allocated table will be size = num_dynamic_args_slices * max_instr_dynamic_args. For 10000 slots, theamount of memory is ~0.8Mb
- instr_repr_show_pfield_pnumber:
- Default: False –
boolAdd pfield number when printing pfields in instruments
- spectrogram_colormap:
- Default: inferno –
strChoices:cividis, inferno, magma, plasma, viridis
- samplesplot_figsize:
- Default: 12:4 –
strThe figure size of the plot in the form ‘<width>:<height>’
- spectrogram_figsize:
- Default: 24:8 –
strThe figure size of the plot in the form ‘<width>:<height>’
- spectrogram_maxfreq:
- Default: 12000 –
intHighest freq. in a spectrogram
- spectrogram_window:
- Default: hamming –
strChoices:hamming, hanning