// // Created by david on 04.03.2026. // #ifndef PASADASUPERPROJECT_SIGNAL_H #define PASADASUPERPROJECT_SIGNAL_H #include namespace pd_signal { /** `num` evenly spaced numbers over interval [start,stop] */ void linspace(std::vector& data, double start, double stop, int num); /** `num` evenly spaced numbers over interval [start,stop] with endpoint=true or [start,stop) with endpoint=false */ void linspace(std::vector& data, double start, double stop, int num, bool endpoint); /** * Evaluate at points x the function given by the samples fp[xp[n]]. * Returned in y. */ void interp(std::vector& y, std::vector& x, std::vector& xp, std::vector& fp); /** resample to BEAT_LEN */ void resample(std::vector &out, std::vector &x, int beat_len); /** * normalized cross-correlation of the two signals of same length. * normalization factor is 1 / sqrt(\sum_i x_i^2 * \sum_i y_i^2) */ double crossCorr(std::vector &x, std::vector &y); /** clip 'val' to between 'a_min' and 'a_max'. */ double clip(double val, double a_min, double a_max); /** two-dimensional mean of a collection of signals */ void mean(std::vector &out, std::vector >& m); } #endif //PASADASUPERPROJECT_SIGNAL_H