Skip to content

Commit

Permalink
Merge pull request #9 from ionite34/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ionite34 authored Jul 7, 2022
2 parents 1ac3f96 + 19422f0 commit c81d318
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 39 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# nwave

[![Build](https://github.com/ionite34/nwave/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/ionite34/nwave/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/ionite34/nwave/branch/main/graph/badge.svg?token=ZXM5Y46XBI)](https://codecov.io/gh/ionite34/nwave)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fionite34%2Fnwave.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fionite34%2Fnwave?ref=badge_shield)


![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nwave)
[![PyPI version](https://badge.fury.io/py/nwave.svg)](https://pypi.org/project/nwave/)


Low latency multi-thread audio transforms and conversions


## License
The code in this project is released under the [MIT License](LICENSE).

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fionite34%2Fnwave.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fionite34%2Fnwave?ref=badge_large)
31 changes: 1 addition & 30 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pytest-cov = "^3.0.0"
tox = "^3.25.1"
yaspin = "^2.1.0"
tqdm = "^4.64.0"
ffmpeg-python = "^0.2.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
9 changes: 6 additions & 3 deletions src/nwave/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import time
from collections import deque
from concurrent.futures import ThreadPoolExecutor, Future
from typing import Iterator
from typing import Iterator, TYPE_CHECKING

from .audio import process
from .common.iter import sized_generator
from .scheduler import Task, TaskResult

if TYPE_CHECKING:
from .batch import Batch


class WaveCore:
def __init__(self, threads: int = None, exit_wait: bool = True):
Expand Down Expand Up @@ -39,11 +42,11 @@ def __exit__(self, exc_type, exc_value, traceback):
return False

@property
def n_tasks(self):
def n_tasks(self) -> int:
"""Number of tasks in queue"""
return len(self._task_queue)

def schedule(self, batch):
def schedule(self, batch: Batch):
"""
Submit a batch of tasks to the scheduler.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_effects.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

import gzip
import math
from importlib.resources import path
Expand All @@ -15,10 +16,9 @@
# Fixture to load an example audio and return (array, sample rate)
@pytest.fixture(scope="module")
def wav():
with path(test_data, "sample.wav.gz") as p:
with gzip.open(p, "rb") as f:
sr, arr = wavfile.read(f)
return arr, sr
with path(test_data, "sample.wav.gz") as p, gzip.open(p, "rb") as f:
sr, arr = wavfile.read(f)
return arr, sr


@pytest.mark.parametrize(
Expand Down

0 comments on commit c81d318

Please sign in to comment.