Catalog PyPI
PACKAGE EXPLORERView in registry

aifourier

PyPI

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

Versions collected1
Direct dependencies6From release 5.0.0
Last observed21 Oct, 10:44 UTC

README

Version 5.0.0 documentation

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:

ColumnDescription
FrequenciesLearned frequencies (Hz)
Phase shiftLearned phase shifts
AmplitudesLearned 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
)
ParameterDescription
audio_pathAudio file path
max_modesMaximum number of sinusoidal modes
epochsNumber of training epochs
use_phase_shiftLearn phase shifts
learning_rateOptimizer learning rate
save_modelSave trained model
verboseTraining verbosity (0, 1, 2)
positive_freqs_onlyKeep only positive frequencies
abs_amplitudesReturn absolute amplitudes
optimizerTraining optimizer
show_spectrumShow spectrum plot preview
save_spectrumSave 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."

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
5.0.018 Aug 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
jovan-aicoder/ai-based-fourier-analysis

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:44 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:cfb48b78865554be98c4e76407a7cf8f16a745c3937fdce801307c1443b7092a