SwiftPFFFT

0.1.1

PFFFT FFT library code and Swift wrapper
jkl1337/SwiftPFFFT

What's New

Maintenance pre-release

2024-10-30T23:56:24Z
  • Update README
  • Support Swift 5.9 and up
  • Minor refactorings

CI

SwiftPFFFT

Swift package providing a PFFFT (Pretty Fast, Fast Fourier Transform) library with wrapper.

This code is based on the marton78 fork of PFFFT that was forked from the original PFFFT implementation by Julien Pommier. This fork provides support for doubles in addition to floats and provides additional SIMD implementations:

The origin for the C implementation in this package is https://github.com/marton78/pffft.

PFFFT provides substantial performance improvement over KissFFT. The advantage over FFTW is reasonable performance with much simpler usage and a permissive 3 clause BSD license.

Example

// construct an interface for FFT, IFFT and convolutions. The interface is parameterized on the
// type of element in the signal (time) domain. The spectrum (frequency) domain type will always be
// complex. For a real valued signal the spectrum size will be `n / 2`, with the packing convention
// 
let fft = try FFT<Complex<Float>>(n: 16)
let signal = fft.makeSignalBuffer()

signal.mapInPlace { (i, v) in
    v = Complex(Float(i) + 1.0, Float(i) - 2.0)
}

let spectrum = fft.makeSpectrumBuffer()
fft.forward(signal: signal, spectrum: spectrum)

fft.inverse(spectrum: spectrum, signal: signal)

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Thu May 15 2025 06:07:41 GMT-0900 (Hawaii-Aleutian Daylight Time)