From cc3a6d8e34ae40db3ea4df12bdffbc4bf041cf57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Zbyszy=C5=84ski?= <m.zbyszynski@gold.ac.uk> Date: Tue, 23 May 2017 12:19:44 +0100 Subject: [PATCH] moving rapidStream, documenting --- docs/rapidmix.doxyfile | 2 +- src/signalProcessing/rapidStream.h | 51 --------- .../{ => rapidStream}/rapidStream.cpp | 6 ++ .../rapidStream/rapidStream.h | 100 ++++++++++++++++++ src/signalProcessing/signalProcessing.h | 25 +++++ 5 files changed, 132 insertions(+), 52 deletions(-) delete mode 100644 src/signalProcessing/rapidStream.h rename src/signalProcessing/{ => rapidStream}/rapidStream.cpp (96%) create mode 100644 src/signalProcessing/rapidStream/rapidStream.h create mode 100644 src/signalProcessing/signalProcessing.h diff --git a/docs/rapidmix.doxyfile b/docs/rapidmix.doxyfile index 5368831..9e073fc 100644 --- a/docs/rapidmix.doxyfile +++ b/docs/rapidmix.doxyfile @@ -866,7 +866,7 @@ FILE_PATTERNS = *.c \ # be searched for input files as well. # The default value is: NO. -RECURSIVE = NO +RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a diff --git a/src/signalProcessing/rapidStream.h b/src/signalProcessing/rapidStream.h deleted file mode 100644 index 1ac99a6..0000000 --- a/src/signalProcessing/rapidStream.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef rapidStream_h -#define rapidStream_h - -#include <stdint.h> - -//Buffer of past values - - -//Standard Deviation over Window - -//Min accel over window -//Max accel over window - -//Buffer of past satisfying condition -//expression - -class rapidStream { -public: - rapidStream(); - rapidStream(int windowSize); - ~rapidStream(); - - void clear(); - void pushToWindow(double input); - - double velocity(); - double acceleration(); - - double minimum(); - double maximum(); - - double sum(); - double mean(); - double standardDeviation(); - - double minVelocity(); - double maxVelocity(); - - double minAcceleration(); - double maxAcceleration(); - -private: - uint32_t windowSize; - uint32_t windowIndex; - double *circularWindow; - - double calcCurrentVel(int i); -}; - - -#endif \ No newline at end of file diff --git a/src/signalProcessing/rapidStream.cpp b/src/signalProcessing/rapidStream/rapidStream.cpp similarity index 96% rename from src/signalProcessing/rapidStream.cpp rename to src/signalProcessing/rapidStream/rapidStream.cpp index 1d39aea..42c1315 100644 --- a/src/signalProcessing/rapidStream.cpp +++ b/src/signalProcessing/rapidStream/rapidStream.cpp @@ -1,3 +1,9 @@ +/* + * rapidStream.cpp + * Created by Michael Zbyszynski on 6 Feb 2017 + * Copyright © 2017 Goldsmiths. All rights reserved. + */ + #include "rapidStream.h" #include <iostream> #include <cmath> diff --git a/src/signalProcessing/rapidStream/rapidStream.h b/src/signalProcessing/rapidStream/rapidStream.h new file mode 100644 index 0000000..30731ea --- /dev/null +++ b/src/signalProcessing/rapidStream/rapidStream.h @@ -0,0 +1,100 @@ +/* + * rapidStream.h + * Created by Michael Zbyszynski on 6 Feb 2017 + * Copyright © 2017 Goldsmiths. All rights reserved. + */ + +#ifndef rapidStream_h +#define rapidStream_h + +#include <stdint.h> +class rapidStream { +public: + + /** + * Create a circular buffer with 3 elements. + */ + rapidStream(); + /** + * Create a circular buffer with an arbitrary number of elements. + * @param int: number of elements to hold in the buffer + */ + rapidStream(int windowSize); + + ~rapidStream(); + + /** + * Resets all the values in the buffer to zero. + */ + void clear(); + + /** Add a value to a circular buffer whose size is defined at creation. + * @param double: value to be pushed into circular buffer. + */ + void pushToWindow(double input); + + /** Calculate the first-order difference (aka velocity) between the last two inputs. + * @return double: difference between last two inputs. + */ + double velocity(); + + /** Calculate the second-order difference (aka acceleration) over the last three inputs. + * @return double: acceleration over the last three inputs. + */ + double acceleration(); + + /** Find the minimum value in the buffer. + * @return double: minimum. + */ + double minimum(); + + /** Find the maximum value in the buffer. + * @return double: maximum. + */ + double maximum(); + + /** Calculate the sum of all values in the buffer. + * @return double: sum. + */ + double sum(); + + /** Calculate the mean of all values in the buffer. + * @return double: mean. + */ + double mean(); + + /** Calculate the standard deviation of all values in the buffer. + * @return double: standard deviation. + */ + double standardDeviation(); + + /** Calculate the minimum first-order difference over consecutive inputs in the buffer. + * @return double: minimum velocity. + */ + double minVelocity(); + + /** Calculate the maximum first-order difference over consecutive inputs in the buffer. + * @return double: maximum velocity. + */ + double maxVelocity(); + + /** Calculate the minimum second-order difference over consecutive inputs in the buffer. + * @return double: minimum acceleration. + */ + double minAcceleration(); + + /** Calculate the maximum second-order difference over consecutive inputs in the buffer. + * @return double: maximum acceleration. + */ + double maxAcceleration(); + +private: + uint32_t windowSize; + uint32_t windowIndex; + double *circularWindow; + + double calcCurrentVel(int i); +}; + + +#endif \ No newline at end of file diff --git a/src/signalProcessing/signalProcessing.h b/src/signalProcessing/signalProcessing.h new file mode 100644 index 0000000..087b638 --- /dev/null +++ b/src/signalProcessing/signalProcessing.h @@ -0,0 +1,25 @@ +/* + * signalProcessing.h + * Created by Michael Zbyszynski on 6 Feb 2017 + * Copyright © 2017 Goldsmiths. All rights reserved. + */ + +#ifndef signalProcessing_h +#define signalProcessing_h + +#include "rapidMix.h" +#include "maximilian.h" +#include "maxim.h" +#include "rapidStream.h" +#include "rapidPiPoTools.h" + +RAPIDMIX_BEGIN_NAMESPACE + +typedef maxiFFT FFT; +typedef maxiMFCC MFCC; +typedef rapidStream rapidStream; //MZ: Best... typedef... EVER! + + +RAPIDMIX_END_NAMESPACE + +#endif -- GitLab