I am writing a script that plays announcement using sox in linux. I use the following syntax to specify the file and the speaker to play to:
sox -v 1.5 file.mp3 -t pulseaudio [speaker_name]
Is there a way to play the same file into two different speakers at the same time? I am actually using passing the system commands using python script and was able to "somehow" achieve this task using this script. However this appears to complicate things and I was hoping there is a different approach.
import os
from multiprocessing import Pool
def run_process(process):
os.system(format(process))
processes = ('sox -v 1.5 file.mp3 -t pulseaudio [speaker_name]', 'sox -v 1.5 file.mp3 -t pulseaudio [speaker_name2]')
pool = Pool(processes=2)
pool.map(run_process, processes)
I also tried separating the commands in linux terminal using & or && but it still plays one file at a time.
Any guidance on how to play both files at the same time either using sox syntax or some other linux method?
thank you