.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Wav::Read 3pm" .TH Wav::Read 3pm "2021-01-04" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Audio::Wav::Read \- Module for reading Microsoft WAV files. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Audio::Wav; \& \& my $wav = new Audio::Wav; \& my $read = $wav \-> read( \*(Aqfilename.wav\*(Aq ); \&#OR \& my $read = Audio::Wav \-> read( \*(Aqfilename.wav\*(Aq ); \& \& my $details = $read \-> details(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Reads Microsoft Wav files. .SH "SEE ALSO" .IX Header "SEE ALSO" Audio::Wav .PP Audio::Wav::Write .SH "NOTES" .IX Header "NOTES" This module shouldn't be used directly, a blessed object can be returned from Audio::Wav. .SH "METHODS" .IX Header "METHODS" .SS "file_name" .IX Subsection "file_name" Returns the file name. .PP .Vb 1 \& my $file = $read \-> file_name(); .Ve .SS "get_info" .IX Subsection "get_info" Returns information contained within the wav file. .PP .Vb 1 \& my $info = $read \-> get_info(); .Ve .PP Returns a reference to a hash containing; (for example, a file marked up for use in Audio::Mix) .PP .Vb 5 \& { \& \*(Aqkeywords\*(Aq => \*(Aqbpm:126 key:a\*(Aq, \& \*(Aqname\*(Aq => \*(AqMission Venice\*(Aq, \& \*(Aqartist\*(Aq => \*(AqNightmares on Wax\*(Aq \& }; .Ve .SS "get_cues" .IX Subsection "get_cues" Returns the cuepoints marked within the wav file. .PP .Vb 1 \& my $cues = $read \-> get_cues(); .Ve .PP Returns a reference to a hash containing; (for example, a file marked up for use in Audio::Mix) (position is sample position) .PP .Vb 10 \& { \& 1 => { \& label => \*(Aqsig\*(Aq, \& position => 764343, \& note => \*(Aqfirst\*(Aq, \& }, \& 2 => { \& label => \*(Aqfade_in\*(Aq, \& position => 1661774, \& note => \*(Aqtrig\*(Aq, \& }, \& 3 => { \& label => \*(Aqsig\*(Aq, \& position => 18033735, \& note => \*(Aqlast\*(Aq, \& }, \& 4 => { \& label => \*(Aqfade_out\*(Aq, \& position => 17145150, \& note => \*(Aqtrig\*(Aq, \& }, \& 5 => { \& label => \*(Aqend\*(Aq, \& position => 18271676, \& } \& } .Ve .SS "read_raw" .IX Subsection "read_raw" Reads raw packed bytes from the current audio data position in the file. .PP .Vb 1 \& my $data = $self \-> read_raw( $byte_length ); .Ve .SS "read_raw_samples" .IX Subsection "read_raw_samples" Reads raw packed samples from the current audio data position in the file. .PP .Vb 1 \& my $data = $self \-> read_raw_samples( $samples ); .Ve .SS "read" .IX Subsection "read" Returns the current audio data position sample across all channels. .PP .Vb 1 \& my @channels = $self \-> read(); .Ve .PP Returns an array of unpacked samples. Each element is a channel i.e ( left, right ). The numbers will be in the range; .PP .Vb 2 \& where $samp_max = ( 2 ** bits_per_sample ) / 2 \& \-$samp_max to +$samp_max .Ve .SS "position" .IX Subsection "position" Returns the current audio data position (as byte offset). .PP .Vb 1 \& my $byte_offset = $read \-> position(); .Ve .SS "position_samples" .IX Subsection "position_samples" Returns the current audio data position (in samples). .PP .Vb 1 \& my $samples = $read \-> position_samples(); .Ve .SS "move_to" .IX Subsection "move_to" Moves the current audio data position to byte offset. .PP .Vb 1 \& $read \-> move_to( $byte_offset ); .Ve .SS "move_to_sample" .IX Subsection "move_to_sample" Moves the current audio data position to sample offset. .PP .Vb 1 \& $read \-> move_to_sample( $sample_offset ); .Ve .SS "length" .IX Subsection "length" Returns the number of bytes of audio data in the file. .PP .Vb 1 \& my $audio_bytes = $read \-> length(); .Ve .SS "length_samples" .IX Subsection "length_samples" Returns the number of samples of audio data in the file. .PP .Vb 1 \& my $audio_samples = $read \-> length_samples(); .Ve .SS "length_seconds" .IX Subsection "length_seconds" Returns the number of seconds of audio data in the file. .PP .Vb 1 \& my $audio_seconds = $read \-> length_seconds(); .Ve .SS "details" .IX Subsection "details" Returns a reference to a hash of lots of details about the file. Too many to list here, try it with Data::Dumper..... .PP .Vb 3 \& use Data::Dumper; \& my $details = $read \-> details(); \& print Data::Dumper\->Dump([ $details ]); .Ve .SS "reread_length" .IX Subsection "reread_length" Rereads the length of the file in case it is being written to as we are reading it. .PP .Vb 1 \& my $new_data_length = $read \-> reread_length(); .Ve .SH "AUTHORS" .IX Header "AUTHORS" .Vb 4 \& Nick Peskett (see http://www.peskett.co.uk/ for contact details). \& Brian Szymanski (0.07\-0.14) \& Wolfram humann (pureperl 24 and 32 bit read support in 0.09) \& Kurt George Gjerde . (0.02\-0.03) .Ve