showPresets

maelzel.core.presetmanager.showPresets(pattern='*', full=False, showGeneratedCode=False)

Show the selected presets

The output is printed to stdout if inside a terminal or shown as html inside jupyter

Parameters:
  • pattern – a glob pattern to select which presets are shown

  • full – show all attributes of a Preset

  • showGeneratedCode – if True, all generated code is shown. Assumes full

Return type:

None

Example

>>> from maelzel.core import *
>>> showPresets("piano")
Preset: piano
  init: iSfTable_ sfloadonce "/home/user/sf2/grand-piano-YDP.sf2"
  code:
    ipresetidx sfPresetIndex "/home/user/sf2/grand-piano-YDP.sf2", 0, 0
    inote0_ = round(p(idataidx_ + 1))
    ivel_ = p(idataidx_ + 2) * 127
    aout1, aout2 sfplay ivel_, inote0_, kamp/16384, mtof:k(kpitch), ipresetidx, 1
  epilogue:
    turnoffWhenSilent aout1

At init time the samples are loaded. The event turns itself off when the sample is silent, so it is possible to use an infinite duration to produce a one-shot playback.

Parameters:
  • pattern – a glob pattern to select which presets are shown

  • showGeneratedCode – if True, all actual code of an instrument is show. Otherwise, only the audio code is shown