Skip to main content

Tone Transposer Library

Introduction

This is a library that takes a series of tones and transposes them into all 12 musical key signatures.

It is designed to help musicians analyze tone patterns on a piano.

Installation

Type the following command in the Terminal window to install:

pip install tonetransposer

Transposing

To use this library, first create a Transpose object. This takes in the name of a root note and a list of tones. This is an example of a C major triad:

t = Transpose("C",["C","E","G"])

Next, you can either print a quick summary to the output window of all transpositions:

t.print_positions()

Or you can return an iterable object, and cycle through and print them:

for p in t.get_all_positions():
    print(p.root_tone.get_note_name(),p.to_string())

This is an example of the output:

C | C, E, G
Db | Db, F, Ab
D | D, Gb, A
Eb | Eb, G, Bb
E | E, Ab, B
F | F, A, C
Gb | Gb, Bb, Db
G | G, B, D
Ab | Ab, C, Eb
A | A, Db, E
Bb | Bb, D, F
B | B, Eb, Gb

Notation

You can change the notation that is presented by passing a NoteNameType object value to the 'to_string()' method. Here are some values that can be passed: NoteNameType.Flat, NoteNameType.Sharp, NoteNameType.Enharmonic. Every method in the library defaults to 'Enharmonic' (i.e. showing both the sharp and flat) when no value is passed through.

print(p.root_tone.get_note_name(NoteNameType.Flat),p.to_string(NoteNameType.Flat))

Interval numbers

This demonstrates how to print the underlying intervals for a chord:

t = Transpose("C",["C","Eb","G","Bb"])
t.print_intervals()
['R', 'b3_#2', '5', 'b7_#6']

You can also iterate through these intervals using the 'get_intervals()' method:

t = Transpose("C",["C","Eb","G","Bb"])
for p in t.get_intervals(NoteNameType.Flat):
    print(p)
R
b3
5
b7

Grouping Transpositions

The library allows you to group the different transpositions by their shape on a piano keyboard.

t = Transpose("C",["C","Eb","G","Bb"])
t.print_key_pattern(NoteNameType.Flat)
wwww | 3 | D,E,A
wbwb | 2 | C,F
bwbw | 2 | Db,Gb
bbbb | 1 | Eb
wbww | 1 | G
bwbb | 1 | Ab
bbwb | 1 | Bb
wwbw | 1 | B

The first column indicates the pattern of white and black notes of each transposition. The second column indicates the number of transpositions that have that shape on the piano. The third column indicates which musical keys have that shape.

You can also iterate through the summary like so:

for s in t.get_key_pattern_summary(NoteNameType):
    print(s.key_pattern, s.count, s.root_notes)

By default, the summary is sorted descending by the count of shapes. However, you can change the sort order and also column that is sorted. This demonstrates the arguments you need to pass through to change the order:

for s in t.get_key_pattern_summary(NoteNameType.Flat,SortKeys.KeyPattern,Direction.Ascending):
    print(s.key_pattern, s.count, s.root_notes)
bbbb 1 Eb
bbwb 1 Bb
bwbb 1 Ab
bwbw 2 Db,Gb
wbwb 2 C,F
wbww 1 G
wwbw 1 B
wwww 3 D,E,A

Direction can only be 'Ascending' and 'Descending', however the columns for sorting can be any of the following:

SortKeys.KeyPattern, SortKeys.Count, SortKeys.WhiteCount, SortKeys.BlackCount

Metadata

Release files for tonetransposer 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tonetransposer 0.0.6
File Size Uploaded Provenance Actions
tonetransposer-0.0.6.tar.gz 10.8 kB Without provenance Details for tonetransposer-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tonetransposer 0.0.6
File Interpreter ABI Platform Actions
tonetransposer-0.0.6-py3-none-any.whl Python 3 none any Details for tonetransposer-0.0.6-py3-none-any.whl

Total release size: 21.0 kB

Release files / tonetransposer-0.0.6.tar.gz

Download URL tonetransposer-0.0.6.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
90ad27574fb17bf9350f522e3b9a9cb5948e8775e6be33a4a14316c3df8da917
BLAKE2b-256 checksum
How to use checksums
c2b1d3bab523e79b485e1798c6763d921d6a8699583089bb85542682fa57d169
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Release files / tonetransposer-0.0.6-py3-none-any.whl

Download URL tonetransposer-0.0.6-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2d4798df68503b28b21f5b58d7a04b55bfb0dac3d5a940a7e732afaeda9196c
BLAKE2b-256 checksum
How to use checksums
2137a891e92bf148f1b82876574a50f19825d70348847e5abbd49e53ba3a56ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Security for tonetransposer 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page