### 11 unstable releases (4 breaking)

✓ Uses Rust 2018 edition

0.8.0 | Mar 16, 2019 |
---|---|

0.7.0 | Jan 12, 2019 |

0.6.0 | Dec 2, 2018 |

0.5.2 | Sep 8, 2017 |

0.4.1 | Nov 20, 2016 |

#**5** in #dsp

**79** downloads per month

Used in **1** crate

**MIT/Apache**

765KB

18K
SLoC

`basic_dsp`

`basic_dsp`

Digital signal processing based on real or complex vectors in time or frequency domain. Vectors come with basic arithmetic, convolution, Fourier transformation and interpolation operations.

## Usage

Add this to your

:`Cargo .toml`

`[``dependencies``]`
`basic_dsp ``=` `"`*`"`

and this to your crate root:

`extern` `crate` basic_dsp`;`

See also advanced building options.

## Vector flavors

This crate brings vectors in different flavors.

- Single precision (

) or double precision (`f32`

) floating point numbers. This can be used to trade precision against performance. If in doubt then it's likely better to start with double precision floating numbers.`f64` - Vectors track the meta data about the domain (Time/Frequency) and number space (real/complex) inside the vector in Rust's type system and therefore prevent certain errors. There is also vector type available which tracks meta data at runtime but if it's used then

needs to be checked for error handling too and therefore the advice to not use this type unless absolutely required.`self``.``len``(``)`

## Long term goal

The long term vision for this lib is to allow GNU Octave/MATLAB scripts for DSP operations on large arrays/vectors to be relatively easily be rewritten in Rust. The Rust code should then perform much faster than the original code. At the same time a C interface should be available so that other programming languages can make use of this lib too. "Relatively easily be rewritten" implies that the API will not look like GNU Octave/MATLAB and that there is a learning curve involved from changing to this lib, however all necessary vector operations should be provided in some form and definitions should be close to GNU Octave/MATLAB. GNU Octave/MATLAB toolboxes are excluded from this goal since they are rather application specific and therefore should get an own Rust lib. There are already libs available for matrix operations so the aim for this lib will likely be to support matrix operations for matrices of large vectors and to integrated well this those and not to implement its own matrix calculations.

This is a very ambitious goal and it's likely that this lib will not make it there. Contributions are therefore highly appreciated.

## Design principals

The main design goals are:

- Prevent some typical errors by making use of the Rust type system, e.g. by preventing that an operation is called which isn't defined for a vector in real number space.
- Provide an interface to other programming languages which might be not as performant as Rust.
- Optimize for performance in terms of execution speed.
- Avoid memory allocations. This means that memory used in order to optimize the performance of certain operations will not be freed until the vector will be dropped/destroyed. It's therefore recommended to reuse vectors once created, but to drop/destroy them as soon as the input data into the DSP processing chain changes in size.

## Contributions

Welcome!

## Stability

This project started as small pet project to learn more about DSP, CPU architecture and Rust. Since learning involves making mistakes, don't expect things to be flawless or even close to flawless. In fact issues are expected in all areas (including correctness, stability, performance) and while the crate should be useful already all results should be treated with caution at the same time.

#### Dependencies

~0.4–2.1MB

~27K SLoC