Clamps Packages
Import from SVG
Importing objects from SVG are done using Common Musics import-events function with the filename as argument.
Like for export, objects of any supported type can be imported and will be included in the same sequence object. below is an example for importing into Clamps using the exported svg file from the previous section.
(sort (subobjects (import-events (svg-gui-path "svg-xml-example.svg"))) #'< :key #'object-time) ;; => (#i(sfz time 0.0 keynum 63.42938 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 0.125 keynum 63.0 duration 0.5 amplitude 0.5 channel 1) ;; #i(sfz time 0.25 keynum 80.86092 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 0.375 keynum 79.0 duration 0.5 amplitude 0.5 channel 9) ;; #i(sfz time 0.5 keynum 61.039192 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 0.625 keynum 61.0 duration 0.5 amplitude 0.5 channel 9) ;; #i(sfz time 0.75 keynum 68.02148 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 0.875 keynum 64.0 duration 0.5 amplitude 0.5 channel 10) ;; #i(sfz time 1.0 keynum 64.643036 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 1.125 keynum 82.0 duration 0.5 amplitude 0.5 channel 9) ;; #i(sfz time 1.25 keynum 73.90509 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 1.375 keynum 77.0 duration 0.5 amplitude 0.5 channel 7) ;; #i(sfz time 1.5 keynum 75.27113 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 1.625 keynum 60.0 duration 0.5 amplitude 0.5 channel 3) ;; #i(sfz time 1.75 keynum 63.145172 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 1.875 keynum 79.0 duration 0.5 amplitude 0.5 channel 38) ;; #i(sfz time 2.0 keynum 69.082825 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 2.125 keynum 65.0 duration 0.5 amplitude 0.5 channel 1) ;; #i(sfz time 2.25 keynum 71.13065 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 2.375 keynum 67.0 duration 0.5 amplitude 0.5 channel 2) ;; #i(sfz time 2.5 keynum 70.6771 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 2.625 keynum 80.0 duration 0.5 amplitude 0.5 channel 6) ;; #i(sfz time 2.75 keynum 69.82674 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(midi time 2.875 keynum 62.0 duration 0.5 amplitude 0.5 channel 24))
Any of Common Music's filtering options defined for map-objects can be applied:
(subobjects (import-events (svg-gui-path "svg-xml-example.svg")) :class 'sfz) ;; => (#i(sfz time 0.0 keynum 63.42938 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 0.25 keynum 80.86092 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 0.5 keynum 61.039192 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 0.75 keynum 68.02148 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 1.0 keynum 64.643036 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 1.25 keynum 73.90509 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 1.5 keynum 75.27113 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 1.75 keynum 63.145172 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 2.0 keynum 69.082825 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 2.25 keynum 71.13065 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 2.5 keynum 70.6771 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100) ;; #i(sfz time 2.75 keynum 69.82674 amplitude 0.0 duration 0.5 preset :flute-nv oneshot nil pan 0.5 startpos 0 chan 100)) (subobjects (import-events (svg-gui-path "svg-xml-example.svg")) :class 'midi) ;; => (#i(midi time 1.625 keynum 60.0 duration 0.5 amplitude 0.5 channel 3) ;; #i(midi time 0.125 keynum 63.0 duration 0.5 amplitude 0.5 channel 1) ;; #i(midi time 0.875 keynum 64.0 duration 0.5 amplitude 0.5 channel 10) ;; #i(midi time 0.375 keynum 79.0 duration 0.5 amplitude 0.5 channel 9) ;; #i(midi time 0.625 keynum 61.0 duration 0.5 amplitude 0.5 channel 9) ;; #i(midi time 1.125 keynum 82.0 duration 0.5 amplitude 0.5 channel 9) ;; #i(midi time 2.375 keynum 67.0 duration 0.5 amplitude 0.5 channel 2) ;; #i(midi time 1.375 keynum 77.0 duration 0.5 amplitude 0.5 channel 7) ;; #i(midi time 2.625 keynum 80.0 duration 0.5 amplitude 0.5 channel 6) ;; #i(midi time 1.875 keynum 79.0 duration 0.5 amplitude 0.5 channel 38) ;; #i(midi time 2.875 keynum 62.0 duration 0.5 amplitude 0.5 channel 24) ;; #i(midi time 2.125 keynum 65.0 duration 0.5 amplitude 0.5 channel 1))