Skip to main content

how to play a chord on a stringed instrument

Project description

This package will help you determine how to play a chord on a stringed instrument. There are many sites dedicated to guitar or ukulele chords, but for some other instruments, chord tables are harder to find.

"Acordes" means "chords" in Spanish and Portuguese. Some of the possible pronunciations are [aˈkɔɦ.ʤis] (Brazilian Portuguese), [ɐˈkɔɾ.ðɨʃ] (European Portuguese), [aˈkoɾ.ðes] (Spanish).

Installation

You need Python 3.10 or later. Create a virtual environment with a tool of your choice, for example:

python3 -m venv ~/venvs/acordes

Then install the package with pip install acordes.

For convenient interactive usage, add a snippet to your shell configuration file (e.g. .bashrc if you use Bash), for example:

acordes () {
    . ~/venvs/acordes/bin/activate
    python -i -c 'from acordes import *'
}

Usage

>>> from acordes import Tuning
>>> charango = Tuning("G4 C5 E A4 E5")
>>> charango("C7")
----------------- C7 = <C E G A#> -----------------
0   1   2   3   4   5   6   7   8   9   10  11  12
E₅  .   .   G₅  .   .   A#₅ .   C₆  .   .   .   E₆
.   A#₄ .   C₅  .   .   .   E₅  .   .   G₅  .   .
E   .   .   G   .   .   A#  .   C   .   .   .   E
C₅  .   .   .   E₅  .   .   G₅  .   .   A#₅ .   C₆
G₄  .   .   A#₄ .   C₅  .   .   .   E₅  .   .   G₅
---------------------------------------------------
>>> braguinha = Tuning("D4 G4 B4 D5")
>>> braguinha("Em")
------------------- Em = <E G B> ------------------
0   1   2   3   4   5   6   7   8   9   10  11  12
.   .   E₅  .   .   G₅  .   .   .   B₅  .   .   .
B₄  .   .   .   .   E₅  .   .   G₅  .   .   .   B₅
G₄  .   .   .   B₄  .   .   .   .   E₅  .   .   G₅
.   .   E₄  .   .   G₄  .   .   .   B₄  .   .   .
---------------------------------------------------

output

Supported tuning descriptions are:

  • notes with octave numbers: D4 G4 B4 D5
  • octave-invariant notes: G C E A
  • mix of the two: G4 C5 E A4 E5

Octave-doubled strings are not supported. As a workaround, they can be notated without an octave or with only one of their octaves.

Supported chord descriptions are (examples with C as the root note):

  • with two notes: Cm(no5), C(no5), C5
  • with three notes: Cdim, Csus2, C, Cm, Csus4, Caug
  • with four notes: Cm6, C6, Cm7, CmM7, C7, CM7

If octave numbers are present in the tuning, the notes in the output are colored so that notes of the same color form a non-inverted chord.

The instruments module contains a few predefined tunings. For some instruments, there is only one tuning, for some there are many:

from acordes.instruments import balalaika
>>> from acordes.instruments import balalaika
>>> balalaika.academic("Em")
------------------- Em = <E G B> -------------------
0   1   2   3   4   5   6   7   8   9   10  11  12  
.   .   B₄  .   .   .   .   E₅  .   .   G₅  .   .   
E₄  .   .   G₄  .   .   .   B₄  .   .   .   .   E₅  
E₄  .   .   G₄  .   .   .   B₄  .   .   .   .   E₅  
----------------------------------------------------
>>> balalaika.folk("Em")
------------------- Em = <E G B> -------------------
0   1   2   3   4   5   6   7   8   9   10  11  12  
G₄  .   .   .   B₄  .   .   .   .   E₅  .   .   G₅  
E₄  .   .   G₄  .   .   .   B₄  .   .   .   .   E₅  
.   .   .   .   E₄  .   .   G₄  .   .   .   B₄  .   
----------------------------------------------------

It's often hard to decide whether a tuning is the tuning for some instrument. The list is incomplete and subjective. It's intended to be a helper, not a database. Still, if you see something obviously wrong, please report it.

There is also an optional fret_count argument:

In [1]: from acordes.instruments import vihuela, semistrunka

In [2]: semistrunka("C", fret_count=21)
------------------------------------- C = <C E G> --------------------------------------
0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  
.   .   E₄  .   .   G₄  .   .   .   .   C₅  .   .   .   E₅  .   .   G₅  .   .   .   .   
.   C₄  .   .   .   E₄  .   .   G₄  .   .   .   .   C₅  .   .   .   E₅  .   .   G₅  .   
G₃  .   .   .   .   C₄  .   .   .   E₄  .   .   G₄  .   .   .   .   C₅  .   .   .   E₅  
.   .   E₃  .   .   G₃  .   .   .   .   C₄  .   .   .   E₄  .   .   G₄  .   .   .   .   
.   C₃  .   .   .   E₃  .   .   G₃  .   .   .   .   C₄  .   .   .   E₄  .   .   G₄  .   
G₂  .   .   .   .   C₃  .   .   .   E₃  .   .   G₃  .   .   .   .   C₄  .   .   .   E₄  
.   .   E₂  .   .   G₂  .   .   .   .   C₃  .   .   .   E₃  .   .   G₃  .   .   .   .   
----------------------------------------------------------------------------------------

In [3]: vihuela("C", 7)
--------- C = <C E G> ----------
0   1   2   3   4   5   6   7   
E₄  .   .   G₄  .   .   .   .   
.   C₄  .   .   .   E₄  .   .   
G₄  .   .   .   .   C₅  .   .   
.   .   E₄  .   .   G₄  .   .   
.   .   .   C₄  .   .   .   E₄  
--------------------------------

output2

Development

Install (you should create an environment first): pip install -e .

Check types: mypy

Run a quick informal test: python -m acordes.example

Run formal tests: pytest

Related Projects

A browser version by formicant can be found here, its source code here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acordes-1.0.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acordes-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file acordes-1.0.0.tar.gz.

File metadata

  • Download URL: acordes-1.0.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for acordes-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0c485a6ab66ff9704ed113cedbfa2c207cae4680862cd65675111cfd0c76910d
MD5 de28fddae224c88b03d92cbdfdb50fa1
BLAKE2b-256 d79f800adab72033796a2f6bf69c9e9066e9e971988355111d8cc4fc20b0bdeb

See more details on using hashes here.

File details

Details for the file acordes-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: acordes-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for acordes-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 421219602a9e1d74157614fd2d2f37e01e803c43f8035925e29adfa289bf382f
MD5 bdcc805a0c923ef35d5b20378202b3b8
BLAKE2b-256 b625b7144b40ff2c0d152595ea42d210082577e1874e1b26145d78c35ec0cdf5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page