sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ;======================================================================; ;Simple pvoc playback instrument for time scaling with pitch shift. ;Uses oscil1i to read the control function for the time pointer. ;Specify amount of pitch shift in p7 as a value in semitones. ;RP ;======================================================================; instr 1 idur = p3 ipvfn = p4 ;the pvanal output file pvoc.nnn ilength = p5 ;length of original sound file itpfn = p6 ;time pointer control function ipshft = p7 ;n semitones of pitch shift ispcwrp = p8 ifmod = exp(ipshft/12*log(2)) ;convert to a freq multiplier ktimpnt oscil1i 0,ilength,idur,itpfn aout pvoc ktimpnt, ifmod, ipvfn, ispcwrp out aout endin
;======================================================================; ; Example score for pvoc1.orc. Demonstrates differences in quality ; between various analysis frame sizes, forward and reverse playback, ; time stretching and compression, pitch shifting by semitones, and ; the use of a hand drawn control function for the timeptr control. ; RP ;======================================================================; f01 0 513 7 0 513 1 f02 0 513 7 1 513 0 f03 0 513 1 "pvoctest.fun" 0 4 0 ;Use pvoc.901 (thewind.wav, dur=1.67) ;Analysis frame size = 256, overlap = 4 ;nn st dur .nnn length tpfn ipshift ispecwarp i1 0 1.67 901 1.67 1 0 0 i1 2 1.67 . . 2 i1 4 3.33 . . 1 i1 7.5 .8 f0 9.0 s ;Use pvoc.902 (thewind.wav, dur=1.67) ;Analysis frame size = 32, overlap = 4 ;Note poor quality with this frame size ;nn st dur .nnn length tpfn ipshift ispecwarp i1 0 1.67 902 1.67 1 0 0 i1 2 1.67 . . 2 i1 4 3.33 . . 1 i1 7.5 .8 f0 9.0 s ;Use pvoc.903 (thewind.wav, dur=1.67) ;Analysis frame size = 1024, overlap = 4 ;Much better quality here. ;Also demonstrate pitch shifting. ;nn st dur .nnn length tpfn ipshift ispecwarp i1 0 1.67 903 1.67 1 3 1 i1 2 1.67 . . 2 -3 i1 4 3.33 . . 1 0 0 i1 7.5 .8 i1 9 10 . . 3 f0 20.0 s ;Use pvoc.904 (thewind.wav, dur=1.67) ;Analysis frame size = 1024, overlap = 8 ;nn st dur .nnn length tpfn ipshift ispecwarp i1 0 1.67 904 1.67 1 3 1 i1 2 1.67 . . 2 -3 i1 4 3.33 . . 1 0 i1 7.5 .8 i1 9 10 . . 3 f0 20.0 s ;Use pvoc.907 (fire1M44.wav) ;Analysis frame size = 1024, overlap = 4 ;nn st dur .nnn length tpfn ipshift ispecwarp i1 0 60 907 12.585 3 0 0 e