node-aplay icon indicating copy to clipboard operation
node-aplay copied to clipboard

Can i play a second audio in a different channel?

Open danilosantosdev opened this issue 8 years ago • 13 comments

Hi guys,

I have the necessity to play a second or third audio. Can i do that in different channels?

Thanks!

danilosantosdev avatar Oct 23 '17 13:10 danilosantosdev

Ok, this means being able to pass a -c param to aplay. Can you confirm?

I think we can easily implement this and being able to pass the channel as a config param to the constructor.

I don't have a mac, does also afplay support the -c cli param?

roccomuso avatar Oct 23 '17 13:10 roccomuso

I'm thinking something about this:

var music = new Sound();
music.channel(1);
music.play('/path/to/the/file/filename.wav');

var music2 = new Sound();
music2.channel(2);
music2.play('/path/to/the/file/filename2.wav');

Is it possible?

Thanks for the feedback.

danilosantosdev avatar Oct 24 '17 13:10 danilosantosdev

Yeah totally possible. Also we can think of this:

var music = new Sound({channel: 1})
music.play('/path/filename.wav')
...

The only issue is that we should support it also on Mac. And I'm not sure if afplay support channel as cli param.

roccomuso avatar Oct 24 '17 13:10 roccomuso

Pretty good!

I don't have a mac, i don't know if support channel as cli param.

danilosantosdev avatar Oct 24 '17 13:10 danilosantosdev

That's a nice idea, I would love to be able to do that too.

jpataide avatar Oct 24 '17 14:10 jpataide

I'm also having this problem. Can you guys implement this or recommend another package?

abhnerAraujo avatar Oct 24 '17 14:10 abhnerAraujo

I'm gonna implement this in a bit. Stay tuned.

roccomuso avatar Oct 24 '17 14:10 roccomuso

@roccomuso thank you so much for your support.

We're anxious to see this implementation.

danilosantosdev avatar Oct 24 '17 14:10 danilosantosdev

@roccomuso you are the real MVP. I can't wait for this haha

abhnerAraujo avatar Oct 24 '17 14:10 abhnerAraujo

channel support, shipped with v1.2.0. It should work. Let me know

roccomuso avatar Oct 24 '17 15:10 roccomuso

@roccomuso Can you explain what was changed?

abhnerAraujo avatar Oct 24 '17 17:10 abhnerAraujo

Now passing the channel param to aplay.

Guys, does even the bare aplay cmd works for you? aplay -c 1 myfile.wav

roccomuso avatar Oct 24 '17 17:10 roccomuso

@roccomuso I ran your command, but i'm not sure what to expect. I'm testing in my headphones, should it play in only one ear or in both?

abhnerAraujo avatar Oct 24 '17 17:10 abhnerAraujo