stream_index = []
for sample_num in range(lcm):
    stream_index += [i for i, ch in enumerate(all_channels) if ch.
        samples_for(sample_num)]
repeat_count = [b[i] for i in stream_index]
stream_index = numpy.array(stream_index).repeat(repeat_count)
Fast way to read interleaved data?