| When testing these opcodes a while ago I noted one problem in each.
Before I get to the problems and the fixes, I think having both
these opcodes is a waste, and one should be ki...er, phased out.
For instance, fof2. The changes which have to be made introduce
extra operations in the innermost loop of fof, which are not needed,
and so slows down this opcode a little. On the other hand fof2
adds grain glissando, so if anyone is in love with that there would
be an argument against fog. Point is they are almost identical,
and they both change the order and names of arguments as against
fof, and so make the documentation very confusing here.
(NB: For readability I will call ugensA.c/h "the FOG header/file"
and ugens7.h/c "the fof2 header/file")
fof2:
This opcode is noisy when you're changing the soundfile pitch.
Proof orc/sco follows at end of post.
It can be fixed by using the PFRAC1 mechanism from FOG.
((Incidentally, this fix will in theory make the output sound from fof
cleaner. Only in theory, because with fof, each grain uses the entire
soundfile many times over - that's ftable two, argument ifn2 - so the
division error is never a problem. But fof2 grains use only a small part
of the input sound.))
What to do:
* Copy PFRAC definition from line 3 in FOG header to fof2 header.
* Copy lines 86-90 from FOG file to line 98 in fof2 file
Here is line 98 in fof2 file:
result = *(ftp1->ftable + (ovp->formphs >> ftp1->lobits) );
* Comment out line 103 (the old line 98) in fof2 file.
* Insert definition:
float v1, fract ,*ftab;
in the beginning of fof() function in fof2 file (eg at line 67)
That's it. The line numbers refer to source distribution 3.476,
but you'll probably find your way. Else mail me for details.
FOG:
The rise phase does not work now. New grains with xspd > 0 are clipped
at the beginning. Same proof orc, below.
This is because the soundfile phase is added to the ftable index
before krise is calculated, so ovp->risphs will index far into the
ifn1 rise function table.
What to do:
* Comment out line 147 in FOG file, and remove the comments on
line 148 - ie, restore the original. Here they are in their present state:
147: else ovp->formphs = (long)((p->fundphs * form / *fund) + p->spdphs) & PMASK;
148: /*else ovp->formphs = (long)(p->fundphs * *form / *fund) & PMASK;*/
That's it. ovp->formphs is calculated *again* later in newgrain(),
on lines 166-171, so nothing needs be done here with p->spdphs.
Something is surely up here, since these files have been changed in
February?
Regards,
re
*********** foxtest.orc *************
instr 1 ; test fof2
insnd = 10 ; ifna, input sound file through gen 01
ibas = sr / ftlen(insnd) ; 1:1 playback rate
kfund = 5
kform linseg ibas, p3/4, ibas, p3/4, ibas*.8, p3/4, ibas*1.2
kdur = .19
kphs line 0, p3, 1
a1 fof2 20000, kfund, kform, 0, 0, kdur/10, kdur, kdur/10, 10, insnd, 2, p3, kphs, 0
out a1
endin
instr 2 ; test FOG
insnd = 10 ; ifna, input sound file through gen 01
ibas = sr / ftlen(insnd) ; 1:1 playback rate
kfund = 5
kform linseg 1, p3/4, 1, p3/4, .8, p3/4, 1.2
kdur = .19
aspd line 0, p3, 1 ; Must be a-rate, error in documentation (or code)
a1 fog 20000, kfund, kform, aspd, 0, 0, kdur/10, kdur, kdur/10, 10, insnd, 2, p3, 0, 1
out a1
endin
************ foxtest.sco *************
f2 0 1024 7 0 1024 1 ; Straight line rise
f10 0 131072 1 "Voices.wav" 0 0 0 ; Some sound file, use continuous sound
i1 0 6 ; Play fof2 with some time-stretch & pitch change |