void BoomAnalyzer::transform(Scope& s) {
  float* front = static_cast<float*>(&s.front());

  fht_->spectrum(front);
  fht_->scale(front, 1.0 / 50);

  s.resize(scope_.size() <= kMaxBandCount / 2 ? kMaxBandCount / 2
                                              : scope_.size());
}
Beispiel #2
0
void BoomAnalyzer::transform(Scope& s) {
  float* front = static_cast<float*>(&s.front());

  m_fht->spectrum(front);
  m_fht->scale(front, 1.0 / 60);

  Scope scope(32, 0);

  const uint xscale[] = {0,  1,  2,  3,  4,  5,   6,   7,   8,   9,   10,
                         11, 12, 13, 14, 15, 16,  17,  19,  24,  29,  36,
                         43, 52, 63, 76, 91, 108, 129, 153, 182, 216, 255};

  for (uint j, i = 0; i < 32; i++)
    for (j = xscale[i]; j < xscale[i + 1]; j++)
      if (s[j] > scope[i]) scope[i] = s[j];

  s = scope;
}
Beispiel #3
0
template<class W> void
Analyzer::Base<W>::transform( Scope &scope ) //virtual
{
    //this is a standard transformation that should give
    //an FFT scope that has bands for pretty analyzers

    //NOTE resizing here is redundant as FHT routines only calculate FHT::size() values
    //scope.resize( m_fht->size() );

    float *front = static_cast<float*>( &scope.front() );

    float* f = new float[ m_fht->size() ];
    m_fht->copy( &f[0], front );
    m_fht->logSpectrum( front, &f[0] );
    m_fht->scale( front, 1.0 / 20 );

    scope.resize( m_fht->size() / 2 ); //second half of values are rubbish
    delete [] f;
}
void NyanCatAnalyzer::transform(Scope& s) { m_fht->spectrum(&s.front()); }
Beispiel #5
0
void Sonogram::transform(Scope& scope) {
  float* front = static_cast<float*>(&scope.front());
  m_fht->power2(front);
  m_fht->scale(front, 1.0 / 256);
  scope.resize(m_fht->size() / 2);
}
void Rainbow::RainbowAnalyzer::transform(Scope& s) { fht_->spectrum(&s.front()); }