Perhaps someone can help me troubleshoot the following C# code? I am hearing some random clicks and cracks, not just at the beginning but usually also 1-3 times while the tone is playing. I guess .NET may be not be the best language for realtime processing, but I am actually experiencing similar problems with PureBasic (which is very low-level and C-like), and on other computers.
using System;
using System.Runtime.InteropServices;
class Program
{
[DllImport(@"csound64.dll")] private static extern IntPtr csoundCreate();
[DllImport(@"csound64.dll")] private static extern long csoundSetOption(IntPtr csound, string option);
[DllImport(@"csound64.dll")] private static extern long csoundCompileOrc(IntPtr csound, string option);
[DllImport(@"csound64.dll")] private static extern void csoundStart(IntPtr csound);
[DllImport(@"csound64.dll")] private static extern void csoundStop(IntPtr csound);
[DllImport(@"csound64.dll")] private static extern long csoundPerformKsmps(IntPtr csound);
[DllImport(@"csound64.dll")] private static extern long csoundReadScore(IntPtr csound, string option);
static void Main(string[] args)
{
IntPtr csound = csoundCreate();
csoundSetOption(csound, "-odac0");
csoundSetOption(csound, "-b2048");
csoundSetOption(csound, "-B2048");
csoundCompileOrc(csound, @"
sr=44100
ksmps=10
nchnls=2
0dbfs=1
ga init 1
instr 1
ga poscil 0.5, 400
outs ga, ga
endin
");
csoundReadScore(csound, "i 1 0 5");
csoundStart(csound);
while (csoundPerformKsmps(csound) == 0) ;
csoundStop(csound);
}
}
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here