… | |
… | |
13 | use PDL; |
13 | use PDL; |
14 | use PDL::Audio; |
14 | use PDL::Audio; |
15 | |
15 | |
16 | =head1 DESCRIPTION |
16 | =head1 DESCRIPTION |
17 | |
17 | |
18 | Oh well ;) Not much "introductury documentation" has been written yet! See |
18 | Oh well ;) Not much "introductory documentation" has been written yet :( |
19 | my other modules for even worse documentation ;) |
|
|
20 | |
19 | |
21 | =head2 NOTATION |
20 | =head2 NOTATION |
22 | |
21 | |
23 | Brackets around parameters indicate that the respective parameter is |
22 | Brackets around parameters indicate that the respective parameter is |
24 | optional and will be replaced with some default value when absent (or |
23 | optional and will be replaced with some default value when absent (or |
… | |
… | |
753 | in C<table>, linearly interpolating between successive points of the |
752 | in C<table>, linearly interpolating between successive points of the |
754 | C<waveform>. |
753 | C<waveform>. |
755 | |
754 | |
756 | =head2 partials2waveshape size*, partials, amplitudes, [phase], [fm_mod/] |
755 | =head2 partials2waveshape size*, partials, amplitudes, [phase], [fm_mod/] |
757 | |
756 | |
758 | Take a list (perl list or pdl) of (integer) C<partials> and a list of |
757 | Take a (perl or pdl) list of (integer) C<partials> and a list of |
759 | C<amplitudes> and generate a single wave shape that results by adding |
758 | C<amplitudes> and generate a single wave shape that results by adding |
760 | these partial sines. |
759 | these partial sines. |
761 | |
760 | |
762 | This could (and should) be used by the C<gen_from_table> generator. |
761 | This could (and should) be used by the C<gen_from_table> generator. |
763 | |
762 | |
764 | =head2 gen_from_partials duration*, frequency/, partials, amplitudes, [phase], [fm_mod/] |
763 | =head2 gen_from_partials duration*, frequency/, partials, amplitudes, [phase], [fm_mod/] |
765 | |
764 | |
766 | Take a list (perl list or pdl) of (possibly noninteger) C<partials> and a |
765 | Take a (perl list or pdl) list of (possibly noninteger) C<partials> and a |
767 | list of C<amplitudes> and generate the waveform resulting by summing up |
766 | list of C<amplitudes> and generate the waveform resulting by summing up |
768 | all these partial sines. |
767 | all these partial sines. |
769 | |
768 | |
770 | =cut |
769 | =cut |
771 | |
770 | |
… | |
… | |
1209 | Calculates the optimal (in the Chebyshev/minimax sense) FIR filter |
1208 | Calculates the optimal (in the Chebyshev/minimax sense) FIR filter |
1210 | impulse response given a set of band edges, the desired reponse on those |
1209 | impulse response given a set of band edges, the desired reponse on those |
1211 | bands, and the weight given to the error in those bands, using the |
1210 | bands, and the weight given to the error in those bands, using the |
1212 | Parks-McClellan exchange algorithm. |
1211 | Parks-McClellan exchange algorithm. |
1213 | |
1212 | |
1214 | The first argument (the one with the funny name) sets the filter |
1213 | The first argument sets the filter size: C<design_remez_fir> returns as |
1215 | size: C<design_remez_fir> returns as many coefficients as specified via |
1214 | many coefficients as specified by this parameter. |
1216 | this parameter. |
|
|
1217 | |
1215 | |
1218 | C<bands> is a vector of band edge pairs (start - end), who specify the |
1216 | C<bands> is a vector of band edge pairs (start - end), which specify the |
1219 | start and end of the bands in the filter specification. These must be |
1217 | start and end of the bands in the filter specification. These must be |
1220 | non-overlapping and sorted in increasing order. Only values between C<0> |
1218 | non-overlapping and sorted in increasing order. Only values between C<0> |
1221 | (0 Hz) and C<0.5> (the Nyquist frequency) are allowed. |
1219 | (0 Hz) and C<0.5> (the Nyquist frequency) are allowed. |
1222 | |
1220 | |
1223 | C<des> specifies the desired gain in these bands. |
1221 | C<des> specifies the desired gain in these bands. |
… | |
… | |
1653 | |
1651 | |
1654 | =head2 spectrum data, [norm], [window], [beta] |
1652 | =head2 spectrum data, [norm], [window], [beta] |
1655 | |
1653 | |
1656 | Returns the spectrum of a given pdl. If C<norm> is absent (or C<undef>), |
1654 | Returns the spectrum of a given pdl. If C<norm> is absent (or C<undef>), |
1657 | it returns the magnitude of the fft of C<data>. When C<norm> == 1 (or |
1655 | it returns the magnitude of the fft of C<data>. When C<norm> == 1 (or |
1658 | C<eq 'NORM'>, in any case), it returns the magnitude, normalized to be |
1656 | C<eq 'NORM'>, case-insensitive), it returns the magnitude, normalized to be |
1659 | between zero and one. If C<norm> == 0 (or C<eq 'dB'>, in any case), then |
1657 | between zero and one. If C<norm> == 0 (or C<eq 'dB'>, case-insensitive), then |
1660 | it returns the magnitude in dB. |
1658 | it returns the magnitude in dB. |
1661 | |
1659 | |
1662 | C<data> is multiplied with C<window> (if not C<undef>) before calculating |
1660 | C<data> is multiplied with C<window> (if not C<undef>) before calculating |
1663 | the fft, and usually contains a window created with C<gen_fft_window> |
1661 | the fft, and usually contains a window created with C<gen_fft_window> |
1664 | (using C<beta>). If C<window> is a string, it is handed over to |
1662 | (using C<beta>). If C<window> is a string, it is handed over to |