Tayuya
A tool to generate guitar tabs from MIDI files
Live demo: midi.vipul.xyz
Installation
pip install tayuya
Usage
In [1]: from tayuya import MIDIParser
In [2]: mid = MIDIParser('sample.mid', track=0)
In [3]: mid.render_tabs()
Out[3]:
E-------------14--------------------------16--14----------14--------------
A-------------------------------------------------17--17------16--17--16--
D-16------16------16--16--16--16------16----------------------------------
G-----18--------------------------18--------------------------------------
B-------------------------------------------------------------------------
E-------------------------------------------------------------------------
Don't forget to set the track argument with the appropriate track number desired.
Get track numbers of all the tracks in the MIDI file
In [1]: from tayuya import MIDIParser
In [2]: mid = MIDIParser('sample.mid', track=0)
In [3]: mid.get_tracks()
Out[3]:
{0: 'Lead Guitar',
1: 'Rhthym Guitar Dist',
2: 'Acoustic Guitar',
3: 'Rhthym Guitar Clean & Dist',
4: 'Lead Guitar Fill',
5: 'Guitar Harmonics',
Advanced
MIDI
Get all notes played in the MIDI track
In [1]: mid = MIDIParser('sample.mid', track=0)
In [2]: mid.notes_played()
Out[2]:
[{'note': 'C#5', 'time': 18},
{'note': 'C#5', 'time': 30},
{'note': 'B4', 'time': 26},
{'note': 'C5', 'time': 0},
{'note': 'C5', 'time': 28},
{'note': 'C#5', 'time': 28},
{'note': 'C#5', 'time': 30}]
Get key of the track
In [1]: mid = MIDIParser('sample.mid', track=0)
In [2]: mid.get_key()
Tabs
Get all notes to play
You can use this example to generate all the notes to play with their string and fret positions.
In [1]: mid = MIDIParser('sample.mid', track=0)
In [2]: tabs = Tabs(notes=mid.notes_played(), key=mid.get_key())
In [3]: tabs.generate_notes(tabs.find_start())
Out[3]:
[('C#3', 5, 4),
('G#3', 4, 6),
('C#4', 3, 6),
('F4', 2, 6),
('B2', 6, 7),
('D#3', 5, 6),
('F#3', 4, 4),
('B3', 3, 4),
('D#4', 3, 8),
('F#2', 6, 2)]
Each tuple here is (note, string, fret)
How it works?
Here's a brief of how it works:
- Fetch a track from the MIDI file
- Find all the notes played and convert from MIDI code values to music notes
- Find a scale for the set of notes extracted
- Find the best position to play the extracted notes using the scale detected
Limitations
- Works only for guitar solos. Implementation for determination and rendering of chords is not done yet.
- Works only for standard tuning (E A D G B E)
TODO
- Render tabs using Lilypond or some GUI alternative
- Implement logic to determine and render chords
- Better the scale detection implementation
- Transposing
- Add way to handle non standard tuning
- More stringed instruments
LICENSE
Credits
Tayuya is made possible by following open source softwares:
The name
Tayuya (たゆや)
Metadata
Release files for tayuya 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tayuya-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for tayuya-0.0.4-py3-none-any.whl |
Release files / tayuya-0.0.4-py3-none-any.whl
| Download URL | tayuya-0.0.4-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60b1c51287a4b28a3eaa99fe628ed2c037db43432a3de72ff5b107c666b9f80f
|
|
BLAKE2b-256 checksum How to use checksums |
f64deb5ca3df6eacb023025e9bc739f9e2a44beebb4289cd2b1eff3d98894e50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.0
|
Security for tayuya 0.0.4
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.