All pastes #175716 Raw Edit

Unnamed

public python v1 · immutable
·published 2006-09-19 02:09 UTC
rendered paste body
def playSection(sound, start, end):    sound_length = sound.getLength()        sample_rate = getSamplingRate(sound)        start_sample = int(start * sample_rate)        section_seconds = int(end - start) + 1    section_samples = int((end - start) * sample_rate)        print "section starts at %s" % start_sample    print "sample length in samples is %s" % section_samples    print "sample length in seconds is %s" % section_seconds        section = makeEmptySound(section_seconds)        for sample_i in range(section_samples):        source_frame = sample_i + start_sample + 1        sample = getSampleValueAt(sound, source_frame)        setSampleValueAt(section, sample_i + 1, sample)        play(section)    return section