Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created May 19, 2013 19:38
Show Gist options
  • Select an option

  • Save Sciss/5608715 to your computer and use it in GitHub Desktop.

Select an option

Save Sciss/5608715 to your computer and use it in GitHub Desktop.
// Note this is still cubic interpolation, unfortunately VDiskIn doesn't have an interp argument.
// So you don't get as cripsy sound as with linear interp (would need BufRd and annoying buffer management).
val p = "/Volumes/data/hhrutz/Mnemo/Misc130428_3/superjam/rec/|fsc9.aif"
val spec = io.AudioFile.readSpec(p)
val b = Buffer.cue(path = p, numChannels = spec.numChannels)
val r = Buffer.alloc(numFrames = 32768, numChannels = spec.numChannels)
val rate = 0.5
val dur = spec.numFrames / (rate * spec.sampleRate)
val q = "/Users/hhrutz/Desktop/test.aif"
r.write(path = q, numFrames = 0, leaveOpen = true)
val x = play {
val in = VDiskIn.ar(spec.numChannels, b.id, speed = rate)
DiskOut.ar(r.id, in)
Line.kr(dur = dur, doneAction = freeSelf)
DC.ar(0)
}
x.onEnd {
r.close(); r.free(); b.close(); b.free()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment