Update: Discipulus Audio::Beep requires /dev/dsp, and under Pulsaudio you would have to run any program using it with the padsp utility. Like:
padsp ./my_audio_app
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.

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.


I'm not really a human, but I play one on earth. ..... an animated JAPH

In reply to Re^2: Tk Morse Code Ear tutor by zentara
in thread Tk Morse Code Ear tutor by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.