src/math.c
double stdDev_(const s16 *data, unsigned int num_samples) {
    double sum = 0.0f;
    double std_dev = 0.0f;
    double mean;
    unsigned int i;

    for (i = 0; i < num_samples; i++) {
        sum += data[i];
    }

    mean = sum / (double)num_samples;

    for (i = 0; i < num_samples; i++) {
        std_dev += (data[i] - mean) * (data[i] - mean);
    }

    return sqrt_(std_dev / (double)num_samples);
}
/**
 * Calculates the standard deviation of a set of numbers. Typed for use with kwz_audio.c functions.
 *
 * Parameters:
 * - data: The data to calculate the standard deviation of.
 * - length: The number of elements in `data`.
 *
 * Returns:
 * - The standard deviation of the data.
 */
Calculates the standard deviation of a set of numbers. Typed for use with kwz_audio.c functions.
Parameters:
- data: The data to calculate the standard deviation of.
- length: The number of elements in `data`.

- The standard deviation of the data.
Calculates the standard deviation of a set of numbers . Typed for use with kwz_audio . c functions . Parameters : - data : The data to calculate the standard deviation of . - length : The number of elements in ` data ` . - The standard deviation of the data .
double stdDev_(const s16 *data, unsigned int num_samples) {
    double sum = 0.0f;
    double std_dev = 0.0f;
    double mean;
    unsigned int i;
    for (i = 0; i < num_samples; i++) {
        sum += data[i];
    }
    mean = sum / (double)num_samples;
    for (i = 0; i < num_samples; i++) {
        std_dev += (data[i] - mean) * (data[i] - mean);
    }
    return sqrt_(std_dev / (double)num_samples);
}
double stdDev_ ( const s16 * data , unsigned int num_samples ) { double sum = 0.0f ; double std_dev = 0.0f ; double mean ; unsigned int i ; for ( i = 0 ; i < num_samples ; i ++ ) { sum += data [ i ] ; } mean = sum / ( double ) num_samples ; for ( i = 0 ; i < num_samples ; i ++ ) { std_dev += ( data [ i ] - mean ) * ( data [ i ] - mean ) ; } return sqrt_ ( std_dev / ( double ) num_samples ) ; }
Calculates the standard deviation of a set of numbers.
Calculates the standard deviation of a set of numbers .