Converts guitar tabs (.txt) into audio (.wav)
Project description
tabs2music
Converts guitar tabs (.txt) into audio (.wav)
Getting started
- Run
pip install tabs2music
- Download a soundfont, such as this one
- You're done!
To use the library, you should use the run
function. The run
function takes the following parameters:
- tabs_path: a path to the .txt file containing the tabs input. The name of the file will be the song's name.
- audio_save_path: a path to the directory the .midi and .wav files will be saved to.
- soundfont_path: a path to the soundfont file.
- save_midi (optional, default=False): if True, the .midi file will be saved, otherwise it is deleted.
- play_midi (optional, default=False): if True, the .midi file will be played via the terminal on creation, otherwise nothing is played.
- tempo (optional, default=120): measured in bpm, changes the speed of the song.
Here is a minimal example that doesn't override the optional values:
run("/path/to/song.txt", "/path/to/save/", "/path/with/soundfont.sf2")
Here is an example that overrides all of the optional values:
run("/path/to/song.txt", "/path/to/save/", "/path/with/soundfont.sf2", save_midi=True, play_midi=True, tempo=200)
How to write a tabs file
Tuning a guitar string
Every guitar tab has six lines, one for each of the six strings on the guitar. However feel free to add more or less "strings", as the code doesn't care how many you want to add. Every string is written on its own line, and must follow a certain pattern, which can be split into two parts:
- The string's tuning: A string's tuning is defined by combing a note with an octave number (no spaces in between). So "E2", "G#3", and "Db4" are all valid tunings.
- The string's notes: After the string's tuning comes the notes to be played on the string. This section must begin with "|-", and must end with "-|", where the "|"s represent the start/end of a bar, and the "-"s provide a space in between every other note for easier reading. So a single bar in 4/4 might look like "|-1-2-3-4-|". To make more than one bar, you simply continue this pattern, like "|-1-2-3-4-|-2-3-4-5-|" for two bars.
Now lets put these two halves together. Here is an example of a string tuned to E2, the standard tuning used on the lowest guitar string, with enough notes for a bar in 4/4. Please note the formatting/spaces, it must be followed as well: "E2 |-1-2-3-4-|".
Allowed notation
Once you have defined a string, you can start writing notes to be played on that string. Each note is surrounded by a "-", which makes it a bit easier to read the tabs. This can already be seen above in the section Creating a guitar string. Here are the currently supported options:
- A number: When writing a number, this indicates the fret to play on the string.
- A note extension (
): After a note has been played (indicated by a number), each "" directly after it will extend the note for as many ""s used. Here is an example that plays an open low E for four beats: "E2 |-0----|". - A rest (-): This is used when neither a number or "~" are specified. It simply doesn't play anything on the string for a single beat.
Example tabs file
Copy and paste this into a .txt file, its the background guitar for "All in the Waiting" by Buckethead.
E4 |-3-----2-------2-|-3-----2-------2-|-2-----0-------0-|-2-----0-------0-|-2-----3-------3-|-2-----3-------3-|-3-----2-------2-|-3-----2-------2-|
B3 |---3-----3---3---|---3-----3---3---|---3-----3---3---|---3-----3---3---|---3-----3---3---|---3-----3---3---|---3-----3---3---|---3-----3---3---|
G3 |-----0-----0-----|-----0-----0-----|-----0-----0-----|-----0-----0-----|-----0-----0-----|-----0-----0-----|-----0-----0-----|-----0-----0-----|
D3 |-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|
A2 |-----------------|-----------------|-2-~-~-~-~-~-~-~-|-2-~-~-~-~-~-~-~-|-3-~-~-~-~-~-~-~-|-3-~-~-~-~-~-~-~-|-----------------|-----------------|
E2 |-3-~-~-~-~-~-~-~-|-3-~-~-~-~-~-~-~-|-----------------|-----------------|-----------------|-----------------|-3-~-~-~-~-~-~-~-|-3-~-~-~-~-~-~-~-|
Upcoming features:
- Enforce more things with the tab's construction
- a given bar is in the same time signature for all strings (equal length of notes)
- More note timing flexibility (ex: triplets)
- Need to add soundfont to support hammer ons (h), pull offs (p), sliding up (/) and down (\), bending up (b) and down (r), and vibrato (v)
- Capo
- When on the website, make tabs also downloadable
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tabs2music-0.0.6.tar.gz
.
File metadata
- Download URL: tabs2music-0.0.6.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f729234e74c53e675b2fc2dfb1ee0ea979ab0bf9d424ceb9aa5d35530b5e576 |
|
MD5 | 58c3acddbfdd60fd7878be6dd39f26ee |
|
BLAKE2b-256 | fc9a8da54db45040b96b73ac7a9856c2e05a50c7cfcc129d98e9f42e123de3d1 |
Provenance
The following attestation bundles were made for tabs2music-0.0.6.tar.gz
:
Publisher:
release.yaml
on yusefahmd/tabs2music
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
tabs2music-0.0.6.tar.gz
- Subject digest:
2f729234e74c53e675b2fc2dfb1ee0ea979ab0bf9d424ceb9aa5d35530b5e576
- Sigstore transparency entry: 146531699
- Sigstore integration time:
- Predicate type:
File details
Details for the file tabs2music-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: tabs2music-0.0.6-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1284499b83894f486d034f4c03602f3d11a2603fda0788e712567df7e25196ba |
|
MD5 | 061fb79c842612b8b6680d55775dab5f |
|
BLAKE2b-256 | 807d50e8412deddd8ef282fb7c0fdf39015cea31ad5ad11ac1fcdbfb4fb43d8f |
Provenance
The following attestation bundles were made for tabs2music-0.0.6-py3-none-any.whl
:
Publisher:
release.yaml
on yusefahmd/tabs2music
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
tabs2music-0.0.6-py3-none-any.whl
- Subject digest:
1284499b83894f486d034f4c03602f3d11a2603fda0788e712567df7e25196ba
- Sigstore transparency entry: 146531706
- Sigstore integration time:
- Predicate type: