A fast python library for aligning similar audio snippets passed in as NumPy arrays.
Project description
fast-align-audio: high-speed NumPy audio alignment
fast-align-audio is designed to swiftly align two similar NumPy arrays — a common need in various fields including audio signal processing. If you have two arrays where one "lags behind" the other due to factors such as different capture sensors (microphones), propagation delays, or post-processing like reverberation or MP3 compression, fast-align-audio is here to help.
The package employs a "brute force" alignment approach, leveraging a C-based algorithm for maximum speed while providing a user-friendly Python API for easy integration.
While this library was initially developed with audio ndarrays in mind, it could also be used to align other kinds of time-series data that are represented as NumPy arrays.
Installation
$ pip install fast-align-audio
Usage
Here is a basic usage example:
import fast_align_audio
import numpy as np
# Create a random NumPy array
arr = np.random.uniform(size=10_000).astype("float32")
# Find the best offset for aligning two arrays
print(fast_align_audio.best_offset(arr, np.pad(arr, (121, 0)), 1_000, 5_000))
# Output: -121
print(fast_align_audio.best_offset(arr, arr[121:], 1_000, 5_000))
# Output: 121
# Align two arrays and confirm they're equal post alignment
arr1, arr2 = fast_align_audio.align(arr, np.pad(arr, (121, 0)), 1_000, 5_000, align_mode="crop")
np.array_equal(arr, arr1) and np.array_equal(arr, arr2)
# Output: True
In this example, we first create a random numpy array. We then call the best_offset method to find the best offset to align two arrays, and we use the align method to align the arrays. The np.array_equal method checks if two arrays are equal, demonstrating the successful alignment of the two original arrays.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for fast_align_audio-0.1.2-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16fa0c79b96e94dcde58414ef2b77ab630962f8e94d424ebc35bf3d457666203 |
|
MD5 | f21018351793149e78b5e086c4a32209 |
|
BLAKE2b-256 | 35d3731ad52eed782927522720a2f71510bb40cbb7fbd2859a9a9978e770ab24 |
Hashes for fast_align_audio-0.1.2-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba67e7ab7c971c0c27c77e81b77d142d8d61efa26c0fbb6c48553ae1ddde3a26 |
|
MD5 | 211d7aa7823667dbf873cdc5a14774e4 |
|
BLAKE2b-256 | 252ea8ee7cccff56a59fc232aeea1a2250c48b83d6319b85687b3b9163c08e34 |
Hashes for fast_align_audio-0.1.2-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fabe92e5445b1cf91edcdf24fe0c14945034e8a8d93e6a1253b912099b3d123c |
|
MD5 | 147666a12b3be3ea299d9ffc786044bf |
|
BLAKE2b-256 | ee8ae7d0ce1a760ff2a624ecc3975793be36f961057aceecbe2e308e16fe71da |
Hashes for fast_align_audio-0.1.2-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e20d2b7468ddb7fe7061c808d0a37940f6f7fd27e8c183dfa21a7506060e507 |
|
MD5 | 7b4bdaf5f67cffda0e1c5ef866197791 |
|
BLAKE2b-256 | bcd93f9a157e07f3534d631a8f582dc28c5f4fff3a2dd4d718a05838cf39515c |
Hashes for fast_align_audio-0.1.2-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db8d9907bb48ac1abe4cc98c7ae88310b0b1b16c9acca10ae6111c360060f27a |
|
MD5 | 742c5c86671b4f4a22207858d54c9631 |
|
BLAKE2b-256 | dab8a46742d0e6e9aad305e90dc3980a0e15393bb496e0292967513de0348bd5 |
Hashes for fast_align_audio-0.1.2-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0912f161d874a11e34d25d25e118769e85cbe5ac6aba7b4c06d807b082383bb4 |
|
MD5 | e58c0d5c6d423f6f35b55523116c0a35 |
|
BLAKE2b-256 | f74093ecc7c185fa0b7751b9db4ef2c5d92278d5dec0f07279639bf2b4e28d19 |
Hashes for fast_align_audio-0.1.2-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0db2b5ade9e018a2aa6a056c113e2d3b72c420b4264fc1db617577afa8b03b1f |
|
MD5 | b48f224cfbaa5913f2d047f9e2ca71c6 |
|
BLAKE2b-256 | 53c8b5984aabf8fe5c0b3fd555b839ee150d9ec9472256641af6a87bd92bd675 |
Hashes for fast_align_audio-0.1.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 107d910de57e0f42ab3db289f2b69583f96469401a5adada6da11ab8ad604f4f |
|
MD5 | 7e46af8654368f10f117a636d291bc99 |
|
BLAKE2b-256 | 5c0e89f0baa7c9cc4e5d5ab4fc6db499c269684b804d337a0e67038e9a036330 |
Hashes for fast_align_audio-0.1.2-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f4c467e84a9cec63eac5941e004a56bc883c29f5bb2f3c99f9ad52aa51d0128 |
|
MD5 | 5b6ff4c4eb4a10ce8ff0fba2cce6a77a |
|
BLAKE2b-256 | 3a24f6f0bc0988a3ad05278230e5186ab54252e27a4f5a7001de4ae50c1302c5 |
Hashes for fast_align_audio-0.1.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 303a7c30652df69e3bf6e6e1cb83aa499d2ba8fa2ca7d1855f3e27668e5a9911 |
|
MD5 | 37b37a7b829ccb5f2e237767c3240975 |
|
BLAKE2b-256 | bc5b6fcd38e91e7542e524eec6dd0519ffa1ea8fb3b26a7304bf4c20c947a9d9 |
Hashes for fast_align_audio-0.1.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cbe23abd13507ba177310139ae7afb73f06cb7c5cdf7c754aea9ac4257e8e4a |
|
MD5 | 6fdcb49077be56efda2cfd90c24baaae |
|
BLAKE2b-256 | 513255a81c53fb10203cad25850f968aa9454bc90da6d3295096f00f3e3b72f7 |
Hashes for fast_align_audio-0.1.2-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0110cf389c53bd03846f9370b1c55c7ef1dbca70d13474698fa6ec638d6a99b |
|
MD5 | c838c2c37e51558f9efa594e1ab4422c |
|
BLAKE2b-256 | a074571135805f213a79e4977110bcfbddb49329d4cda0edaaea606d92be210e |
Hashes for fast_align_audio-0.1.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff87740bd1e93d6ab1d825f03f2d97fbb786eb9202eec327bf7258ea59c80313 |
|
MD5 | 44d7ce3d89ca554634cacab8075361f8 |
|
BLAKE2b-256 | 7b632bc57e875ef590ddc9866eb570db1dee7299c70fbfe7968bac4e8dfa3b88 |
Hashes for fast_align_audio-0.1.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | befb7bf1fc5464a76a5122de14a67dd9d2e6ed31ee553f6a835bb6920b51c673 |
|
MD5 | d4191cab563dfd9bb5635123ec673f10 |
|
BLAKE2b-256 | 1afee6ec126d72d8aa956c8aa2e2e03c98777d7c26dc1a1b4d21e93d6309d920 |
Hashes for fast_align_audio-0.1.2-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24f2259cde207812663bcb409ef0cef1d31d24a91030deeed39e305cea3743be |
|
MD5 | ca81bd3e69b4f5a60c06a414964cadaa |
|
BLAKE2b-256 | ec2af6ce1541b78e4e37d2de4b8aa79888184b44297f91f13d3f16b644e2980f |
Hashes for fast_align_audio-0.1.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f468aaecb55392a886e090c76dc1b22ecd565033afe059e8447be648fef8ced |
|
MD5 | 9a53458eb719fbe3be8f0275ad17dd13 |
|
BLAKE2b-256 | 8c711c1c2e5f3dd057e1f5f2584a96b9ac8e36d1a8ac14ae5660a0a0438f0f02 |