[PD] pd -> svg

Jonathan Wilkes jancsika at yahoo.com
Sun May 12 01:02:50 CEST 2013


>From: s p <sebpiq at gmail.com>
>To: Jonathan Wilkes <jancsika at yahoo.com> 
>Cc: PD List <pd-list at iem.at> 
>Sent: Saturday, May 11, 2013 4:37 PM
>Subject: Re: [PD] pd -> svg
>
>Thanks Jonathan,
>
>I don't really have the time to take care about this those days, but I'll fix it as soon as possible, and post here when that'll be done.
>
>Cheers,
>
>Sébastien
Here's an idea...

Suppose I build a Pd gui-plugin that exports a Pd file to svg.  It takes the toplevel patch and makes the drawing instructions like my example in the OP.  But it also draws a little navigation bar at the bottom with 1) a little image with id="source patchname", 2) a play button with id = "webpd-play patchname", 3) a stop button with id = "webpd-stop patchname"

The image with id="source patchname" is the base64-encoded source of the patch.  This would be neat because:

a) Anyone could export to svg and get a file that can be displayed in any modern browser (with searchable/selectable text in most of them).
b) Since the drawing instructions Pd uses are so simple the svg will probably display on mobile devices (even older ones).
c) Since the source is embedded in the file, webpd js could just listen for clicks to any webpd-play buttons in the page, and when it catches one it looks for an svg image with id "source" plus the same patchname as the webpd-play button.  It then decodes the image, loads it and plays it until it receives a "webpd-stop" button click.

This method has the benefit of degrading gracefully; that is, if someone using NoScript wants to read a forum with pd patch svg images in it, they will still be able to view the image.  Moreover, a forum admin or blog owner can post the svgs simply to show pictures of patches; then later when the audio api becomes more common than just firefox nightly they can add the webpd code once and all their images will now feature audio.

-Jonathan




More information about the Pd-list mailing list