Skip to main content

LPC Utility for Pytorch Library.

Project description

LPC Utility for Pytorch Library.

LPC Torch

LPCTorch is a small pytorch utility for Linear Predictive Coding. It provides a simple way to compute windowed Linear Predictive Coding Coefficients on a input audio signal. The repo uses the Burg's methods [1] and is heavily inspired from the librosa audio library implementation [2].

Install

Install the module using the pip utility ( may require to run as sudo )

pip3 install lpctorch

Usage

LPC Coefficients

from lpctorch import LPCCoefficients

# Parameters
#     * sr            : sample rate of the signal ( 16 kHz )
#     * frame_duration: duration of the window in seconds ( 16 ms )
#     * frame_overlap : frame overlapping factor
#     * K             : number of linear predictive coding coefficients
sr             = 16000
frame_duration = .016
frame_overlap  = .5
K              = 32

# Initialize the module given all the parameters
lpc_prep       = LPCCoefficients(
    sr,
    frame_duration,
    frame_overlap,
    order = ( K - 1 )
)

# Get the coefficients given a signal
# torch.Tensor of size ( Batch, Samples )
alphas         = lpc_prep( X )

Example

The repository provides an example application with a 'sample.wav' file. The output is the same as the one provided by librosa (bottom).

 Ex

Benchmarks

Here are some benchmarks comparing cpu vs gpu inference times in seconds of the utility from 1 to 32 batch size.

 Bench

References

  • [1] Larry Marple A New Autoregressive Spectrum Analysis Algorithm IEEE Transactions on Accoustics, Speech, and Signal Processing vol 28, no. 4, 1980
  • [2] Librosa LPC Burg's Method Implementation

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

LPCTorch-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

LPCTorch-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file LPCTorch-0.1.2.tar.gz.

File metadata

  • Download URL: LPCTorch-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for LPCTorch-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8cfe0998e41110f9b48c04db87de68248f9c5d960775e4e716b6f2cc0d7c4368
MD5 75fa7175961e3b1097d4771ca8e87f8a
BLAKE2b-256 69fa21f42e5a2869f013d065e453a164a6865f8bec84fae11a747c0f167871b7

See more details on using hashes here.

File details

Details for the file LPCTorch-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: LPCTorch-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for LPCTorch-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 791f1c18a1bc4be456f0734d73b552357c6968bd647f69b2d839a53fe2da9639
MD5 35515eb8b33f0fcdccc54d96b65c60ce
BLAKE2b-256 4cd7e3bda799681bf90de22e2340b235990f58a3df7802e293161d7f045754c4

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