diff --git a/src/tinysoundfont/__init__.py b/src/tinysoundfont/__init__.py index 6050a8b..aaaf8c6 100644 --- a/src/tinysoundfont/__init__.py +++ b/src/tinysoundfont/__init__.py @@ -1,2 +1,7 @@ -from .synth import Synth, SoundFontException -from .sequencer import Sequencer +from .synth import ( + Synth as Synth, + SoundFontException as SoundFontException, +) +from .sequencer import ( + Sequencer as Sequencer, +) diff --git a/src/tinysoundfont/__main__.py b/src/tinysoundfont/__main__.py index 6abd420..b96c16b 100644 --- a/src/tinysoundfont/__main__.py +++ b/src/tinysoundfont/__main__.py @@ -2,7 +2,7 @@ import sys import time -from .synth import Synth, SoundFontException +from .synth import Synth from .sequencer import Sequencer diff --git a/src/tinysoundfont/midi/__init__.py b/src/tinysoundfont/midi/__init__.py index 51b9791..a0cfc6c 100644 --- a/src/tinysoundfont/midi/__init__.py +++ b/src/tinysoundfont/midi/__init__.py @@ -175,7 +175,7 @@ def load_memory( event.t += delta_time event.persistent = persistent if filter is not None: - if filter(event) == True: + if filter(event): event = None # Check for None return value in filtered events, don't add if None if event is not None: diff --git a/src/tinysoundfont/sequencer.py b/src/tinysoundfont/sequencer.py index 4eac875..29d8b00 100644 --- a/src/tinysoundfont/sequencer.py +++ b/src/tinysoundfont/sequencer.py @@ -8,12 +8,11 @@ # from collections import deque -from typing import Callable, List, Optional +from typing import List from .synth import Synth from .midi import ( load, Event, - Action, NoteOn, NoteOff, ControlChange, diff --git a/test/example_midi_filter.py b/test/example_midi_filter.py index 4ad9089..de9ccb4 100644 --- a/test/example_midi_filter.py +++ b/test/example_midi_filter.py @@ -8,7 +8,7 @@ def filter_program_change(event): """Make all program changes go to preset 19""" match event.action: - case tinysoundfont.midi.ProgramChange(program): + case tinysoundfont.midi.ProgramChange(_program): event.action.program = 19 # Church organ seq = tinysoundfont.Sequencer(synth) diff --git a/test/test_synth.py b/test/test_synth.py index 3c2b1db..abe342e 100644 --- a/test/test_synth.py +++ b/test/test_synth.py @@ -75,7 +75,7 @@ def test_0(): def filter_program_change(event): """Make all program changes go to preset 40 (violin)""" match event.action: - case tinysoundfont.midi.ProgramChange(program): + case tinysoundfont.midi.ProgramChange(_program): event.program = 40 seq = tinysoundfont.Sequencer(synth) seq.midi_load("test/1080-c01.mid", filter=filter_program_change) @@ -90,7 +90,7 @@ def test_midi_generate(): import numpy as np synth = tinysoundfont.Synth() - sfid = synth.sfload("test/florestan-subset.sfo") + _sfid = synth.sfload("test/florestan-subset.sfo") seq = tinysoundfont.Sequencer(synth) seq.midi_load("test/1080-c01.mid")