|
1 | 1 | /*! @page qtdl_desc Tapped Delay Line in O(1) |
2 | | -* The class \ref qtdl is an implementation of the Tapped Delay Line (TDL) structure. |
3 | | -* A TDL is a discrete element in digital filter theory, that allows a signal to |
4 | | -* be delayed by a number of samples and provides an output signal for each delay. |
5 | | -* Here, a TDL is implemented as a circular buffer. This means |
6 | | -* that the complexity of the enqueue and dequeue operations is constant @c O(1), so |
7 | | -* integer delays can be computed very efficiently. |
8 | | -* |
9 | | -* The delay by one sample is notated \f$z^{-1}\f$ and delays of \f$N\f$ samples |
10 | | -* is notated as \f$z^{-N}\f$ motivated by the role the z-transform plays in |
11 | | -* describing digital filter structures. |
12 | | -* |
13 | | -* To create a TDL, you just need to define an instance of type \ref qlibs::tdl and |
14 | | -* then, configure it by using the constructor or \ref qlibs::tdl::setup(), |
15 | | -* where you can define the number of lines to be delayed and the initial values |
16 | | -* for all of them. Then, you can start operating over this structure by inserting |
17 | | -* samples of the input signal by using \ref qlibs::tdl::insertSample(). |
18 | | -* You can also get any specific delay from it by using: |
19 | | -* |
20 | | -* - \ref qlibs::tdl::getOldest(), to get the oldest delay at tap \f$z^{-N}\f$ |
21 | | -* - \ref qlibs::tdl::getAtIndex(), to get the delay at tap \f$z^{-i}\f$. |
22 | | -* You can also use the index using an unsigned value as follows: @c "delay[ i ]" |
23 | | -* - Index operator |
24 | | -* |
25 | | -* Given the applications of this structure, the \ref qlibs::tdl class is used as the |
26 | | -* base component of some aspects of \ref qlibs::smoother and \ref qlibs::ltisys. |
27 | | -* |
28 | | -* @section qtdl_ex1 Example : Code snippet to instantiate a TDL to hold up to 256 delays. |
| 2 | +* The class \ref qtdl implements a Tapped Delay Line (TDL), a fundamental structure |
| 3 | +* in digital filter theory. A TDL delays an input signal by a number of samples and |
| 4 | +* exposes each delayed version as an output |
| 5 | +* |
| 6 | +* In this implementation, the TDL is backed by a circular buffer. As a result, |
| 7 | +* both enqueue and dequeue operations run in constant time @c O(1), making integer |
| 8 | +* delays highly efficient. |
| 9 | +* |
| 10 | +* A delay of one sample is denoted \f$z^{-1}\f$ , while a delay of \f$N\f$ samples |
| 11 | +* is denoted \f$z^{-N}\f$ consistent with z-transform notation in digital signal |
| 12 | +* processing. |
| 13 | +* |
| 14 | +* To use a TDL, create an instance of \ref qlibs::tdl and configure it using either |
| 15 | +* the constructor or \ref qlibs::tdl::setup(). During setup you specify both the |
| 16 | +* number of delay taps and their initial values. Once configured, samples of the |
| 17 | +* input signal can be inserted using \ref qlibs::tdl::insertSample() (or the |
| 18 | +* function-call operator). |
| 19 | +* |
| 20 | +* You can access specific delayed samples via: |
| 21 | +* - \ref qlibs::tdl::getOldest() - retrieves the oldest sample (tap \f$z^{-N}\f$) |
| 22 | +* - \ref qlibs::tdl::getAtIndex() — retrieves the sample at tap \f$z^{-i}\f$ |
| 23 | +* - The index operator @c delay[i] — equivalent to @c getAtIndex(i) |
| 24 | +* |
| 25 | +* Because of its versatility, the \ref qlibs::tdl class is a core component in |
| 26 | +* higher-level modules such as \ref qlibs::smoother and \ref qlibs::ltisys. |
| 27 | +* |
| 28 | +* @section qtdl_ex1 Example : Instantiating a TDL with 256 delay taps |
29 | 29 | * |
30 | 30 | * @code{.c} |
31 | 31 | * real_t storage[ 256 ] = { 0.0f }; |
32 | 32 | * tdl delay( storage ); |
33 | 33 | * @endcode |
34 | 34 | * |
| 35 | +* Insert new samples: |
35 | 36 | * @code{.c} |
36 | 37 | * delay.insertSample( 2.5 ); |
37 | 38 | * delay.insertSample( -2.3 ); |
38 | 39 | * delay( 4.8 ); // same as delay.insertSample( 4.8 ) |
39 | 40 | * @endcode |
40 | 41 | * |
| 42 | +* Retrieve delayed samples: |
41 | 43 | * @code{.c} |
42 | 44 | * auto d3 = delay[ 3 ]; // get delay at t-3, same as delay.getAtIndex( 3 ) |
43 | 45 | * auto dOldest = delay.getOldest(); // get the oldest sample at t-N |
|
0 commit comments