[Csnd] -B and -b things
Date | 2008-12-16 03:03 |
From | Tobiah |
Subject | [Csnd] -B and -b things |
For a time, I could not figure out why I could not get decent low-latency real-time performance out of csound. I've experienced great performance before, on lesser machines. The current one is a ~2GHz Core 2 Duo running 32/64 bit Kubuntu (dual-boot). The real-time kernel did not help. I finally found out that it was due to my choice of values for the -B and -b flags. I'm not sure where I acquired the notion now, but I had it in my head that -b should be one half of -B. With this arrangement, I had to set -B up to something like 8192 (I also thought they should be a ^2), which was far larger than what would be acceptable for real-time performance. At one point, I omitted both flags, and I got very nice performance. The defaults for Linux are documented as -B1024 -b256. As it turns out, as long as I keep -b at 1/4 of -B, the real-time performance works quite well. I found that I could go as small as -B 128 -b 32, with no problems. With a simple instrument, I can easily play over 100 notes at once (think pedal down on the MIDI keyboard) with a calculated 3ms latency (isn't that right for a 44100 sr with a 128 sample buffer?). If I try say, -B1024 -b1024, I get bad 'underruns' before I even touch a key. It's hard to ask a specific question here. I would just like to hear a full explanation as to the meaning and differences between these flags, and as to any insight into what I might have been experiencing. I've read the manual entries for these flags, but I'm left wanting a better explanation. The soundcard is an Echo Mia Midi. It seems that there is always a dog barking annoyingly in my neighborhood within earshot. I'm in a tract up in the hills above the coast somewhere in Southern California. Thanks, Tobiah Command line: sudo csound\ -+rtaudio=alsa\ -+rtmidi=alsa\ -o dac\ -d\ --midi-device=hw:0,0\ -B 128 -b 32 --sched\ --midi-key-cps=5\ --midi-velocity-amp=4\ orc sco Orc: sr = 44100 ksmps = 1 nchnls = 2 instr 1 ifront init .01 iback init 4 aenv linsegr 0, ifront, p4, iback, 0, .3, 0 asigl oscil aenv, p5, 1 asigr oscil aenv, p5 + 1, 1 outs asigl, asigr endin |
Date | 2008-12-16 21:55 |
From | joachim |
Subject | [Csnd] Re: -B and -b things |
I found this manual page very useful: http://www.csounds.com/manual/html/UsingOptimizing.html joachim Am 16.12.2008 um 04:03 schrieb Tobiah: > For a time, I could not figure out why I could not get decent > low-latency real-time performance out of csound. I've experienced > great performance > before, on lesser machines. The current one is a ~2GHz Core 2 Duo > running 32/64 bit Kubuntu (dual-boot). > > The real-time kernel did not help. I finally found out that it was > due to my choice of values for the -B and -b flags. I'm not sure > where > I acquired the notion now, but I had it in my head that -b should be > one half of -B. With this arrangement, I had to set -B up to > something > like 8192 (I also thought they should be a ^2), which was far larger > than > what would be acceptable for real-time performance. > > At one point, I omitted both flags, and I got very nice performance. > The defaults for Linux are documented as -B1024 -b256. As it turns > out, > as long as I keep -b at 1/4 of -B, the real-time performance works > quite well. I found that I could go as small as -B 128 -b 32, with > no problems. > With a simple instrument, I can easily play over 100 notes at once > (think > pedal down on the MIDI keyboard) with a calculated 3ms latency > (isn't that > right for a 44100 sr with a 128 sample buffer?). > If I try say, -B1024 -b1024, I get bad 'underruns' before I even > touch a key. > It's hard to ask a specific question here. I would just like to > hear a full explanation as to the meaning and differences between > these flags, and as to any insight into what I might have been > experiencing. > I've read the manual entries for these flags, but I'm left wanting a > better > explanation. > > The soundcard is an Echo Mia Midi. > > It seems that there is always a dog barking annoyingly in my > neighborhood > within earshot. I'm in a tract up in the hills above the coast > somewhere > in Southern California. > > Thanks, > > Tobiah > > Command line: > > sudo csound\ > -+rtaudio=alsa\ > -+rtmidi=alsa\ > -o dac\ > -d\ > --midi-device=hw:0,0\ > -B 128 -b 32 --sched\ > --midi-key-cps=5\ > --midi-velocity-amp=4\ > orc sco > > > Orc: > > sr = 44100 > ksmps = 1 > nchnls = 2 > > instr 1 > > ifront init .01 > iback init 4 > > aenv linsegr 0, ifront, p4, iback, 0, .3, 0 > > asigl oscil aenv, p5, 1 > asigr oscil aenv, p5 + 1, 1 > outs asigl, asigr > endin > > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" |
Date | 2008-12-17 01:26 |
From | Tobiah |
Subject | [Csnd] Re: Re: -B and -b things |
joachim wrote: > I found this manual page very useful: > http://www.csounds.com/manual/html/UsingOptimizing.html > joachim Thanks. Now, my soundcard is capable of 24 bit. Does that mean that I should use the 3/2 -B/-b ratio, even when I'm calculating 16 integers? I tried -B48 -b32, and it ran beautifully using a two oscil stereo orchestra at 44100 with ksmps=1. If I calculate properly, thats about 1ms latency, which, again, if my math is right, is something like how long it takes for sound to travel a foot. So moving my speakers another foot away would cause as much latency as I'm getting through csound. I can get up to around 170 voices going this way with no glitch. This is the 32 bit kubuntu as well. I was seeing a 30% increase in speed with the 64 bit version at least with disk rendering, but the system would freeze periodically. So moving my speakers another foot away would cause as much latency as I'm getting through csound. I'll have to try it with a complex orchestra. |