Clamps Packages
Export to SVG
Exporting to SVG is done with the events function. As different event types are supported by Clamps, any combination of MIDI, SFZ, Poolevt or custom declared event types can be integrated into a single sequence and exported to SVG with a single call to events.
The exported SVG elements are displayed in a 2-dimensional grid with the x-axis denoting musical time, although any other mapping can easily be applied to the im/exported data if deemed appropriate. The exported graphical objects can be considered as typed output1, with their type and additional custom properties defined in an attributes tag of each SVG element (see Fig. 4).
Example
(events (append (loop for time below 3 by 2/8 collect (new sfz :time time :keynum (between 60.0 84.0) :duration 1/2)) (loop for time from 1/8 below 3 by 2/8 collect (new midi :time time :keynum (between 60 84) :amplitude 1.0 :channel (between 1 16) :duration 1/2))) (svg-gui-path "svg-xml-example.svg") :showgrid nil :staff-system-vis nil)
