I've got a rather large Perl/Tk script that I want to incorporate sound into. The Win32::Sound::WaveOut package does what I need and sounds great in short test programs, including those that use Tk. But when I incorporate it into the big script, the sound quality goes to hell. There seems to be some low-frequency modulation going on, resulting a buzz or warble, depending on the frequency I'm trying to produce. This happens even when the Tk event loop is blocked. I checked CPU usage with the Windows task manager, and in both cases (good and bad), the usage was 100% while sound was playing. Has anyone had a similar experience? Were you able to work around it?
BTW: Modules used by the big script and not by the test programs include Carp, POSIX, and Tie:IxHash.
Update: Solved it. I was also using
use encoding 'cp1252';
In my quest for brevity, I used
chr($value) to pack the sound bytes into the sound buffer instead of
pack("C", $value). 'Works fine with ASCII -- not so great with Unicode!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.