Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interest in serial over audio using webjack? #57

Open
jywarren opened this issue Mar 2, 2020 · 3 comments
Open

interest in serial over audio using webjack? #57

jywarren opened this issue Mar 2, 2020 · 3 comments

Comments

@jywarren
Copy link

jywarren commented Mar 2, 2020

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!

@vanevery
Copy link
Member

vanevery commented Mar 4, 2020 via email

@jywarren
Copy link
Author

jywarren commented Mar 5, 2020

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
Copy link
Author

jywarren commented Mar 5, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants