p5.serialserver icon indicating copy to clipboard operation
p5.serialserver copied to clipboard

interest in serial over audio using webjack?

Open jywarren opened this issue 5 years ago • 3 comments

Hello, I am one of the developers of WebJack (https://github.com/publiclab/webjack) and love your library. I was curious if you'd be interested in an audio connection implementation of this lib, which would wrap WebJack and allow for connecting using the browser's WebRTC microphone API. It's not as solid as your implementation but is nice because it requires no app, and works on phones.

I think making a WebJack wrapper offer exactly the same methods as p5.serialport would be pretty easy, but wanted to ask if you're interested in this first. Otherwise I think I could refactor the simple example i have to at least match p5.serialport: https://p5js.org/examples/interaction-arduino-sensor-data-via-webjack.html

Thanks!

jywarren avatar Mar 02 '20 22:03 jywarren

Hi Jeffrey,That sounds really interesting!  I think it would be great to try.  There is the possibility that it will work on mobile devices that support WebRTC as well!Please let me know how I can help.. (I have experience with WebRTC but not much in the way of audio processing)BestShawnOn Mar 2, 2020 5:29 PM, Jeffrey Warren [email protected] wrote:Hello, I am one of the developers of WebJack (https://github.com/publiclab/webjack) and love your library. I was curious if you'd be interested in an audio connection implementation of this lib, which would wrap WebJack and allow for connecting using the browser's WebRTC microphone API. It's not as solid as your implementation but is nice because it requires no app, and works on phones. I think making a WebJack wrapper offer exactly the same methods as p5.serialport would be pretty easy, but wanted to ask if you're interested in this first. Otherwise I think I could refactor the simple example i have to at least match p5.serialport: https://p5js.org/examples/interaction-arduino-sensor-data-via-webjack.html Thanks!

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

vanevery avatar Mar 04 '20 03:03 vanevery

Awesome, thanks for replying!

My first thought was to try to split out the constructor, maybe here, and just substitute a wrapper around WebJack that has the same serialPort.on('data', gotData) type events. But, i can see there are a couple places where this could be done.

https://github.com/p5-serial/p5.serialport/blob/6ba8b9dfccc86727e8e159662070ae6e761d986f/classes/SerialPort.js#L28-L39

But given that there is a lot of websockets based code higher up, this maybe isn't a bad place. On the other hand, if our goal is to just make it easy to switch, maybe not mixing the code up but instead offering a p5.serialportWebjack library that simply uses the same syntax really is better. Then people can just change the constructor and the rest of the basic usage would remain the same. What do you think?

Thanks again!

jywarren avatar Mar 05 '20 17:03 jywarren

In terms of API to be compatible with, these three methods seem most important:

  // When we some data from the serial port
  serial.on('data', gotData);

  // When or if we get an error
  serial.on('error', gotError);

  // When our serial port is opened and ready for read/write
  serial.on('open', gotOpen);

However, maybe we'd want to create a simple one for serial.on('connected', serverConnected); as well.

jywarren avatar Mar 05 '20 17:03 jywarren