Skip to content

teclabat/tclfftw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tclfftw - FFTW3 Tcl Extension

A Tcl extension providing a high-performance interface to the FFTW3 library for Fast Fourier Transform operations.

Features

  • FFT Operations: Forward and inverse FFT transformations
  • Flexible Data Access: Multiple data formats (nested lists, flat lists, integers)
  • In-Place/Out-of-Place: Support for both transformation modes
  • Multi-Carrier Waveform Generation: Advanced signal generation with:
    • Newman phase sequences for low PAPR
    • Frequency flatness correction
    • Sideband suppression calibration
    • Pseudorandom amplitude generation
    • Binary file output for AWG/DAC hardware

Quick Start

Installation

cd rcompile/tclfftw
autoconf
./configure
make
make install

Basic Usage

package require fftw

# Create FFT plan
set plan [fftw::plan 1024 1]

# Set input data
fftw::clear $plan
fftw::setAt $plan 0 0 {1.0 0.0}

# Execute FFT
fftw::execute $plan 0

# Get results
set output [fftw::get $plan 0]

# Cleanup
fftw::destroy $plan

Multi-Carrier Waveform Example

# Generate 5-tone signal with Newman phases
array set result [fftw::calcMcWaveform \
    -center 14250 \
    -startFreqList {14248 14249 14250 14251 14252} \
    -spacing 1.0 \
    -phaseSeed 2]

puts "RMS Power: $result(-rms) dBm"
puts "Samples: [llength $result(-pattern)]"

Documentation

Complete API documentation is available in doc/fftw.md

API Overview

Plan Management

  • fftw::plan - Create FFT plan
  • fftw::destroy - Destroy plan
  • fftw::cleanup - Free FFTW resources

Data Operations

  • fftw::set - Set multiple values
  • fftw::setAt - Set single value
  • fftw::get - Get values as nested lists
  • fftw::getFlat - Get values as flat list
  • fftw::getFlatInt - Get integer values
  • fftw::getAt - Get single value
  • fftw::clear - Zero all arrays

Transformations

  • fftw::execute - Run FFT/IFFT
  • fftw::scale - Scale output values

Waveform Generation

  • fftw::calcMcWaveform - Generate multi-carrier waveforms

Running Tests

make test

All 21 tests should pass:

Tests running in interp:       D:/CM.work/tcltk86/release/bin/tclsh86.exe
all.tcl:	Total	21	Passed	21	Skipped	0	Failed	0

Requirements

  • Tcl 8.6 or higher
  • FFTW3 library (libfftw3-3)
  • C++ compiler with C++11 support

Windows

Ensure libfftw3-3.dll is in your PATH or in the same directory as the extension.

Linux

Install FFTW3 development package:

# Debian/Ubuntu
sudo apt-get install libfftw3-dev

# RedHat/CentOS
sudo yum install fftw-devel

Version

Current Version: 3.3.4

Changelog

  • 3.3.4 (2023, H. Danzer): Added -sigma parameter for pseudorandom amplitudes
  • 3.3.3 (2022, H. Danzer): Minimum spacing changed to 1 Hz
  • 1.0 (2010, Peter Schurek): Initial release

Authors

  • Peter Schurek (Original implementation, 2010)
  • H. Danzer (Enhancements, 2022-2023)

License

See LICENSE file for details.

Example Applications

Signal Processing

  • Spectral analysis
  • Filter design and implementation
  • Convolution and correlation

RF/Microwave Engineering

  • Multi-carrier signal generation
  • PAPR optimization
  • AWG pattern creation
  • Channel simulation

Test and Measurement

  • Frequency domain analysis
  • Signal characterization
  • Calibration data application

Support

For bugs and feature requests, please contact the maintainers or file an issue in the project repository.

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published