Skip to content

Commit

Permalink
Merge pull request #66 from sp-nitech/v2
Browse files Browse the repository at this point in the history
v2
  • Loading branch information
takenori-y authored Mar 3, 2024
2 parents 661e0f0 + f0d2432 commit c29ec71
Show file tree
Hide file tree
Showing 277 changed files with 7,047 additions and 3,059 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
torch: 1.11.0
torchaudio: 0.11.0
- python: 3.11
torch: 2.2.0
torchaudio: 2.2.0
torch: 2.2.1
torchaudio: 2.2.1

steps:
- name: Clone
Expand Down
25 changes: 11 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ init:

dev:
test -d venv || python$(PYTHON_VERSION) -m venv venv; \
. ./venv/bin/activate; python -m pip install pip --upgrade; \
python -m pip install torch==$(TORCH_VERSION)+$(PLATFORM) torchaudio==$(TORCHAUDIO_VERSION)+$(PLATFORM) \
. ./venv/bin/activate; python -m pip install pip --upgrade
. ./venv/bin/activate; python -m pip install torch==$(TORCH_VERSION)+$(PLATFORM) torchaudio==$(TORCHAUDIO_VERSION)+$(PLATFORM) \
-f https://download.pytorch.org/whl/$(PLATFORM)/torch_stable.html; \
python -m pip install -e .[dev]
. ./venv/bin/activate; python -m pip install -e .[dev]

dist:
. ./venv/bin/activate; \
python -m build --wheel; \
python -m twine check dist/*.whl
. ./venv/bin/activate; python -m build --wheel
. ./venv/bin/activate; python -m twine check dist/*.whl

dist-clean:
rm -rf dist
Expand All @@ -49,16 +48,14 @@ doc-clean:
fi

check:
. ./venv/bin/activate; \
python -m black --check $(PROJECT) tests; \
python -m isort --check $(PROJECT) tests --project $(PROJECT); \
python -m pflake8 $(PROJECT) tests
. ./venv/bin/activate; python -m black --check $(PROJECT) tests
. ./venv/bin/activate; python -m isort --check $(PROJECT) tests --project $(PROJECT)
. ./venv/bin/activate; python -m pflake8 $(PROJECT) tests

format:
. ./venv/bin/activate; \
python -m black $(PROJECT) tests; \
python -m isort $(PROJECT) tests --project $(PROJECT); \
python -m pflake8 $(PROJECT) tests
. ./venv/bin/activate; python -m black $(PROJECT) tests
. ./venv/bin/activate; python -m isort $(PROJECT) tests --project $(PROJECT)
. ./venv/bin/activate; python -m pflake8 $(PROJECT) tests

test:
@if [ ! -d tools/SPTK/bin ]; then \
Expand Down
50 changes: 38 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ diffsptk
[![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/1.2.1/)
[![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
[![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
[![PyTorch Version](https://img.shields.io/badge/pytorch-1.11.0%20%7C%202.2.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
[![PyTorch Version](https://img.shields.io/badge/pytorch-1.11.0%20%7C%202.2.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
[![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
[![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
[![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
Expand Down Expand Up @@ -44,11 +44,10 @@ Examples
```python
import diffsptk

# Set analysis condition.
fl = 400
fp = 80
n_fft = 512
M = 24
fl = 400 # Frame length.
fp = 80 # Frame period.
n_fft = 512 # FFT length.
M = 24 # Mel-cepstrum dimensions.

# Read waveform.
x, sr = diffsptk.read("assets/data.wav")
Expand Down Expand Up @@ -95,12 +94,11 @@ diffsptk.write("unvoiced.wav", x_unvoiced, sr)
```python
import diffsptk

# Set analysis condition.
fl = 400
fp = 80
n_fft = 512
n_channel = 80
M = 12
fl = 400 # Frame length
fp = 80 # Frame period
n_fft = 512 # FFT length
n_channel = 80 # Number of channels
M = 12 # MFCC/PLP dimensions

# Read waveform.
x, sr = diffsptk.read("assets/data.wav")
Expand Down Expand Up @@ -167,6 +165,34 @@ error = (x_hat - x).abs().sum()
print(error)
```

### Constant-Q transform
```python
import diffsptk
import librosa # This is to get sample audio.

fp = 128 # Frame period.
K = 252 # Number of CQ-bins.
B = 36 # Number of bins per octave.

# Read waveform.
x, sr = diffsptk.read(librosa.ex("trumpet"))

# Transform x.
cqt = diffsptk.CQT(fp, sr, n_bin=K, n_bin_per_octave=B)
c = cqt(x)

# Reconstruct x.
icqt = diffsptk.ICQT(fp, sr, n_bin=K, n_bin_per_octave=B)
x_hat = icqt(c, out_length=x.size(0))

# Write reconstructed waveform.
diffsptk.write("reconst.wav", x_hat, sr)

# Compute error.
error = (x_hat - x).abs().sum()
print(error)
```

### Vector quantization
```python
import diffsptk
Expand Down
5 changes: 3 additions & 2 deletions diffsptk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from . import core
from . import functional
from . import misc
from .core import *
from . import modules
from .misc import *
from .modules import *
from .version import __version__
115 changes: 0 additions & 115 deletions diffsptk/core/cqt.py

This file was deleted.

Loading

0 comments on commit c29ec71

Please sign in to comment.