MCPcopy Index your code
hub / github.com/Kinyugo/torch_mdct

github.com/Kinyugo/torch_mdct @v0.4.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.1 ↗ · + Follow
11 symbols 37 edges 4 files 9 documented · 82% updated 19mo agov0.4.1 · 2024-12-17★ 331 open issues

Browse by type

Functions 9 Types & classes 2
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

torch_mdct

A PyTorch implementation of the Modified Discrete Cosine Transform (MDCT) and its inverse for audio processing.

Installation

pip install torch_mdct

Usage

import torchaudio
from torch_mdct import IMDCT, MDCT, kaiser_bessel_derived, vorbis

# Load a sample waveform 
waveform, sample_rate = torchaudio.load("/path/to/audio.file")

# Initialize the mdct and imdct transforms
mdct = MDCT(win_length=1024, window_fn=vorbis, window_kwargs=None, center=True)
imdct = IMDCT(win_length=1024, window_fn=vorbis, window_kwargs=None, center=True)

# Transform waveform into mdct spectrogram
spectrogram = mdct(waveform)

# Transform spectrogram back to audio 
reconst_waveform = imdct(spectrogram)

# Compute the differences
print(f"L1: {(waveform - reconst_waveform).abs().mean()}")

References

[1] Zaf-Python: Zafar's Audio Functions in Python for audio signal analysis.

[2] MDCT: A fast MDCT implementation using SciPy and FFTs.

Core symbols most depended-on inside this repo

Shape

Function 5
Method 4
Class 2

Languages

Python100%

Modules by API surface

src/torch_mdct/torch_mdct.py7 symbols
src/torch_mdct/windows.py2 symbols
src/torch_mdct/functional.py2 symbols

For agents

$ claude mcp add torch_mdct \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page