Skip to content

An unofficial Python reimplementation of the legacy-STRAIGHT

License

Notifications You must be signed in to change notification settings

takenori-y/pylstraight

Repository files navigation

pylstraight

This is an unofficial Python reimplementation of the legacy-STRAIGHT, which was originally written in MATLAB.

Latest Manual Stable Manual Downloads Python Version PyPI Anaconda Codecov License GitHub Actions Ruff

Requirements

  • Python 3.8+

Documentation

Installation

The latest stable release can be installed from PyPI by running the command below.

pip install pylstraight

The development release can be installed from the master branch using the following command:

pip install git+https://github.com/takenori-y/pylstraight.git@master

Supported Features

  • Fundamental frequency extraction
  • Aperiodicity measure extraction
  • Spectral envelope extraction
  • Synthesis using the extracted parameters

Unsupported Features

  • Batch processing
  • GPU acceleration
  • JIT compilation

Example

import pylstraight as pyls

# Read an example waveform.
x, fs = pyls.read("assets/data.wav")

# Set control parameters.
fp = 5                # Frame shift in msec
f0_range = (60, 240)  # F0 search range in Hz

# Extract the STRAIGHT parameters.
f0 = pyls.extract_f0(x, fs, f0_range=f0_range, frame_shift=fp)
ap = pyls.extract_ap(x, fs, f0, frame_shift=fp)
sp = pyls.extract_sp(x, fs, f0, frame_shift=fp)

# Synthesize a waveform using the parameters.
sy = pyls.synthesize(f0, ap, sp, fs, frame_shift=fp)

# Write the synthesized waveform.
pyls.write("data.syn.wav", sy, fs)

License

The original code is licensed under the Apache License 2.0.