Hi Jonathan,

Yes, yes! I'd love a good web-based editor! And I have looked into this for a while, but being not a priority, I had put it aside for now... How are your experiments doing? You should definitely keep me updated on this.

> Is there some way for webpd to look inside one of the page's DOM elements for patch file data (perhaps a <pre> with a particular id)?

Indeed, to load a patch you just pass as string to "Pd.loadPatch" function. That string is the whole contents of a Pd patch. So in the examples, I load the patch with AJAX : https://github.com/sebpiq/WebPd/blob/master/examples/phasor/index.html#L10 but you could definitely do something like this :

<script id="patch" type="text/x-puredata">
#N canvas 51 96 762 387 10;
#X obj 127 161 dac~;
</script>
<script>
  var patch = Pd.loadPatch(document.getElementById('patch').innerHTML)
  Pd.start()
</script>

Or even something like this :

<script>
  var patch = Pd.loadPatch('
#N canvas 51 96 762 387 10;\n#X obj 127 161 dac~;')
  Pd.start()
</script>

So basically WebPd just takes a Pd file. How you obtain that file is then up to you : AJAX, embedded in the HTML page, etc ...

> Could the data received from the AJAX call be inserted into the same DOM element?  That way you could save the html file and the patch data would get saved with it.

Yes you could do that. It is trivial with JavaScript. Even easier if you use a DOM manipulation library such as jQuery!

>
Can I add nodes after the patch has loaded?

Sure! There is a complete API for patches and objects. You can do with programming absolutely everything you can do with the Pd GUI and much more. For the moment this API is not documented, but I think it is rather easy to use, and if you dig into the tests, you can find out how to use it. For example : https://github.com/sebpiq/WebPd/blob/master/test/src/objects/glue-tests.js#L45
I like the idea to add a scripting layer to Pd. That way you could do something that no other sound programming language has achieved yet, and put together graphical programming and scripting using each method when most appropriate (Graphical programming is great for a DSP graph, but a pain in the ass for control flow and states, scripting is much more powerful for that). So yeah you can already do that with WebPd, though it is not fully tested yet so use with caution.

On Fri, May 1, 2015 at 4:50 AM, Jonathan Wilkes via Pd-list <pd-list@lists.iem.at> wrote:
This is great!

So many questions, but I'll just ask three for now:

Is there some way for webpd to look inside one of the page's DOM elements for patch file data (perhaps a <pre> with a particular id)?

Could the data received from the AJAX call be inserted into the same DOM element?  That way you could save the html file and the patch data would get saved with it.

Can I add nodes after the patch has loaded?

***

I think the holy grail here would be to take the GUI work I'm doing with svg and node.js and get it to play nice with webpd.  Then an editable Pd environment would run anywhere a modern browser could. :)

-Jonathan



On 04/30/2015 07:01 AM, s p wrote:
Thanks Joe!

Unfortunately, the current soundfiler uses AJAX, which means that you cannot load on other domains than where the web page is hosted. On the other hand, the [readsf~] object (which I haven't implemented yet) will be able to do that (any url that support CORS, for example soundcloud does).

On Thu, Apr 30, 2015 at 11:54 AM, Joe White <white.joe4@gmail.com> wrote:
Nice work Sébastien! 

I saw you have a [soundfiler] implementation, which is interesting. Is that able to load samples from within the patch directory structure or can it also load audio files from any URL (i.e. say a soundcloud link) ?

Cheers,
Joe

On 30 April 2015 at 11:17, s p <sebpiq@gmail.com> wrote:
WebPd 0.3.0 is finally out! Refactored from scratch, 100% pure Web Audio API, which means it should be as fast as it gets on the browser. check-it out https://github.com/sebpiq/WebPd feedback very welcome.

--
Sébastien Piquemal

 ----- @sebpiq
 ----- http://funktion.fm

_______________________________________________
Pd-announce mailing list
Pd-announce@lists.iem.at
http://lists.puredata.info/listinfo/pd-announce

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list



_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list




--
Sébastien Piquemal

 ----- @sebpiq
 ----- http://funktion.fm


_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list


_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list




--
Sébastien Piquemal

 ----- @sebpiq
 ----- http://github.com/sebpiq
 ----- http://funktion.fm