Template Classes for Digital Signal Analysis

Environment: VC6 SP4, VC.NET

This article briefly describes a collection of template classes that can be used in digital signal analysis.

This collection consists of four classes:

  1. Template class WFastHT—implements algorithm of Fast Haara's Transformation (by Anatoly Beletsky). The template has two type parameters:
    • T_in—type of input values (input signal)
    • T_out—type of output values (spectrum)
    Input signal has any type (int, double, complex<T>). Spectrum is double or complex.
  2. Template class WIFastHT—implements algorithm of Inverse Fast Haara's Transformation.
  3. Template class WFastFT—implements algorithm of Fast Fourier Transformation (Tim Kientzle "A Programmer's Guide To Sound" Copyright © 1998 Tim Kientzle).
  4. Template class WFastWT—implements algorithm of Fast Walsh's Transformation in different bases:
    • HADOMARD—Walsh's-Hadomar's basis
    • PELEY—Peley's basis
    • WALSH—"classical" basis
    • COOLEY—Cooley's basis (discovered by Anatoly Beletsky in 1999)
    It uses a new type of operation: Grey's "right-handed" inverse coding. The complete group of operations that forms the so-called "Grey's algebra" consists of five operations:
    1. Binary inversion
    2. Grey's "left-handed" coding operation
    3. Grey's "left-handed" inverse coding operation
    4. Grey's "right-handed" coding operation
    5. Grey's "right-handed" inverse coding operation

For details, contact me.

Here is an example of the code's usage:

#include <iostream>
using std::cout;
using std::cin;

#include "transform.h"

const int Val = 8;
const int fr = 7;

int main()
{

  try {
    WFastHT< double, double > haaras( Val );
    WIFastHT< double, double > ihaaras( Val );
    double data[Val] = { 1,2,3,4,4,3,2,1 };
    double *pD, *pS;

    haaras.setData( data );
    haaras.doTransform();
    pD = haaras.getSpectrum();

    cout << "Input signal: \n";
    for( int i = 0; i < Val; i++ ) {
      cout << data[ i ] << "\n";
    }

    cout << "\nSpectrum: \n";
    for( i = 0; i < Val; i++ ) {
      cout << pD[ i ] << "\n";
    }

    ihaaras.setData( pD );
    ihaaras.doTransform();
    pS = ihaaras.getSpectrum();

    cout << "\nInverse haara's transformation: \n";
    for( i = 0; i < Val; i++ ) {
      cout << pS[ i ] << "\n";
    }
  }
  catch( TransError::badNValue ) {
    cout << "Bad N!\n";
  }
  catch( TransError::noData ) {
    cout << "No data available!\n";
  }
  catch( TransError::noSuchBasis ) {

  }
  return 1;
}

Downloads

Download demo project - 78 Kb
Download source - 4 Kb


Comments

  • More info

    Posted by Legacy on 01/09/2003 12:00am

    Originally posted by: Alexander

    First of all thanks anyone who read my article, because it is my first!
    About "More info" and "Contact me". Please read my source code - everything that you need there! If I try to explaine basics of FFT, FHT or FWT CodeGuru will never publish my article ;) (because of its size). There many places in internet with these algorithm explanation, I just wanted to help you with implementaion of these algorithms. I would like to focus your attention in new types of coding operation which extends "clasic" Greys coding.
    Thank for comments.

    • df

      Posted by npj017 on 04/01/2009 10:46am

      ggggg

      Reply
    • where

      Posted by axlear on 09/29/2004 02:03am

      i didnt find your code.

      Reply
    Reply
  • More info please?

    Posted by Legacy on 01/04/2003 12:00am

    Originally posted by: Dave

    At first I thought Paul's comment was a little harsh. But after scratching my head, I have to admit that a little more explanation would help. I've been looking for some compact FFT code for a while now - most implmentations I've come across are convoluted and incomprehensible. Thanks for posting this class and any additional descriptive text would be greatly appreciated.

    Reply
  • "Contact me for details"

    Posted by Legacy on 01/03/2003 12:00am

    Originally posted by: Paul

    The last time I checked, the whole purpose of this site is to share the details of how the code was implemented, the problems you faced, and the solutions to those problems.

    If you think there are details significant enough for people to contact you, then post those details with your article and code. Otherwise, what's the point of you posting at all?

    • Template Classes for Digital Signal An

      Posted by Datnt on 11/02/2004 11:21pm

      Good

      Reply
    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Best-in-Class organizations execute on a strategy that supports the multi-channel nature of customer requests. These leading organizations do not just open up their service infrastructures to accommodate new channels, but also empower their teams to deliver an effective and consistent experience regardless of the channel selected by the customer. This document will highlight the key business capabilities that support a Best-in-Class customer engagement strategy.

  • Live Event Date: September 17, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this upcoming eSeminar and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds