Skip to main content

MDCTN :yarn:

Multidimensional Modified Discrete Cosine Transforms

pip install mdctn
  • 1-D MDCT & IMDCT
  • n-D MDCT & IMDCT
  • Windowing support
  • Helper functions for signals

1-D MDCT on signals

Signals are wrapped around so all the data is stored in the same number of bits.

import numpy as np
from mdctn import mdct, imdct

x = np.arange(24)

y =  mdct(x, N=16)
z = imdct(y, N=16)

np.allclose(x, z) # True

1-D Pure MDCT

The core MDCT function

import numpy as np
from mdctn import core

x = np.arange(6) # [0, 1, 2, 3, 4, 5]

y_1 = core.mdct(x[0:4]) # [-2.50104055, -0.49476881]
y_2 = core.mdct(x[2:6]) # [-4.34879961, -1.26013568]

z_1 = core.imdct(y_1) # [-0.5,  0.5,  2.5,  2.5]
z_2 = core.imdct(y_2) #             [-0.5,  0.5,  4.5,  4.5]

z = (z_1[2:4] + z_2[0:2]) # [2.0, 3.0]

Benchmarks

See benchmarks.ipynb

Metadata

Release files for mdctn 0.3.1

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

Source distribution (sdist)

Source distribution for mdctn 0.3.1
File Size Uploaded
mdctn-0.3.1.tar.gz 3.5 kB Details

Built distribution (wheel)

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

Total release size: 9.9 kB

Release files / mdctn-0.3.1.tar.gz

Download URL mdctn-0.3.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4ebf0501fe17d17d9e22803c7d0e7d447cf7ca08676d6554bc040d92ca564384
BLAKE2b-256 checksum
How to use checksums
7bbd5057e24afe00c373c8a4836dbdfe64f6ada8d6843f24cb8f399c20624616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic

Release files / mdctn-0.3.1-py3-none-any.whl

Download URL mdctn-0.3.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
995f2d38837a561620d2d8b2fcee0df68e8bcc3f350246b273b160efdd219e47
BLAKE2b-256 checksum
How to use checksums
3818ee403696812f1f77666e130cbaf5c492cc3b6acfb4ee7095c18d2bd1f825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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