| 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
|