Hi Matt, I'm thinking that it might be an issue with what you are using as the input to the sin() function. If I switch to using a phasor: sr = 44100 ; audio sampling rate is 44.1 kHz kr = 44100 ; control rate is 44.1 kHz ksmps = 1 ; number of samples in a control period=(sr/kr) nchnls = 1 ; number of channels of audio output instr 1; basic mono sine wave ; p3 is duration ; p4 is freq times 2 pi ; p5 is amplitude a1 line 0, p3, p3 a1 phasor p4 a2 = p5*sin(a1 * 2 * $M_PI) out a2 endin i1 0 200 440 10000 e Using p4 as freq, multiplying the 0-1 phasor output with 2 * PI, I got what sounds like a stable sine wave (I did not try listening for a long time). It's late here so I'm having a little difficulty thinking through the line signal in your example, but I'm not sure the code example you posted is doing exactly what you're describing. steven On Mon, Mar 31, 2008 at 10:35 PM, Matthew Conroy wrote: > > hello all, > > I've been wondering about the following curious behavior for years. > > When I try to use the sine opcode to create a basic waveform, I run > into two glitches. The csd below should (?) generate a nice, 200 > seconds long sinewave with a frequency of 4000/(2pi)=636.619... hz. > > This works for the first 4 seconds of the output file. Then the > frequency rises about 1% and remains there until 126 seconds in, at > which point the frequency drops drastically to about 430 hz ( two- > thirds?). > > An mp3 that illustrates the phenomenon is available here: > http://www.csounds.com/node/103 > Just jump to 2 minutes in, and you can hear the dropoff at about 2:06. > > I'm using Csound 5.08 on OS X, 10.4.10. I've seen this problem on a > number of versions of Csound, including at least one > version of MacCsound, going back at least five years. I've never > used Csound on any platform besides Macs. > > Different values of the frequency (p4) do not change the phenomenon. > > I know there are other ways to generate simple sinewaves in Csound, > but for various applications, I'd > really like to have a reliable sine opcode. Any suggestions? Anyone > have any idea what's happening? > > cheers, > > Matt > > p.s. the cosine opcode does the same thing... > > -------------------------------------------------------------------- > > > > > sr = 44100 ; audio sampling rate is 44.1 kHz > kr = 44100 ; control rate is 44.1 kHz > ksmps = 1 ; number of samples in a control period=(sr/kr) > nchnls = 1 ; number of channels of audio output > > instr 1; basic mono sine wave > ; p3 is duration > ; p4 is freq times 2 pi > ; p5 is amplitude > > a1 line 0, p3, p3 > a2 = p5*sin(p4*a1) > out a2 > endin > > > > > i1 0 200 4000 10000 > e > > > > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >