ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/PDL-Audio/audio.pd
(Generate patch)

Comparing PDL-Audio/audio.pd (file contents):
Revision 1.9 by root, Tue Nov 8 18:56:06 2005 UTC vs.
Revision 1.10 by root, Wed Apr 18 08:28:18 2012 UTC

1$VERSION = '1.1'; 1$VERSION = '1.2';
2 2
3pp_setversion $VERSION; 3pp_setversion $VERSION;
4pp_beginwrap (); # force error with older PPs 4pp_beginwrap (); # force error with older PPs
5 5
6pp_addpm {At => Top}, <<'EOD'; 6pp_addpm {At => Top}, <<'EOD';
14 use PDL::Audio; 14 use PDL::Audio;
15 15
16=head1 DESCRIPTION 16=head1 DESCRIPTION
17 17
18Oh well ;) Not much "introductory documentation" has been written yet :( 18Oh well ;) Not much "introductory documentation" has been written yet :(
19
20Installing this distribution also installs F<pdlaudio-demo>, which
21showcases some of the oeprators, and C<pdlaudio-birds>, which imites some
22bird calls with PDL::Audio. You should study them to get the hang of it.
19 23
20=head2 NOTATION 24=head2 NOTATION
21 25
22Brackets around parameters indicate that the respective parameter is 26Brackets around parameters indicate that the respective parameter is
23optional and will be replaced with some default value when absent (or 27optional and will be replaced with some default value when absent (or
32 36
33 # Syntax: gen_oscil duration*, frequency/ 37 # Syntax: gen_oscil duration*, frequency/
34 $signal = gen_oscil 2*HZ, 440/HZ; 38 $signal = gen_oscil 2*HZ, 440/HZ;
35 # with a sampling frequency of 44100 Hertz: 39 # with a sampling frequency of 44100 Hertz:
36 $signal = gen_oscil 2*44100, 440/44100; 40 $signal = gen_oscil 2*44100, 440/44100;
41
42 print describe_audio $signal, "\n";
43 playaudio $signal->scale2short;
37 44
38To help you, the required unit is given as a type suffix in the parameter 45To help you, the required unit is given as a type suffix in the parameter
39name. A "/" means that you have to divide by the sampling frequency (to 46name. A "/" means that you have to divide by the sampling frequency (to
40convert from Hertz) and a suffix of "*" indicates that a multiplication is 47convert from Hertz) and a suffix of "*" indicates that a multiplication is
41required. 48required.
276=cut 283=cut
277 284
278sub describe_audio($) { 285sub describe_audio($) {
279 my $pdl = shift; 286 my $pdl = shift;
280 my ($channels, $samples) = $pdl->dims; 287 my ($channels, $samples) = $pdl->dims;
288 ($channels, $samples) = (1, $channels) unless defined $samples;
281 my $chan = $channels < 2 ? "mono" : 289 my $chan = $channels < 2 ? "mono" :
282 $channels == 2 ? "stereo" : 290 $channels == 2 ? "stereo" :
283 $channels == 4 ? "quad channel" : 291 $channels == 4 ? "quad channel" :
284 "$channels channel"; 292 "$channels channel";
285 my $desc = "$chan sound with $samples samples"; 293 my $desc = "$chan sound with $samples samples";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines