Python library for AI-based Fourier analysis of audio signals, powered by Sinusoidal Neural Networks (SNN).
Project description
AI-Based Fourier Analysis (aifourier)
"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.
🌊 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aifourier-4.0.1.tar.gz.
File metadata
- Download URL: aifourier-4.0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e538a35f2ee02d90f8290ee4517316a75a22ec8ce0f65889f2a35a387f7d021a
|
|
| MD5 |
f121ce0fb5b5597dbd814c4dae281967
|
|
| BLAKE2b-256 |
d691b12ca4e191157f2aab3c5e7a91ed43ff5eb81fc522e19e039bcb2b05be5f
|
Provenance
The following attestation bundles were made for aifourier-4.0.1.tar.gz:
Publisher:
python-publish.yml on jovan-AIcoder/AI-Based-Fourier-Analysis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aifourier-4.0.1.tar.gz -
Subject digest:
e538a35f2ee02d90f8290ee4517316a75a22ec8ce0f65889f2a35a387f7d021a - Sigstore transparency entry: 2178960785
- Sigstore integration time:
-
Permalink:
jovan-AIcoder/AI-Based-Fourier-Analysis@18cb84fbb5527659875305010a16451172894c29 -
Branch / Tag:
refs/tags/v4.0.1 - Owner: https://github.com/jovan-AIcoder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@18cb84fbb5527659875305010a16451172894c29 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aifourier-4.0.1-py3-none-any.whl.
File metadata
- Download URL: aifourier-4.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c386ce749e5ef79b8c723169670eee972c0c912f95eb347c3cc0058075ec4158
|
|
| MD5 |
fa88ff7e86dafe7c14b6043fd6741887
|
|
| BLAKE2b-256 |
932c66a8b335b4dffcb16086955b454b0c92681b67c93c65a75895806a015e0b
|
Provenance
The following attestation bundles were made for aifourier-4.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on jovan-AIcoder/AI-Based-Fourier-Analysis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aifourier-4.0.1-py3-none-any.whl -
Subject digest:
c386ce749e5ef79b8c723169670eee972c0c912f95eb347c3cc0058075ec4158 - Sigstore transparency entry: 2178960838
- Sigstore integration time:
-
Permalink:
jovan-AIcoder/AI-Based-Fourier-Analysis@18cb84fbb5527659875305010a16451172894c29 -
Branch / Tag:
refs/tags/v4.0.1 - Owner: https://github.com/jovan-AIcoder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@18cb84fbb5527659875305010a16451172894c29 -
Trigger Event:
release
-
Statement type: