Re: oscil3 glitch problem (ampdb)
Date | 1999-05-10 21:17 |
From | Steven Cook |
Subject | Re: oscil3 glitch problem (ampdb) |
Hi All, luis jure wrote: > >The output from this contains a single sample -32768 spike about a third of > >the way in for no apparent reason. > > steve, your orchestra produces a perfectly clean sine sweep for me too > (winsound 3.53; gabriel maldonado's directcsound 2.70, based on csound 3.52 > i think). so check your version of csound. > > anyway, i don't think it's the best to put: > > ilevl = ampdb(96 + p4) > > according to the manual, ampdb returns a raw value of 32000 for 90dB, thus > if you take 0dB as your maximum output, a value of 90 would give almost 0dB > for 16 bits (-0.3 in fact) and not -6 dB as you seem to want. > > by the way, looking at the output, ampdb doesn't seem to be extremely > precise. or is it? Hmm! I was under the impression that (perfect) 16 bit audio had a 96 dB dynamic range, hence the above. Perhaps ampdb is calibrated wrong, or am I missing something? Anyway, my glitching problem remains, so here is a simplified version of my orc and sco which shows the problem more clearly. When I run this I get a half wave rectified sine, i.e. no negative output at all. Halving the table size produces a sine sweep with a 1 sample wide -32768 spike on a zero crossing point about one quarter of the way in, reducing the table size more cures the problem. Replacing oscil3 with oscili also cures the problem. ;Orc sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 instr 1 ; Sine sweep ilevl = p4*32768 ; Level ifreq1 = p5 ; Sweep start ifreq2 = p6 ; Sweep end asweep expseg ifreq1, p3, ifreq2 aosc oscil3 ilevl, asweep, 1 out aosc endin ;Sco f1 0 65536 10 1 ; Sine ; Strt Leng Levl Freq1 Freq2 i1 0.00 1.00 1.00 20 20000 e Thanks, Steve Cook. |
Date | 1999-05-11 19:19 |
From | Anders Andersson |
Subject | oscil3 |
>> > The output from this contains a single sample -32768 spike about a >> > third of the way in for no apparent reason. >> >> steve, your orchestra produces a perfectly clean sine sweep for me too >> (winsound 3.53; gabriel maldonado's directcsound 2.70, based on csound >> 3.52 i think). so check your version of csound. > Anyway, my glitching problem remains, so here is a simplified version of > my orc and sco which shows the problem more clearly. When I run this I get > a half wave rectified sine, i.e. no negative output at all. Halving the > table size produces a sine sweep with a 1 sample wide -32768 spike on a > zero crossing point about one quarter of the way in, reducing the table > size more cures the problem. Replacing oscil3 with oscili also cures the > problem. Well, 1st: You have an amplitude of 32768, and sin(90)*32768 = 32768, ie one sample to high for a 16-bit output. Thats why you get a spike, because 32768 = -32768 when using signed values (as in a sample). Aparently, CSound will clip the value to 32767 when using word-sized output (16bit) but not for 8-bit output, this might be why some people get spikes, and some are not. Instead of setting /ilevl/ to /p4*32768/, try with /p4*32767/. It might (should) help. 2nd: Oscili uses *linear* interpolation, in wich a sample will not be louder than one of the points used when interpolating. Oscil3 uses some other kind of interpolation, where *(i guess)* if you have a specific sequence of input values, the output *CAN* be higher than the inputs. (im not shure about this though). This should *NOT* be the reason in this case though, as you have a very large sine as input, and it's the best signal an interpolator could think of.. // Anders ps. I used my own GCC-compiled 3.52 Amiga-version |