Csound Csound-dev Csound-tekno Search About

simple problem

Date1997-08-12 20:34
Fromdoug cross
Subjectsimple problem
Hello all:

i have been playing around with this orc and sco to produce some sound
examples  and i've found something curious. when i ask for a sweep
between 800hz and 150000hz there is a strange folding over of the
sound.(starts to play backwards). I've found a number below 10000hz
avoids this problem but I'm just a bit confused. 

;sweep.orc
;-------------------------------
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

instr 1

           iattack              =       .01
           irelease     =       .10
           idur                 =       p3
           iamp                 =       p4
           isweepstart  =       p5
           isweepend    =       p6
           ibandwidth   =       p7
           ibalance     =       p8 
      
           kamp         linen   iamp, iattack, idur, irelease
           ksweep       line    isweepstart, idur, isweepend
           
           asig         oscil   iamp,   ksweep, 3                       
           afilt        reson   asig, ksweep, ibandwidth
           arampsig     =       kamp * afilt                  
           
out     arampsig * ibalance

;, arampsig * (1 - ibalance);disabled for mono file
        endin

;sweep.sco
;-------------------------------
f3 0 8192 7 -1 4096 1 4096 -1 ; -- triangle

i1              0          5          2.2      800        15000   
10          .5;c
e

Date1997-08-12 21:41
FromDan Higdon
SubjectRe: simple problem
At 12:34 PM 8/12/97 -0700, Doug wrote:
>i have been playing around with this orc and sco to produce some sound
>examples  and i've found something curious. when i ask for a sweep
>between 800hz and 150000hz there is a strange folding over of the
>sound.(starts to play backwards). I've found a number below 10000hz
>avoids this problem but I'm just a bit confused. 

I think the effect you're hearing is called "aliasing".  Due to a
limitation in digital signal processing, any frequency above 1/2 the 
sample rate will not be represented properly.  In this case, anything
above about 22kz will flake out.  Since you're using a non-sinewave
input, any overtones in the signal can't be above 22khz either, or 
they will alias as well.  Aliasing can cause unusual artifacts -
that "folding over" you describe is typical.

So - stick with sounds in the human hearing range! :-)

-------------------------------
Dan Higdon (hdan@charybdis.com)
http://www.charybdis.com/~hdan