Skip to main content

Multidimensional Modified Discrete Cosine Transforms

Project description

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

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

mdctn-0.3.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

mdctn-0.3.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file mdctn-0.3.1.tar.gz.

File metadata

  • Download URL: mdctn-0.3.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic

File hashes

Hashes for mdctn-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4ebf0501fe17d17d9e22803c7d0e7d447cf7ca08676d6554bc040d92ca564384
MD5 c7e798794a25c665f3b3b333c178ff99
BLAKE2b-256 7bbd5057e24afe00c373c8a4836dbdfe64f6ada8d6843f24cb8f399c20624616

See more details on using hashes here.

File details

Details for the file mdctn-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: mdctn-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic

File hashes

Hashes for mdctn-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 995f2d38837a561620d2d8b2fcee0df68e8bcc3f350246b273b160efdd219e47
MD5 893502b9d5e8a651ec1aaa22af25b52d
BLAKE2b-256 3818ee403696812f1f77666e130cbaf5c492cc3b6acfb4ee7095c18d2bd1f825

See more details on using hashes here.

Supported by

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