Exemple #1
0
    void Update()
    {
        // Real-time
        if (realTimeSamples)
        {
            audioSource.GetSpectrumData(realTimeSpectrum, 0, FFTWindow.BlackmanHarris);
            realTimeSpectralFluxAnalyzer.analyzeSpectrum(realTimeSpectrum, audioSource.time);
            realTimePlotController.updatePlot(realTimeSpectralFluxAnalyzer.spectralFluxSamples);
        }

        // Preprocessed
        if (preProcessSamples)
        {
            int indexToPlot = getIndexFromTime(audioSource.time) / 1024;
            preProcessedPlotController.updatePlot(preProcessedSpectralFluxAnalyzer.spectralFluxSamples, indexToPlot);
        }


        /* START MY SHITTY ADDON */

        if (backgroundThreadCompleted == true && threeDimensionalSpectrumBuild == false)
        {
            Debug.Log("calling spectrumBoy to build the thing!");
            threeDimensionalSpectrumBuild = true;
            Debug.Log(string.Format("threeDimensionalSpectrumBuild = ", threeDimensionalSpectrumBuild));
            spectrumBoy.buildSpectrumGraph();
        }
        if (backgroundThreadCompleted == true && threeDimensionalSpectrumBuild == true)
        {
            spectrumBoy.updateSpectrumGraph(audioSource.time);
            spectrumRealTime.updateRealTimeSpectrumGraph();
        }
        /* END MY SHITTY ADDON */
    }
    void Update()
    {
        // Real-time
        if (realTimeSamples)
        {
            audioSource.GetSpectrumData(realTimeSpectrum, 0, FFTWindow.BlackmanHarris);
            realTimeSpectralFluxAnalyzer.analyzeSpectrum(realTimeSpectrum, audioSource.time);
            realTimePlotController.updatePlot(realTimeSpectralFluxAnalyzer.spectralFluxSamples);
        }

        // Preprocessed
        if (preProcessSamples)
        {
            int indexToPlot = getIndexFromTime(audioSource.time) / 4096;
            preProcessedPlotController.updatePlot(preProcessedSpectralFluxAnalyzer.spectralFluxSamples, indexToPlot);
        }
    }
Exemple #3
0
    void Update()
    {
        // Real-time
        if (realTimeSamples && !GetComponent <AudioManipulation>().pausePressed)
        {
            audioSource.GetSpectrumData(realTimeSpectrum, 0, FFTWindow.BlackmanHarris);
            realTimeSpectralFluxAnalyzer.analyzeSpectrum(realTimeSpectrum, audioSource.time);
            realTimePlotController.updatePlot(realTimeSpectralFluxAnalyzer.spectralFluxSamples);
        }

        // Preprocessed
        if (preProcessSamples && !GetComponent <AudioManipulation>().pausePressed)
        {
            int indexToPlot = getIndexFromTime(audioSource.time) / 1024;
            preProcessedPlotController.updatePlot(preProcessedSpectralFluxAnalyzer.spectralFluxSamples, indexToPlot);
        }
    }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        int indexToPlot = getIndexFromTime(audioSource.time) / 1024;

        preProcessedPlotController.updatePlot(preProcessedSpectralFluxAnalyzer.spectralFluxSamples, indexToPlot);
    }
Exemple #5
0
    void Update()
    {
        // Real-time
        if (realTimeSamples)
        {
            audioSource.GetSpectrumData(realTimeSpectrum, 0, FFTWindow.BlackmanHarris);
            realTimeSpectralFluxAnalyzer.analyzeSpectrum(realTimeSpectrum, audioSource.time);
            realTimePlotController.updatePlot(realTimeSpectralFluxAnalyzer.spectralFluxSamples);
        }

        // Preprocessed
        if (preProcessSamples)
        {
            int indexToPlot = getIndexFromTime(audioSource.time) / 1024;
            // preProcessedPlotController.updatePlot (preProcessedSpectralFluxAnalyzer.spectralFluxSamples, indexToPlot);

            if (songProcessed)
            {
                if (preProcessedSpectralFluxAnalyzer.spectralFluxSamples[indexToPlot].isPeak)                // && audioSource.isPlaying)
                {
                    if (spawnRed)
                    {
                        float highOrLow = UnityEngine.Random.Range(0f, 1f);

                        if (highOrLow > 0.5f)
                        {
                            redSpawnEngineLow.GetComponent <SpawnEngine>().onBeat = true;
                            spawnRed = false;
                            //Debug.Log("RED cube spawned via beat");
                        }
                        else
                        {
                            redSpawnEngineHigh.GetComponent <SpawnEngine>().onBeat = true;
                            spawnRed = false;
                        }
                    }
                    else
                    {
                        float highOrLow = UnityEngine.Random.Range(0f, 1f);

                        if (highOrLow > 0.5f)
                        {
                            blueSpawnEngineLow.GetComponent <SpawnEngine>().onBeat = true;
                            spawnRed = true;
                            //Debug.Log("BLUE cube spawned via beat");
                        }
                        else
                        {
                            blueSpawnEngineHigh.GetComponent <SpawnEngine>().onBeat = true;
                            spawnRed = false;
                        }
                    }
                }
                else
                {
                    blueSpawnEngineLow.GetComponent <SpawnEngine>().onBeat  = false;
                    redSpawnEngineLow.GetComponent <SpawnEngine>().onBeat   = false;
                    blueSpawnEngineHigh.GetComponent <SpawnEngine>().onBeat = false;
                    redSpawnEngineHigh.GetComponent <SpawnEngine>().onBeat  = false;
                }
            }
        }
    }