def ReadNFrames(self, N, Interleaved=True): # frames = self.convertInt32(self.waveIn.readframes(N), self.reader_sampwidth) raw_samples = self.convertInt32(self.waveIn.readframes(N), self.reader_sampwidth) frames = AudioData.convertSamples(raw_samples, 32, self.data_width, False, self.out_float) self.reader_samplesRemaining -= N if Interleaved: return frames else: return AudioData.deInterleaveSamples(frames, self.reader_nChannels)
def WriteOutSamplesNonInterleaved(self, nonInterleavedSamples): """Take data in [[l,l,l,l,...][r,r,r,r...][c,c,c,c...]...] format and create an array [l,r,l,r,l,r,l,r,l,r,l....] """ return self.WriteOutSamplesInterleaved(AudioData.interleaveSamples(nonInterleavedSamples))