[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: clicking in cw program



Eric Krohn wrote:
The click you refer to is caused by something which is called, IIRC,
the Gibbs effect.  For speed and accuracy, Unixcw is actually gener-
ating tone data all the time, and to get its keying effect, relies
instead on gating the tone data through the soundcard by setting the
PCM sound volume to either zero (silence) or to the set volume level.

Fading the sound in and out should be doable with the mixer device. I'm not sure if it is fast enough for this however. The way I implemented this was to leave the mixer alone and simply control the amplitude of the sine wave in the generation routine. It's trivial, and it only relies on /dev/dsp to be present.

--8<--8<--
current demands of the program verge on timings that the Linux kernel
may not be able to deliver, at least, not without resorting to device
driver code and tweaks.  If I do happen to come up with some clever
way around this, I'll drop you a line.

With audio programs, you can rely on the soundcard's own clock for near real-time sound generation. CWirc works like this : it calculates the amount of time a sample takes to be played by the sound device, and simply feeds sound as fast as it can, incrementing the time counter as it goes. The sound writes are simply blocked transparently, without the routine knowning about it, when the sound buffer is full. It's an old trick, it takes very little cpu and it works very well. When the sound card isn't to be used, CWirc relies on the /dev/rtc device instead, but that's available under Linux only. Both methods provide rock-solid timing (between 1ms and 2ms with the sound card, under 1ms with /dev/rtc) and the latency is about 30ms using the soundcard.

If you look in the CWirc tarball, you'll find the sound sample generator in a small function in cwsound.c, and the real-time, sound device and /dev/rtc routines in io.c.

--
Pierre-Philippe Coupard <pcoupard@easyconnect.fr>
Software Engineer
--
The difference between dogs and cats is that dogs come when they're
called.  Cats take a message and get back to you.



Reply to: