Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Play 2 files stimulatingly #4

Open
quangbuule opened this issue Apr 4, 2017 · 6 comments
Open

Play 2 files stimulatingly #4

quangbuule opened this issue Apr 4, 2017 · 6 comments

Comments

@quangbuule
Copy link

Hi,
I tried played the second file while the first file was playing but failed, the second file can only be play when being triggered after the first file finished playing. Is there any solution for this?

Thanks so much!

@krig
Copy link
Owner

krig commented Apr 4, 2017

I think this is simply how sox works: if you want to play two files at once, you need a software mixer. To do that with sox, you need to chain two streams together with a mixer, like the remix effect.

@quangbuule
Copy link
Author

I can't imaging how I could do that, since the second file is playing in the middle of first file (trigger from keyboard event). I would really appreciate if you could hint more by a tiny example.

@krig
Copy link
Owner

krig commented Apr 4, 2017

Unfortunately as far as I understand how sox works, this is not possible :( The effect chain has to be pre-built, it isn't possible to change it later. But maybe I am wrong. I have not looked too deeply into that use case myself.

@quangbuule
Copy link
Author

Yeah, from what I see in the sox manual (http://sox.sourceforge.net/sox.html):

"Note that applying multiple effects in real-time (i.e. when playing audio) is likely to require a high performance computer"

But I don't know how they would do the real-time.

@jonpastore
Copy link

@krig Is it possible to get the same functionality as this command with libsox?
/usr/bin/sox -m file1.wav file2.wav NewFile.wav
I'm trying to overlay 2 files together that I'm reading into a byte[].
Is there an example of recommendation on how I can set file1 and file2 as 2 separate channels and then output as 1 channel?

@krig
Copy link
Owner

krig commented Mar 5, 2021

Hi @jonpastore , most likely this would need a new API, but at least in theory anything that is possible using the sox command line should be possible to do with the library as well.

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

No branches or pull requests

3 participants