<commit_before>#include "aquila/global.h"
#include "aquila/source/generator/SquareGenerator.h"
#include "aquila/source/SignalSource.h"
#include "aquila/transform/FftFactory.h"
#include "aquila/tools/TextPlot.h"
#include "aquila/source/WaveFile.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <iostream>
#include <cstdlib>
using namespace std;

const std::size_t SIZE = 512;

void findMax(Aquila::SpectrumType spectrum, Aquila::FrequencyType sampleFreq)
    {
        std::size_t halfLength = spectrum.size() / 2;
        std::vector<double> absSpectrum(halfLength);
        double max = 0;
        int peak_freq  = 0;
        for (std::size_t i = 0; i < halfLength; ++i)
        {
            absSpectrum[i] = std::abs(spectrum[i]);
            //cout << i*(sampleFreq/halfLength)<< " amp " <<absSpectrum[i] << endl;
            if(absSpectrum[i] > max){ 
                max = absSpectrum[i];
                peak_freq = i*(sampleFreq/halfLength)/2;
            }
        }
        cout << "peak freq for input with sample size: "<< halfLength*2 << " which needs to be pow of 2" <<endl;
        cout <<peak_freq << " Hz max amp:" << max << endl;
        //plot(absSpectrum);
    }

void freqOfindex(std::size_t start, Aquila::WaveFile wav){
    Aquila::FrequencyType sampleFreq = wav.getSampleFrequency();
    vector<Aquila::SampleType> chunk;
    for (std::size_t i =start; i< start+SIZE; ++i)
    {   

        chunk.push_back(wav.sample(i));<commit_msg>only searh high freq<commit_after>#include "aquila/global.h"
#include "aquila/source/generator/SquareGenerator.h"
#include "aquila/source/SignalSource.h"
#include "aquila/transform/FftFactory.h"
#include "aquila/tools/TextPlot.h"
#include "aquila/source/WaveFile.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <iostream>
#include <cstdlib>
using namespace std;

const std::size_t SIZE = 512;

void findMax(Aquila::SpectrumType spectrum, Aquila::FrequencyType sampleFreq)
    {
        std::size_t halfLength = spectrum.size() / 2;
        std::vector<double> absSpectrum(halfLength);
        double max = 0;
        int peak_freq  = 0;
        int start = 15000/((sampleFreq/halfLength)/2);
        for (std::size_t i = start; i < halfLength; ++i)
        {
            absSpectrum[i] = std::abs(spectrum[i]);
            // cout << i*(sampleFreq/halfLength)<< " amp " <<absSpectrum[i] << endl;
            if(absSpectrum[i] > max){ 
                max = absSpectrum[i];
                peak_freq = i*(sampleFreq/halfLength)/2;
            }
        }
        cout << "peak freq for input with sample size: "<< halfLength*2 << " which needs to be pow of 2" <<endl;
        cout <<peak_freq << " Hz max amp:" << max << endl;
        //plot(absSpectrum);
    }

void freqOfindex(std::size_t start, Aquila::WaveFile wav){
    Aquila::FrequencyType sampleFreq = wav.getSampleFrequency();
    vector<Aquila::SampleType> chunk;
    for (std::size_t i =start; i< start+SIZE; ++i)
    {   

        chunk.push_back(wav.sample(i));
{'fraction_non_alphanumeric': 0.14615638403167272, 'fraction_numerical': 0.008248102936324645, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2413981', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1004, 'n_words': 223}