Commit Graph

90 Commits

Author SHA1 Message Date
kennethreitz cceac40a88 Add Arabic and Japanese systems, guitar tuning presets, logo, systems docs
New systems:
- Arabic (Maqam): 10 maqamat (ajam, hijaz, nahawand, nikriz, saba, etc.)
  with Arabic solfège tone names (Do, Re, Mi, Fa, Sol, La, Si)
- Japanese: 6 pentatonic scales (hirajoshi, in, yo, iwato, kumoi, insen)
  and 2 heptatonic scales (ritsu, ryo)

Fretboard improvements:
- Fretboard.guitar() now accepts tuning parameter
- Built-in tunings: standard, drop d, open g, open d, open e, open a,
  dadgad, half step down
- Custom tuning via tuple: Fretboard.guitar(("E4", "B3", ...))
- Fretboard.bass(five_string=True) for 5-string bass

Docs:
- Add Musical Systems guide page with all 4 systems
- Add logo to docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 06:06:17 -04:00
kennethreitz da08d30e8d Add Indian classical (Hindustani) music system with 10 thaats
- 12 swaras: Sa, komal Re, Re, komal Ga, Ga, Ma, tivra Ma, Pa, komal Dha, Dha, komal Ni, Ni
- 10 thaats (parent scales): Bilawal, Khamaj, Kafi, Asavari, Bhairavi,
  Kalyan, Bhairav, Poorvi, Marwa, Todi
- Extends generate_scale to accept direct interval patterns
- Sa maps to C's pitch position (Sa4 = 261.63 Hz)
- 17 new tests for Indian system

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 06:00:00 -04:00
kennethreitz e79b3ac15e Add CNAME for pytheory.kennethreitz.org
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:53:59 -04:00
kennethreitz cb3fd4526a Fix docs build: mock sounddevice for environments without PortAudio
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:52:50 -04:00
kennethreitz 7229399135 Add GitHub Pages deployment for Sphinx docs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:51:55 -04:00
kennethreitz 0d740cd6fe Merge pull request #35 from kennethreitz/improvements
Fix music theory accuracy and core bugs
2026-03-22 05:49:33 -04:00
kennethreitz 3142872533 Add root Makefile with docs and test targets
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:48:54 -04:00
kennethreitz 4a77f9163e Add Sphinx documentation with alabaster theme
- User guide: quickstart, tones, scales, chords, fretboard, playback
- API reference: autodoc for all modules
- alabaster theme with Napoleon for Google/NumPy docstrings
- Update project description in pyproject.toml
- Add sphinx to docs dependency group

Build with: uv run --group docs sphinx-build -b html docs docs/_build/html

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:47:20 -04:00
kennethreitz 3d58f837a2 Fix CI: gracefully handle missing PortAudio, skip play tests
- Make play module import optional in __init__.py (PortAudio may not
  be installed in CI environments)
- Skip wave generation and synth tests when PortAudio unavailable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:43:29 -04:00
kennethreitz cd8ace3020 Add Pythonic API improvements across the library
Tone:
- Add + operator for semitone addition (C4 + 7 → G4)
- Add - operator for subtraction and interval measurement (G4 - C4 → 7)
- Add <, <=, >, >= comparison by pitch frequency
- Add str() support (str(tone) → "C4")
- Add .frequency property as shorthand for .pitch()
- Tones are now sortable: sorted([G4, C4, E4]) works

Scale:
- Add iteration: for tone in scale
- Add len(): len(scale) → 8
- Add "in" operator: "C" in scale, tone in scale
- Add .note_names property
- Add .chord(*degrees) to build chords from scale degrees
- Add .triad(root) to build triads with octave wrapping

Chord:
- Add iteration: for tone in chord
- Add len(): len(chord) → 3
- Add "in" operator: "C" in chord

Fretboard:
- Add .guitar() classmethod for standard tuning
- Add .bass() classmethod for standard bass tuning
- Add .ukulele() classmethod for standard ukulele tuning
- Add iteration and len()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:42:29 -04:00
kennethreitz fde1011194 Expand test suite to 178 tests and fix additional bugs
- Add pytest as dev dependency in pyproject.toml
- Fix sawtooth_wave: numpy.linspace requires int for num parameter
- Fix Scale.degree() lookup by name ("tonic", "dominant") was broken
- Add tests for: Tone.from_tuple, from_index, _index, error paths,
  multi-octave arithmetic, descending chromatic walk, all pitch frequencies,
  Pythagorean temperament, all scale degrees by Roman numeral and name,
  Scale repr/slice/degrees mismatch, TonedScale repr/get/with-Tone-object,
  D/F/A/E/B major/minor scales, D Dorian, G Mixolydian, octave boundary
  crossing, all mode intervals including Phrygian/Aeolian/Locrian/Ionian,
  chord intervals/beat_pulse/empty chord, Chord/Fretboard fingering errors,
  all NamedChord qualities (m6/m9/maj9/9), fix_fingering, flat-to-sharp
  conversion, charts total count, charts_for_fretboard, all wave generators,
  wave output types, Synth with real pitches, circle of fifths/fourths,
  relative minor equivalence, enharmonic equivalence in scales, I-IV-V
  progression integration test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:39:12 -04:00
kennethreitz bc8dede856 Add CI workflow with pytest across Python 3.10-3.13
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:35:12 -04:00
kennethreitz dff12678ba Fix music theory accuracy and core bugs across the library
- Fix Tone.__init__ overwriting explicit octave kwarg when parsing name
- Fix Tone.__eq__ calling names as attribute instead of method, add __hash__
- Fix octave arithmetic to use C-based boundaries (scientific pitch notation)
- Fix pitch() to account for octave (was ignoring it entirely)
- Fix modal scale generation: modes were overwritten due to DEGREES loop bug
- Fix modal offset rotation off-by-one in generate_scale
- Fix scales._scales property being called as function
- Fix chord intervals: major/minor thirds were swapped, added missing chord tones
- Remove broken duplicate NamedChord class in chords.py
- Expand test suite from 11 to 83 tests covering tones, scales, modes, chords,
  pitches, fingerings, and intervals

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 05:34:11 -04:00
kennethreitz 43f7271394 Create FUNDING.yml 2024-11-17 06:28:04 -05:00
kennethreitz f93a6127ba Delete .github/FUNDING.yml 2024-11-05 11:21:15 -05:00
kennethreitz 98ea64640d Refactor hello.py to rename it to examples/chord_charts.py and improve chord chart display and playback 2024-11-05 11:20:43 -05:00
kennethreitz 1e31196e19 Bump version to 0.2.0 in pyproject.toml 2024-11-05 10:54:11 -05:00
kennethreitz 399c517226 Refactor hello.py to display standard guitar chord charts and add C minor chord playback 2024-11-05 10:52:48 -05:00
kennethreitz 08d14b0802 Refactor hello.py to display standard guitar chord charts 2024-11-05 10:38:41 -05:00
kennethreitz 3ca8f541c8 Refactor imports to optimize module usage 2024-11-05 10:29:33 -05:00
kennethreitz 44c1ea8ec6 Refactor hello.py to add C minor chord playback 2024-11-05 10:29:28 -05:00
kennethreitz 658659ca7b Refactor play.py to add play function for playing tones or chords 2024-11-05 10:22:51 -05:00
kennethreitz ad390467b9 Refactor play.py to add triangle_wave function for triangle wave synthesis 2024-11-05 10:22:34 -05:00
kennethreitz e902228912 Refactor Chord class to add fingering method for custom chord positions 2024-11-05 10:16:31 -05:00
kennethreitz 71e78934ee Refactor Chord class to calculate beat pulse between tones 2024-11-05 10:02:54 -05:00
kennethreitz 76f16938d6 Refactor chord and tone classes for improved readability and maintainability 2024-11-05 09:59:00 -05:00
kennethreitz 91b25e22d1 Update project dependencies: Replace pygame with sounddevice 2024-11-05 09:50:23 -05:00
kennethreitz b1edecc291 refactor: Update .gitignore to ignore pytheory.egg-info 2024-11-05 09:48:49 -05:00
kennethreitz 27a46fa9be refactor: Update project dependencies and package structure 2024-11-05 09:48:35 -05:00
kennethreitz cb6ec2e6d1 Remove Makefile 2024-11-05 09:47:15 -05:00
kennethreitz 442ff56df4 refactor: Ignore Python cache files in .gitignore 2024-11-05 09:46:29 -05:00
kennethreitz c200101a5f refactor: Update project dependencies
- Remove Pipfile and add pyproject.toml
- Update project dependencies in pyproject.toml
2024-11-05 09:46:09 -05:00
kennethreitz af1a9b2f74 chore: Add Fretboard class for creating guitar fretboards 2024-07-28 23:59:06 -04:00
kennethreitz c3e085e441 feat: Add dissonance calculation to Chord class 2024-07-25 19:32:41 -04:00
kennethreitz bfef3f5b2c refactor: add harmony calculation to Chord class 2024-07-25 19:27:01 -04:00
kennethreitz 99d5a57f77 Update FUNDING.yml 2024-02-08 17:54:27 -05:00
kennethreitz 3135c09708 pipfile, pipfile.lock 2023-12-13 09:16:56 -05:00
kennethreitz 97243de7b8 Merge pull request #33 from kennethreitz/dependabot/pip/mpmath-1.3.0
Bump mpmath from 1.2.1 to 1.3.0
2023-12-13 09:14:08 -05:00
dependabot[bot] 035cb0837a Bump mpmath from 1.2.1 to 1.3.0
Bumps [mpmath](https://github.com/fredrik-johansson/mpmath) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/fredrik-johansson/mpmath/releases)
- [Changelog](https://github.com/mpmath/mpmath/blob/master/CHANGES)
- [Commits](https://github.com/fredrik-johansson/mpmath/compare/1.2.1...1.3.0)

---
updated-dependencies:
- dependency-name: mpmath
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 16:26:17 +00:00
kennethreitz 39aa185f19 Merge pull request #27 from monovon/patch-1
Fix: minor language mistake
2022-07-10 09:39:19 -04:00
kennethreitz 219fc1cda2 Merge pull request #30 from barseghyanartur/patch-1
Correct link to the gist
2022-07-10 09:39:00 -04:00
kennethreitz 46bd28262a Merge pull request #29 from kennethreitz/dependabot/pip/py-1.10.0
Bump py from 1.6.0 to 1.10.0
2022-07-10 09:38:48 -04:00
kennethreitz 052370f563 Merge pull request #28 from monovon/patch-2
Add: Added min9 and Maj9 chords
2022-07-10 09:38:27 -04:00
Artur Barseghyan 095e9fe477 Correct link to the gist
Correct link to the gist to generate charts for all known chords
2021-05-29 00:52:59 +02:00
dependabot[bot] b2bc389cad Bump py from 1.6.0 to 1.10.0
Bumps [py](https://github.com/pytest-dev/py) from 1.6.0 to 1.10.0.
- [Release notes](https://github.com/pytest-dev/py/releases)
- [Changelog](https://github.com/pytest-dev/py/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/py/compare/1.6.0...1.10.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-20 17:32:37 +00:00
monovon 393349814b Add: Added min9 and Maj9 chords
I don't know when adding the "self.tone.add(9)" chord if it adds a major 9 or a minor 9 on it.
2021-01-13 16:06:07 +03:00
monovon c107f29fdb Fix: minor language mistake 2021-01-13 15:31:36 +03:00
kennethreitz 4d67cc4325 Create FUNDING.yml 2020-12-22 02:27:52 -05:00
Mason Egger ac2f52460a Merge pull request #26 from stephenjaya99/add-make-install
add make install command
2020-10-02 11:52:10 -05:00
Stephen Jaya 0b80c9f98d add make install command 2020-10-02 23:43:48 +07:00