I need to play 2 sounds simultaneously, with multiprocessing rather than threads, to see if it solves a problem where threads play the audio in sequence rather than in parallel. I am guessing it's due to the Global Interpreter Lock (GIL) in python.
I added a question 2 days ago, but my description is overcomplicated. This is the simple version:
The audio gets imported as numpy array. I take this array and play it using the scikits.audiolab module:
import scikits.audiolab as audiolab
# This is how I import my wav file. "frames" is the numpy array, "fs" = sampling
# frequency, "encoder" = quantizing at 16 bits
frames, fs, encoder = audiolab.wavread('audio.wav')
# This is how I play my wav file. audiolab plays the frames array at a frequency of
# 44100 Hz
audiolab.play(frames, fs=44100)
That's fine, but this is what I need help on: playing 2 files at the same time using multiprocessing.
frames1, fs1, encoder1 = audiolab.wavread('audio1.wav')
frames2, fs2, encoder2 = audiolab.wavread('audio2.wav')
audiolab.play(frames1, fs=44100)
audiolab.play(frames2, fs=44100)