Compare commits

...

2 Commits

Author SHA1 Message Date
kennethreitz 0911947971 v0.40.2 — dial back master compressor
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 04:43:53 -04:00
kennethreitz c2f748d5f3 Dial back master compressor: raise threshold, cap makeup gain
Threshold 0.5 → 0.7 so more dynamics survive. Makeup gain capped
at 3x so sparse arrangements (solo singing bowl, etc.) don't get
over-amplified to clipping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 04:42:52 -04:00
5 changed files with 16 additions and 8 deletions
+6
View File
@@ -2,6 +2,12 @@
All notable changes to PyTheory are documented here.
## 0.40.2
- **Master compressor dialed back** — threshold raised from 0.5 to 0.7,
makeup gain capped at 3x. Sparse arrangements no longer get
over-amplified to clipping.
## 0.40.1
- **Singing bowl synth** — two variants: strike (mallet hit with chirp
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "pytheory"
version = "0.40.1"
version = "0.40.2"
description = "Music Theory for Humans"
readme = "README.md"
license = "MIT"
+1 -1
View File
@@ -1,6 +1,6 @@
"""PyTheory: Music Theory for Humans."""
__version__ = "0.40.1"
__version__ = "0.40.2"
from .tones import Tone, Interval
from .systems import System, SYSTEMS, TET
+7 -5
View File
@@ -2099,7 +2099,7 @@ def singing_bowl_strike_wave(hz, peak=SAMPLE_PEAK, n_samples=SAMPLE_RATE):
if mx > 0:
wave /= mx
return (peak * 0.8 * wave).astype(numpy.int16)
return (peak * wave).astype(numpy.int16)
def singing_bowl_ring_wave(hz, peak=SAMPLE_PEAK, n_samples=SAMPLE_RATE):
@@ -2146,7 +2146,7 @@ def singing_bowl_ring_wave(hz, peak=SAMPLE_PEAK, n_samples=SAMPLE_RATE):
if mx > 0:
wave /= mx
return (peak * 0.8 * wave).astype(numpy.int16)
return (peak * wave).astype(numpy.int16)
def _apply_envelope(samples, attack, decay, sustain, release, sample_rate=SAMPLE_RATE):
@@ -4679,7 +4679,7 @@ def _pan_to_stereo(mono, pan=0.0):
return stereo
def _master_compress(samples, threshold=0.5, ratio=4.0, attack=0.002,
def _master_compress(samples, threshold=0.7, ratio=4.0, attack=0.002,
release=0.05, makeup=True, limiter=True,
sample_rate=SAMPLE_RATE):
"""Master bus compressor with brick-wall limiter.
@@ -4734,11 +4734,13 @@ def _master_compress(samples, threshold=0.5, ratio=4.0, attack=0.002,
# Apply gain
compressed = samples * gain
# Makeup gain — bring the level back up
# Makeup gain — bring the level back up, but cap at 3x
# so sparse arrangements don't get over-amplified
if makeup:
peak = numpy.max(numpy.abs(compressed))
if peak > 0:
compressed = compressed / peak * 0.9
desired_gain = 0.9 / peak
compressed = compressed * min(desired_gain, 3.0)
# Brick-wall limiter — hard clip at 0.95
if limiter:
Generated
+1 -1
View File
@@ -690,7 +690,7 @@ wheels = [
[[package]]
name = "pytheory"
version = "0.40.1"
version = "0.40.2"
source = { editable = "." }
dependencies = [
{ name = "rich" },