@@ -72,8 +72,10 @@ assert_eq!(added, vec![[0.4], [-0.5], [-0.3]]);
72
72
73
73
// Scale the playback rate by `0.5`.
74
74
let foo = [[0.0 ], [1.0 ], [0.0 ], [- 1.0 ]];
75
- let frames : Vec <_ > = foo . iter (). cloned (). scale_hz (0.5 ). collect ();
76
- assert_eq! (& frames [.. ], & [[0.0 ], [0.5 ], [1.0 ], [0.5 ], [0.0 ], [- 0.5 ], [- 1.0 ]][.. ]);
75
+ let mut source = foo . iter (). cloned ();
76
+ let interp = Linear :: from_source (& mut source ). unwrap ();
77
+ let frames : Vec <_ > = source . scale_hz (interp , 0.5 ). collect ();
78
+ assert_eq! (& frames [.. ], & [[0.0 ], [0.5 ], [1.0 ], [0.5 ], [0.0 ], [- 0.5 ], [- 1.0 ], [- 0.5 ]][.. ]);
77
79
```
78
80
79
81
The ** signal** module also provides a series of ** Signal** source types,
@@ -120,9 +122,12 @@ of sample types. Traits include:
120
122
- ` FromFrameSliceMut ` , ` ToFrameSliceMut ` , ` DuplexFrameSliceMut ` ,
121
123
- ` DuplexSlice ` , ` DuplexSliceMut ` ,
122
124
123
- The ** rate ** module provides a ** Converter** type, for converting and
125
+ The ** interpolate ** module provides a ** Converter** type, for converting and
124
126
interpolating the rate of ** Signal** s. This can be useful for both sample rate
125
- conversion and playback rate multiplication.
127
+ conversion and playback rate multiplication. ** Converter** s can use a range of
128
+ interpolation methods, with Floor, Linear, and Sinc interpolation provided in
129
+ the library. (NB: Sinc interpolation currently requires heap allocation, as it
130
+ uses VecDeque.)
126
131
127
132
Using in a ` no_std ` environment
128
133
-------------------------------
0 commit comments