v0.67.0: the air horn done properly; djay-style loops; a gentler grab zoom
Air horn: the recording's first blast wobbles on a ~0.15 s cycle, so the old 0.30 s loop jumped every lap (the repeating beat). Held, it now loops exactly one cycle (found by self-similarity), levelled and crossfaded; a release crossfades into the recording's own ending, so a click is a short blast that trails off; each press cuts a still-sounding blast in 25 ms, so taps stay separate. Exact at any block size. Loops start on the nearest beat (djay's Quantize), and resizing a running loop keeps its start and keeps looping. Grabbing a waveform zooms out only a little, gently, and drags at the zoom it was grabbed at. The sync button just says Sync.
This commit is contained in:
+2
-45
@@ -48,7 +48,7 @@ class TestLoops:
|
||||
deck.render(1024)
|
||||
assert RATE <= deck.position < RATE + 11025 + 1024
|
||||
|
||||
def test_starts_on_the_next_beat_and_shows_its_size(self, shelf):
|
||||
def test_starts_on_the_nearest_beat_and_shows_its_size(self, shelf):
|
||||
a, _ = _pair(shelf)
|
||||
a.deck.position = RATE * 3.0
|
||||
shelf.set_loop(a, True)
|
||||
@@ -56,7 +56,7 @@ class TestLoops:
|
||||
beat = 60 / 124
|
||||
k = (start / RATE - 0.15) / beat
|
||||
assert k == pytest.approx(round(k), abs=1e-3) # on a beat
|
||||
assert start / RATE >= 3.0 - 1e-3 # the next one
|
||||
assert abs(start / RATE - 3.0) <= beat / 2 + 1e-3 # the nearest one (Round 97)
|
||||
assert (end - start) / RATE == pytest.approx(4 * beat, abs=1e-3)
|
||||
shelf.step_loop(a, -2) # 4 → 1 beat
|
||||
assert shelf.loop_sizes["A"].text() == "1"
|
||||
@@ -87,49 +87,6 @@ def test_the_overview_jumps(shelf):
|
||||
ov.grab() # paints without trouble
|
||||
|
||||
|
||||
class TestHorn:
|
||||
def _horn(self):
|
||||
x = (np.sin(np.arange(RATE * 2) / RATE * 2 * np.pi * 400) * 20000).astype(np.int16)
|
||||
return Horn(np.stack([x, x], axis=1))
|
||||
|
||||
def _drain(self, horn):
|
||||
total = 0
|
||||
while True:
|
||||
block = horn.render(1024)
|
||||
if block is None:
|
||||
return total / RATE
|
||||
total += len(block)
|
||||
|
||||
def test_a_tap_is_short(self):
|
||||
horn = self._horn()
|
||||
horn.press()
|
||||
horn.render(2205)
|
||||
horn.release()
|
||||
assert self._drain(horn) < 0.15
|
||||
|
||||
def test_holding_carries_the_note_even_after_taps(self):
|
||||
horn = self._horn()
|
||||
for _ in range(6):
|
||||
horn.press()
|
||||
horn.render(1024)
|
||||
horn.release()
|
||||
horn.render(1024)
|
||||
horn.press()
|
||||
for _ in range(int(3 * RATE / 1024)):
|
||||
block = horn.render(1024)
|
||||
assert np.abs(block).max() > 0.1 # still blaring at 3 s
|
||||
horn.release()
|
||||
assert self._drain(horn) < 0.15
|
||||
|
||||
def test_a_press_while_ringing_starts_a_new_blast(self):
|
||||
horn = self._horn()
|
||||
horn.press()
|
||||
horn.render(4410)
|
||||
horn.press()
|
||||
assert len(horn._voices) == 2 and horn._voices[0]["fading"]
|
||||
assert horn._voices[-1]["pos"] == 0
|
||||
|
||||
|
||||
def test_dj_mode_slides(qapp, tmp_path, monkeypatch):
|
||||
from lintunes.gui.main_window import MainWindow
|
||||
from lintunes.library_manager import LibraryManager
|
||||
|
||||
Reference in New Issue
Block a user