Question unsure to ask where
Mmalherbe opened this issue · 8 comments
Hey!
Im currently working on an art project where id love to use node speaker.
Its a raspberry pi with an usb soundcard Gigaport hd+ with 6 channels.
Is it possible to use speaker to simultaniously play seperate wav or mp3 files on seperate channels?
Thanks and sorry if i asked it in the wrong place
Hmm, I would recommend asking on StackOverflow. I'm not sure if this library can currently do it 🤔
Thanks for the advice, my question is also postedon StackOverflow. But I guess an answer from someone of the library would help :)
Hmm, actually, you probably should be able to use some other Node.js package to mix the channels, and then specify channels: 6
in this lib. Should be quite doable!
Would you mind linking the StackOverflow post?
Ofcourse! here : https://stackoverflow.com/questions/49842361/nodejs-on-a-raspberry-pi-with-a-soundcard
any idea of which package to use to mix the channels?
https://www.npmjs.com/package/pcm-utils
Something like:
const pcmUtils = require('pcm-utils')
const Speaker = require('speaker')
const speaker = new Speaker()
const zipper = new pcmUtils.Zipper(6, pcmUtils.FMT_U16LE)
zipper.pipe(speaker)
yourStuff0.pipe(zipper.inputs[0])
yourStuff1.pipe(zipper.inputs[1])
yourStuff2.pipe(zipper.inputs[2])
yourStuff3.pipe(zipper.inputs[3])
yourStuff4.pipe(zipper.inputs[4])
yourStuff5.pipe(zipper.inputs[5])
Thank you very much! Ill try it in a little bit, any idea if its possible to edit the pipe? So lets say only on input 1 IS playing a file, and i can just add a file to 3 and play it simultanious?
I think you would need to pipe in silence to the other zipper inputs in that case