in reply to Re: Tk Morse Code Ear tutor (updated) -- oneliner
in thread Tk Morse Code Ear tutor
I preferred to avoid any use of /dev/dsp, since PulseAudio dosn't really like it. /dev/dsp usage is going obsolete. Also here is an excerpt from the Audio::Beep pod. Requires either the beep program by Johnathan Nightingale (you should find sources in this tarball) SUID root or you to be root (that's because we need writing access to the /dev/console device). If you don't have the beep program this library will also assume some kernel constants which may vary from kernel to kernel (or not, i'm no kernel expert). So..... you need the beep program installed, you need the /dev/dsp and padsp cludges, and it's an obsolete module.padsp ./my_audio_app
END Update.
I thought about using SDL but I could only find modules to play audio files, not raw PCM data. If I used premade dits and dahs audio files say in mp3 or ogg format, I would have been forced to use a Time::HiRes hack to get the audio files to play for the correct durations. A dit is one time unit, and a dah is 3 times the length of a dit. There is also the space required between the dits and dahs, programmed silence. That seemed like alot of computer overhead, since it is at millisecond accuracy. I stuck with the simpler method of directly generating the raw PCM. There may be a clever way in SDL but I couldn't find a way to avoid external sound files.
I'm beginning to think that I may make an improvement by using syswrite, instead of print, to the pipe's $ah filehandle. This may help the buffer latency problem.
|
|---|