Skip to main content

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

Project description

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"
)
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

📁 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."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aifourier-4.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aifourier-4.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file aifourier-4.0.0.tar.gz.

File metadata

  • Download URL: aifourier-4.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aifourier-4.0.0.tar.gz
Algorithm Hash digest
SHA256 9a91868937c1781e4011ceb09cd1a01d6b5cfc9d790fbe73c2c629b816d2dce0
MD5 6615f398f08d163ed37a382ddf9c795f
BLAKE2b-256 766a0b3b3204421fcee07a4d4357d2cedef5864ccb9172a46b616393d2a47074

See more details on using hashes here.

Provenance

The following attestation bundles were made for aifourier-4.0.0.tar.gz:

Publisher: python-publish.yml on jovan-AIcoder/AI-Based-Fourier-Analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aifourier-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: aifourier-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aifourier-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7116cbcf07f4adf5c840f36676dc84306785eaf6eb067c3702c0e1d67e65ff8
MD5 a9ef5972e4880101504a88a1d3a0c9c0
BLAKE2b-256 58be4a553775eb5a500d50e5bc3f1fa44311e829fb13dce5066b4854e4093ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for aifourier-4.0.0-py3-none-any.whl:

Publisher: python-publish.yml on jovan-AIcoder/AI-Based-Fourier-Analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page