Using pisound input with P5.js audio input

I have developed a sketch using P5.js on my Mac which accepts external audio input. When you start it it asks for permission to connect to the default mic input.
Any ideas how I can configure audio routing so that this will workon a Raspberry Pi with the pisound audio input. The sketch loads fine when hosted there.
I’ve been playing with qjackctl but I’m not sure how I might patch a connection.

The library the sketch uses is here https://p5js.org/reference/#/libraries/p5.sound

Hey, I don’t know anything about P5.js or HTML5 JS scripting, but this API function seems to be related to getting available input devices:

https://p5js.org/reference/#/p5.AudioIn/getSources

Btw, the browsers on Raspberry seem to use ALSA directly or PulseAudio if it is running. In the former case, make sure that no other application is exclusively using Pisound input or output.

Thanks Giedrius

That routine was vey useful in helping me to make further progress. When I incorporated it in my p5 code I could see pi-sound inputs enumerated, and by selecting one of them I managed to get microphone input
controlling the graphics on the sketch.
I would like to do this using Sonic PI, but I think I will get problems two programs trying to connect to to jackd. I think I’ve seen stuff about this on the internet, so it may be possible, but further work to do.
Anyway thanks for the progress I have been able to make.

Robin

1 Like