First, take a look at these references:

www.libsdl.org
sdl.perl.org documentation

Second, here's a little bundle to make sure that you have all the requirements
#!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->force('install', "PadWalker", "Data::Dumper::Names", "Filter::Util::Call", "ExtUtils::MakeMaker", "ExtUtils::CBuilder", "File::Spec", "Scalar::Util", "Test::Harness", "Pod::Man", "Pod::Simple", "Pod::Escapes", "Pod::Usage", "HTML::Entities", "Net::SMTP", "Net::SMTP_auth", "Test::Pod", "Test::Pod::Coverage", "Text::Trac", "Getopt::Long", "Text::Wrap", "Test", "YAML", "ExtUtils::CBuilder", "Test::Simple", "IO::CaptureOutput", "Test::Most", "Pod::ToDemo", "File::Temp", "File::ShareDir", "File::Path", "File::Fetch", "Digest::SHA", "Archive::Extract", "Archive::Tar", "Archive::Zip", "Module::Build", "Alien::SDL");
Make sure you have the latest version, then try this script from sdl.perl:
#!/usr/bin/perl use strict; use warnings; use SDL; use SDL::Audio; use SDL::AudioSpec; SDL::init(SDL_INIT_AUDIO); # Converting some WAV data to hardware format my $desired = SDL::AudioSpec->new(); my $obtained = SDL::AudioSpec->new(); # Set desired format $desired->freq(22050); $desired->channels(1); $desired->format(AUDIO_S16); $desired->samples(8192); # Open the audio device if( SDL::Audio::open($desired, $obtained) < 0 ) { printf( STDERR "Couldn't open audio: %s\n", SDL::get_error() ); exit(-1); } # Load the test.wav my $wav_ref = SDL::Audio::load_wav('../../test/data/sample.wav', $obta +ined); unless( $wav_ref ) { warn( "Could not open sample.wav: %s\n", SDL::get_error() ); SDL::Audio::close_audio(); SDL::quit; exit(-1); } my ( $wav_spec, $wav_buf, $wav_len ) = @{$wav_ref};

In reply to Re: Script with audio files by Khen1950fx
in thread Script with audio files by victor_charlie

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.