Skip to main content

NP3

A fast python library to load mp3 data into NumPy arrays.

It is based on lieff's minimp3

Installation

pip install np3

Usage

import np3

mp3 = np3.MP3(path="/my/mp3/file")

# or

with open("/path/to/file.mp3") as mp3_fh:
    mp3 = np3.MP3(file=mp3_fh)

# or

data: bytes = obtain_mp3_data()
mp3 = np3.MP3(data=data)

print(f"Channels: {mp3.channels}")
print(f"Sampling rate: {mp3.hz} Hz")

length = len(mp3.samples[0]) / mp3.hz
print(f"Length: {length:.1f} seconds")

Threaded performance

GIL is released before decoding starts. On multi core machines this brings additional performance when decoding in separate threads. While decoding a single file does not parallelise, other python threads can continue working while the file is being processed. Where multiple files need decoding this performance gain becomes particularly significant.

from concurrent.futures import ThreadPoolExecutor

files = ["/path/to/file1.mp3", "/path/to/file2.mp3", ...]

with ThreadPoolExecutor() as executor:
    mp3s = executor.map(
        lambda p: np3.MP3(path=p),
        files,
    )

Metadata

Release files for np3 0.2

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

Source distribution (sdist)

Source distribution for np3 0.2
File Size Uploaded Provenance Actions
np3-0.2.tar.gz 34.9 kB Without provenance Details for np3-0.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for np3 0.2
File Actions
np3-0.2-cp311-cp311-musllinux_1_1_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.1+ x86-64 Details for np3-0.2-cp311-cp311-musllinux_1_1_x86_64.whl
np3-0.2-cp311-cp311-musllinux_1_1_i686.whl CPython 3.11 CPython 3.11 Linux musl 1.1+ x86-32 Details for np3-0.2-cp311-cp311-musllinux_1_1_i686.whl
np3-0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for np3-0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
np3-0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-32, Linux glibc 2.5+ x86-32 Details for np3-0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
np3-0.2-cp310-cp310-musllinux_1_1_i686.whl CPython 3.10 CPython 3.10 Linux musl 1.1+ x86-32 Details for np3-0.2-cp310-cp310-musllinux_1_1_i686.whl
np3-0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for np3-0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
np3-0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 CPython 3.10 Linux glibc 2.5+ x86-32, Linux glibc 2.17+ x86-32 Details for np3-0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Total release size: 810.6 kB

Release files / np3-0.2.tar.gz

Download URL np3-0.2.tar.gz
Size 34.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d4e584034ad3cc61ea7990bab7b81e3cf7f2a40a13cd7401970d6c25cd90d35f
BLAKE2b-256 checksum
How to use checksums
44b163de6d36ca15cbaa58940cc21e0dde6b461a3fc36465ca673ed40d7b0162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp311-cp311-musllinux_1_1_x86_64.whl

Download URL np3-0.2-cp311-cp311-musllinux_1_1_x86_64.whl
Size 111.4 kB
Tags CPython 3.11 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
da6f6dd8363e02e11891be08c25b4e0fd3f2f771fe4b4fd79d72178a5367a1ea
BLAKE2b-256 checksum
How to use checksums
311706dc5895c4557ad4a9143a25a50a22135b21d713e251ea15b0727029c6e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp311-cp311-musllinux_1_1_i686.whl

Download URL np3-0.2-cp311-cp311-musllinux_1_1_i686.whl
Size 97.8 kB
Tags CPython 3.11 Linux musl 1.1+ x86-32
SHA-256 checksum
How to use checksums
43d4a615755c406ddbc2922d4eada66118cc8ea2adb1a93791d1cf2bc5ac7fc7
BLAKE2b-256 checksum
How to use checksums
121afba2c5b5c7d10d28c7197db314b91b00a45f477f825bd83dd6423cc7a4f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL np3-0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 108.8 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
263f7c83d565dfa00bbd8d6df6d70106b5ffe43cf735298097e71aa3e940584f
BLAKE2b-256 checksum
How to use checksums
59c5ac05c8482d93dec9b95d86e9ed4291314305794bc033ebe0e804cd38958b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Download URL np3-0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Size 137.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-32 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
7c7b5e0439bdd2cc4011e21b67c981eb76b77e4e79cc385741a16fc3ca03546c
BLAKE2b-256 checksum
How to use checksums
9afaee88e86cc0c11cc28e8ef2d82a7f8ef1f94f79f0e2976678e3b0523c2a84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp310-cp310-musllinux_1_1_i686.whl

Download URL np3-0.2-cp310-cp310-musllinux_1_1_i686.whl
Size 96.9 kB
Tags CPython 3.10 Linux musl 1.1+ x86-32
SHA-256 checksum
How to use checksums
c0fe6e5478730c5709f54f5c08a3b5c4e54f895285d1312708e3eaf5abbc2873
BLAKE2b-256 checksum
How to use checksums
92e78797d39ac936f9544d11121e9ad2ba75736a070dd1ede819b051d0aad365
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL np3-0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 86.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b32e43e17e909b1d835175e876acad75e98d167494039e86d9d7e360ef32bfef
BLAKE2b-256 checksum
How to use checksums
036def2e23ec5f6bb8bb4074f3f8208777d9ea090c7bb792fc81f17e9fad35b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / np3-0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Download URL np3-0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Size 136.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-32 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
7e20d3954c685da78cd69b07605f692a81f4ee26b586bc735dc125dbb70b22a1
BLAKE2b-256 checksum
How to use checksums
e708870f4c41bc06c64e75b1640e5115a0f7d7aa1a603801b43ced5c4b8cf667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for np3 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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