s <- Sine(440,3,rate=44100,bits=16,channels=2)
sampleLength(s) # 132300 samples ( = 3 sec * 44100 samples/sec )
sampleLength(s) <- 22050 # sample is now .5 sec long
play(setSampleLength(s,44100)) # plays a .5 sec sine wave and then .5 sec silence
Run the code above in your browser using DataLab