Skip to main content

AI-Based Fourier Analysis (aifourier)

aifourier_logo

"Machines can learn Fourier analysis."

aifourier is a Python library for AI-based Fourier analysis of audio signals, powered by Sinusoidal Neural Networks (SNN).

SinusoidalNN repo link (made by Jovan also): https://github.com/jovan-AIcoder/SinusoidalNN

Built on top of the SinusoidalNN python package framework, aifourier learns the frequency components of an audio signal through optimization instead of explicitly computing Fourier integrals.


✨ Features

  • 🔊 Analyze audio files (.wav, .mp3, .flac, .ogg)
  • 🌊 Built on top of SinusoidalNN
  • 🧠 Neural Fourier decomposition via optimization
  • 📊 Extract:
    • Frequencies (Hz)
    • Phase shifts
    • Amplitudes
  • ⚙️ Multiple optimizers
    • SGD
    • RMSprop
    • Adam
    • AdamW
    • Adagrad
    • Adadelta
    • Adamax
    • Nadam
    • Ftrl
  • 📈 Training MAE monitoring
  • ➕ Optional positive-frequency filtering
  • ➕ Optional absolute amplitudes
  • 💾 Save trained neural models
  • 📁 Pandas DataFrame output
  • ⚡ Simple one-line API

📦 Installation

pip install aifourier

🚀 Usage

import aifourier as aif

df = aif.analyze(
    "audio.mp3",
    optimizer="adam"
)

print(df.head())

📊 Output

The returned DataFrame contains:

Column Description
Frequencies Learned frequencies (Hz)
Phase shift Learned phase shifts
Amplitudes Learned amplitudes

🧠 How It Works

Instead of evaluating Fourier coefficients analytically,

y(t) ≈ Σ Aᵢ sin(ωᵢ t + φᵢ)

Where:

  • Aᵢ = amplitude
  • ωᵢ = angular frequency
  • φᵢ = phase shift

these parameters are learned directly from data using a Sinusoidal Neural Network.


⚙️ Parameters

aif.analyze(
    audio_path,
    max_modes=10000,
    epochs=256,
    use_phase_shift=True,
    learning_rate=1e-5,
    save_model=None,
    verbose=2,
    positive_freqs_only=True,
    abs_amplitudes=True,
    optimizer="adam",
    show_spectrum=False,
    save_spectrum=None
)
Parameter Description
audio_path Audio file path
max_modes Maximum number of sinusoidal modes
epochs Number of training epochs
use_phase_shift Learn phase shifts
learning_rate Optimizer learning rate
save_model Save trained model
verbose Training verbosity (0, 1, 2)
positive_freqs_only Keep only positive frequencies
abs_amplitudes Return absolute amplitudes
optimizer Training optimizer
show_spectrum Show spectrum plot preview
save_spectrum Save spectrum plot figure to desired folder path

📁 Example

See the examples/ folder:

cd examples
python example.py

Example workflow:

  • Analyze bird.mp3
  • Learn sinusoidal spectrum
  • Export frequency table
  • Plot the learned spectrum

The learned spectrum is shown below.

Spectrum of bird.mp3



🌊 Relationship with SinusoidalNN

SinusoidalNN
        │
        ▼
   aifourier

SinusoidalNN provides the neural network engine.

aifourier provides an easy-to-use interface for AI-based Fourier analysis of audio signals.


💡 Future Ideas

  • Audio reconstruction
  • FFT comparison utilities
  • Real-time microphone analysis
  • Radio signal analysis
  • Oscilloscope support
  • Complex-valued SinusoidalNN

👤 Author

Jovan

2026


📜 License

MIT License


"What Fourier derives analytically, Sinusoidal Neural Networks can approximate through learning."

Metadata

Release files for aifourier 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aifourier 5.0.0
File Size Uploaded Provenance Actions
aifourier-5.0.0.tar.gz 5.3 kB With provenance Details for aifourier-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aifourier 5.0.0
File Interpreter ABI Platform Actions
aifourier-5.0.0-py3-none-any.whl Python 3 none any Details for aifourier-5.0.0-py3-none-any.whl

Total release size: 11.5 kB

Release files / aifourier-5.0.0.tar.gz

Download URL aifourier-5.0.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
debd2420353f0805563efe6e0ebf9637c2a94ef450cdb306ce720181827042c9
BLAKE2b-256 checksum
How to use checksums
9dc1a6f77fb196a1d0bd67c65ecb95cd1527113fd1214144a0883c75e050391f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / aifourier-5.0.0-py3-none-any.whl

Download URL aifourier-5.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d853e1f00ba712ac24c8ee9f0be2f89707c54c641bdb2345b6d3ddbbb9733049
BLAKE2b-256 checksum
How to use checksums
e30f9655c4d93574b8f78bb7f3cca2b2d62aee41c1f836c70c79681b4462ab15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Security for aifourier 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aifourier-5.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page