[Csnd] Pitch troubles with grain opcode

Hi Everyone!

I ran into a little problem concerning the grain opcode in class today and I could not figure out what was going on,
maybe you can help:

Whenever the pitch in the example below is not exactly the base frequency as calculated via

sr / ftlen()

I’m getting aliases or similar artefacts.

I can’t seem to figure out what I’m doing wrong.
Any hint would be much appreciated!

Cheers

Max

sr = 44100
ksmps = 32
nchnls = 1
0dbfs = 1

instr 1

insnd = 1
ibasfreq = sr / ftlen(insnd)

kPitchoff = p4

kAmp = 0.5
kPitch = ibasfreq
kDens = 15
kAmpoff = 0.0
kGrainDur = 0.5
igfn = insnd
iwfn = 2
imgdur = 0.8

asig grain kAmp, kPitch, kDens, kAmpoff, kPitchoff, kGrainDur, igfn, iwfn, imgdur

out asig

endin

f1 0 524288 1 “instrument.aif” 0 0 0; read soundfile with Gen01 into f-table
f2 0 16384 20 6 1 ;Gaussian window

i1 0 5 0
i1 5 5 .01

I think without the source audio you’re using it’s hard to know what issue you may be having as grain settings don’t affect all audio similarly. The window and xdens values, for example, can have a large effect. And your expectations are unknown.

Perhaps you could also upload the instrument.aif file somewhere and a link to it.

hi!

Of Course, sorry!

The file is accessible here:

https://www.dropbox.com/s/tpb2ii7o5w3ricu/instrument.aif?dl=1

Cheers

M

hi max -

i only have my laptop speakers right now, but your example sounds correct to me. it adds some random pitch deviations (upwards).

did you expect a transposition? this would be the kpitch parameter.

cheers -
  joachim