… | |
… | |
120 | stereo sound with 27411 samples, original name "kongas.wav", type 2 (RIFF), |
120 | stereo sound with 27411 samples, original name "kongas.wav", type 2 (RIFF), |
121 | rate 11025/s (duration 2.49s), format 7 (8-bit unsigned) |
121 | rate 11025/s (duration 2.49s), format 7 (8-bit unsigned) |
122 | |
122 | |
123 | raudio path, [option-hash], option => value, ... |
123 | raudio path, [option-hash], option => value, ... |
124 | Reads audio data into the piddle. Options can be anything, most useful |
124 | Reads audio data into the piddle. Options can be anything, most useful |
125 | values are "filetype", "rate", "channels" and "format". |
125 | values are "filetype", "rate", "channels" and "format". The returned |
|
|
126 | piddle is represents "time" in the outer dimension, and samples in the |
|
|
127 | inner (i.e. scalars for mono files, 2-vectors for stereo files): |
|
|
128 | |
|
|
129 | [ [left0, right0], [left1, right1], ... |
126 | |
130 | |
127 | # read any file |
131 | # read any file |
128 | $pdl = raudio "file.wav"; |
132 | $pdl = raudio "file.wav"; |
129 | # read a file. if it is a raw file preset values |
133 | # read a file. if it is a raw file preset values |
130 | $pdl = raudio "file.raw", filetype => FILE_RAW, rate => 44100, channels => 2; |
134 | $pdl = raudio "file.raw", filetype => FILE_RAW, rate => 44100, channels => 2; |
… | |
… | |
132 | waudio pdl, [option-hash], option => value, ... |
136 | waudio pdl, [option-hash], option => value, ... |
133 | Writes a pdl as a file. The path is taken from the header (or the |
137 | Writes a pdl as a file. The path is taken from the header (or the |
134 | options), e.g.: |
138 | options), e.g.: |
135 | |
139 | |
136 | # write a file, using the header of another piddle |
140 | # write a file, using the header of another piddle |
137 | $pdl->waudio($orig_file->gethdr); |
141 | $pdl->waudio ($orig_file->gethdr); |
138 | # write pdl as au file, take rate from the header |
142 | # write pdl as au file, take rate from the header |
139 | $pdl->waudio(path => "piddle.au", filetype => FILE_AU, format => FORMAT_16_LINEAR; |
143 | $pdl->waudio (path => "piddle.au", filetype => FILE_AU, format => FORMAT_16_LINEAR; |
140 | |
144 | |
141 | cut_leading_silence pdl, level |
145 | cut_leading_silence pdl, level |
142 | Cuts the leading silence (i.e. all samples with absolute value < level) |
146 | Cuts the leading silence (i.e. all samples with absolute value < level) |
143 | and returns the resulting part. |
147 | and returns the resulting part. |
144 | |
148 | |