hey.
i'm currently trying to program a virtual synth using perl.
the program should be able to perform realtime manipulations like 'filter cutoff' etc.
i'm fairly ok with the mathematical aspect but can't find a way to implement it in perl.
i had a look at the cpan audio modules, but they either didn't work (like pdl::audio) or didn't help.
at the moment i'm using Win32::Sound to load the data into the soundcard buffer and then play it.
basically like this :
sub sound { my $WAV = new Win32::Sound::WaveOut(10000, 8, 1); my $length = $input2->get(); $length = $length*2; my $data2 = ""; my $counter = 0; for my $i (1..$length) #foreach my $loop (1..$length) { my $v2 = sin($counter/2*3.14) * 128 + 128; $data2 .= pack("c", $v2); $counter += ($add * 10)/10000; $WAV->Load($data2); # get it $WAV->Write(); # hear it $WAV->Unload(); # drop it &new_add; #get new $add value from a scale } }
however, this does NOT work...
is there any other way of sending data to the soundcard or maybe a totally different approach to this in perl ?
thanks, b.

In reply to building a "realtime" software synth by b4e

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.