Using JavaScript to communicate with Pure Data #16
-
Is there a way to do this? In my case, I want to use Pure Data as the audio engine of a Three JS game, but was unable to figure out how to communicate with the patch from JavaScript. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Hi @luismrguimaraes, Yes, it is possible I am yet doing the docs, but you can understand part of it reading this: https://charlesneimog.github.io/pd4web/js/ In this case, to send a float from To send, for example, a float from Pd to Js you need the function: Pd4Web.onFloatReceived("myfloat", function (f) {
console.log("Received " + f)
}); This function will be executed always you send something to object |
Beta Was this translation helpful? Give feedback.
Hi @luismrguimaraes,
Yes, it is possible I am yet doing the docs, but you can understand part of it reading this:
https://charlesneimog.github.io/pd4web/js/
In this case, to send a float from
js
to PureData you need to usePd4Web.sendFloat("myreceiver", 5)
, from Pd, you will receive this number from the object[r myreceiver]
.To send, for example, a float from Pd to Js you need the function:
This function will be executed always you send something to object
[s myfloat]
(on Pd side).