I've been tinkering with sndwarpst. I'm finding that with the resample value set at 1 it's not playing samples at the original pitch as one would assume (given the manual suggests 2 would raise the pitch one octave).
I've tried numerous long, pitched samples with the same result. In all cases the pitch appears to be approx. 1 tone higher than the original.
I'm using Csound for Android which uses Csound 6.16.
Here's an example code. I've also posted the csd and example wave file (see links below). Any help or suggestions, or perhaps if anyone has time to confirm the issue by testing this regardless of OS or version, would be appreciated. It may be required to restart the file if the initial sound isn't a solid tone but more of a filtered noise like timbre.
<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 48000
ksmps = 32
nchnls = 2
0dbfs = 1
gSfile = "HarpC1shrt.wav"
; waveform used for granulation
giSound ftgen 1,0,0,1,gSfile,0,0,0
; window function - used as an amplitude envelope for each grain
giWFn ftgen 2,0,16384,9,0.5,1,0
seed 0
gaSendL init 0 ; initialize global audio variables
gaSendR init 0
instr Trigger ; triggers instrument 2
ktrigger metro 1/8.5
kRand = trandom(ktrigger,10,16)
schedkwhen ktrigger,0,0,"Granular",0,kRand ;trigger instr. 2
endin
instr Granular ; generates granular synthesis textures
ifn1 = giSound
ilen = nsamp(ifn1)/sr
iPtrStart = random(1,ilen-1)
iPtrTrav = random(-1,1)
ktimewarp = line(iPtrStart,p3,iPtrStart+iPtrTrav)
kamp = linsegr(0,2,0.1,p3-4,0.1, 4, 0)
iresample = 1
ifn2 = giWFn
ibeg = 0
iwsize = random(400,10000)
irandw = iwsize/3
ioverlap = 14
itimemode = .2 ; default 1
; create a stereo granular synthesis texture using sndwarp
aSigL,aSigR sndwarpst kamp*.6,ktimewarp,iresample,ifn1,ibeg,\
iwsize,irandw,ioverlap,ifn2,itimemode
gaSendL += aSigL*0.48
gaSendR += aSigR*0.6
outs aSigL*.8,aSigR
endin
instr Reverb
aRvbL,aRvbR reverbsc gaSendL,gaSendR,0.92,12000
outs aRvbL,aRvbR
clear gaSendL,gaSendR
endin
instr Record ;read the stereo csound output buffer
allL, allR monitor
; write the output of csound to an audio file
; wav file: 16 bits with header
fout "/sdcard/sndwarpst18.wav", 16, allL, allR
endin
</CsInstruments>
<CsScore>
; p1 p2 p3
i"Trigger" 0 30 ; triggers instr 2
i"Reverb" 0 50 ; reverb instrument
; i Record 0 51 ; record instrument
</CsScore>
</CsoundSynthesizer>
; original example written by Iain McCurdy
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here