Esempio n. 1
0
//--------------------------------------------------------------
void soundizeMeApp::update(){
    
    
    // grab the fft, and put in into a "smoothed" array,
    // by taking maximums, as peaks and then smoothing downward
    float * val = ofSoundGetSpectrum(m_nBandsToGet * 2);        // request 1024 values for fft
    for (int i = 0;i < m_nBandsToGet; i++){
        
        // let the smoothed calue sink to zero:
        m_fftSmoothed[i] *= (m_isPlaying) ? 0.96f : 0.5f;
        
        // take the max, either the smoothed or the incoming:
        if (m_fftSmoothed[i] < val[i]) m_fftSmoothed[i] = val[i];
        
    }
    
    // float * paramns = new float[4];
    // paramns[0] = slider1.getValue();
    // paramns[1] = slider2.getValue();
    // paramns[2] = slider3.getValue();
    // paramns[3] = slider4.getValue();
    //
    if (ofGetWidth() ==0 && ofGetHeight() == 0)
        return;
    for (int i = 0; i < m_balls.size(); i++){
        Ball *ball = & m_balls.at(i);
        // ball->separate(m_balls);
        ball->FFTupdate(m_fftSmoothed);
        ball->update();
        ball->checkEdges();
    }
    // delete[] paramns;
}
Esempio n. 2
0
//--------------------------------------------------------------
void santiSoundize::update(float receivedFft[] ){

    m_fftSmoothed = receivedFft;
    
    for(int i=0; i<m_nBandsToGet; i++){
        m_fftSmoothed[i] = receivedFft[i];
//        m_fftSmoothed[i] *= (m_isPlaying) ? 0.96f : 0.5f;
        m_fftSmoothed[i] *= 0.9f;
        //if (m_fftSmoothed[i] < val[i]) m_fftSmoothed[i] = val[i];
    }
    

    
//    float * val = ofSoundGetSpectrum(m_nBandsToGet * 2);        // request 1024 values for fft
//    for (int i = 0;i < m_nBandsToGet; i++){
//        m_fftSmoothed[i] *= (m_isPlaying) ? 0.96f : 0.5f;
//    //if (m_fftSmoothed[i] < val[i]) m_fftSmoothed[i] = val[i];
//    }

   
    if (ofGetWidth() ==0 && ofGetHeight() == 0)
        return;
    for (int i = 0; i < m_balls.size(); i++){
        Ball *ball = & m_balls.at(i);
        // ball->separate(m_balls);
        ball->FFTupdate(m_fftSmoothed);
        ball->update();
        ball->checkEdges();
    }
    
}
Esempio n. 3
0
//--------------------------------------------------------------
void soundizeMeApp::update(){

     
    
    
    float * val = ofSoundGetSpectrum(m_nBandsToGet * 2);        // request 1024 values for fft
    for (int i = 0;i < m_nBandsToGet; i++){

        
        m_fftSmoothed[i] *= (m_isPlaying) ? 0.96f : 0.5f;

       
        if (m_fftSmoothed[i] < val[i]) m_fftSmoothed[i] = val[i];

    }

   
    if (ofGetWidth() ==0 && ofGetHeight() == 0)
        return;
    for (int i = 0; i < m_balls.size(); i++){
        Ball *ball = & m_balls.at(i);
        // ball->separate(m_balls);
        ball->FFTupdate(m_fftSmoothed);
        ball->update();
        ball->checkEdges();
    }
    
}