View Source SuperCollider.SynthDef.ScFile (SuperCollider v0.1.0)

Link to this section Summary

Functions

Takes a a filename as as single parameter, which is a the filename (and path) of the .scsyndef file to parse. This currently parses SuperCollider version 2 file format only.

Link to this section Functions

Takes a a filename as as single parameter, which is a the filename (and path) of the .scsyndef file to parse. This currently parses SuperCollider version 2 file format only.

Returns the populated %ScFile{} struct.

You can access the individual synth definitions via the :synth_def key on the struct.

example

Example

alias uperCollider.SynthDef.ScFile

# Parse the scsyndef file
sc_file = ScFile.parse("/supercollider/ambient.scsyndef")

This returns the parsed file as a struct:

%SuperCollider.SynthDef.ScFile{
  type_id: "SCgf",
  file_version: 2,
  synth_defs_count: 1,
  synth_defs: [
    # ... truncated, see below for example contents of the synth_defs key
  ],
      varient_count: 0,
      varient_specs_list: []
    }
  ]
}

You can access the list of synth definitions using the synth_def key:

sc_file.synth_defs

Which will return

[
  %SuperCollider.SynthDef{
    name: "ambient",
    constant_count: 1,
    constant_values_list: [{0, 0.2}],
    parameter_count: 1,
    parameter_values_list: [{0, 0.0}],
    parameter_names_count: 1,
    parameter_names_list: [
      %{_enum_index: 0, parameter_index: 0, parameter_name: "out"}
    ],
    ugen_count: 4,
    ugen_specs_list: [
      %SuperCollider.SynthDef.UGen{
        class_name: "Out",
        calculation_rate: 2,
        special_index: 0,
        inputs_count: 2,
        input_specs_list: [
          %{_enum_count: 1, index: 2, output_index: 0, type: :ugen},
          %{_enum_count: 0, index: 0, output_index: 0, type: :ugen}
        ],
        outputs_count: 0,
        output_specs_list: []
      },
      %SuperCollider.SynthDef.UGen{
        class_name: "BinaryOpUGen",
        calculation_rate: 2,
        special_index: 2,
        inputs_count: 2,
        input_specs_list: [
          %{_enum_count: 1, index: 0, type: :constant},
          %{_enum_count: 0, index: 1, output_index: 0, type: :ugen}
        ],
        outputs_count: 1,
        output_specs_list: [%{calculation_rate: 2, count: 0}]
      },
      %SuperCollider.SynthDef.UGen{
        class_name: "BrownNoise",
        calculation_rate: 2,
        special_index: 0,
        inputs_count: 0,
        input_specs_list: [],
        outputs_count: 1,
        output_specs_list: [%{calculation_rate: 2, count: 0}]
      },
      %SuperCollider.SynthDef.UGen{
        class_name: "Control",
        calculation_rate: 1,
        special_index: 0,
        inputs_count: 0,
        input_specs_list: [],
        outputs_count: 1,
        output_specs_list: [%{calculation_rate: 1, count: 0}]
      }
    ]