Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Time.time - timeLastUpdated >= timeBetweenUpdates)
        {
            float alphaThetaRatio = Mathf.Pow(10f, EEGData.GetAverage(EEGData.EEG_BANDS.ALPHA)) / Mathf.Pow(10f, EEGData.GetAverage(EEGData.EEG_BANDS.THETA));
            if (alphaThetaRatio > 1)
            {
                audio.pitch += stepSize;
            }
            else
            {
                audio.pitch -= stepSize;
            }

            timeLastUpdated = Time.time;
        }
    }
Exemplo n.º 2
0
    public static float GetRelativeFrequency(EEG_BANDS freqBand, int samplesBefore = 0)
    {
        float sumBands = 0f;

        foreach (EEG_BANDS eegBand in Enum.GetValues(typeof(EEG_BANDS)))
        {
            sumBands += Mathf.Abs(EEGData.GetAverage(eegBand, samplesBefore));
        }

        float relFreq = 0f;

        if (sumBands > 0)
        {
            relFreq = Mathf.Abs(EEGData.GetAverage(freqBand, samplesBefore) / sumBands);
        }

        return(relFreq);
    }