Hacker News new | past | comments | ask | show | jobs | submit login
Playing guitar tablatures in Rust (agourlay.github.io)
193 points by lukastyrychtr 3 months ago | hide | past | favorite | 87 comments



Super cool, great job. Looks like a really fun project. This really highlights why sheet notation is so much better at describing music than tablature. The advantage of tabs is that they tell you which version of the same note to play (You can play the same note in up to 6 places in the guitar). However, sheet notation tells you precisely the duration of each note, and can often include the intended articulation. Writing music is fascinating, here is an excellent breakdown of different systems which have been developed, and how they came to be: https://www.youtube.com/watch?v=Eq3bUFgEcb4


>However, sheet notation tells you precisely the duration of each note,

True but the reason that guitar tabs missing the duration of the notes is not much of a handicap compared to traditional sheet music notation is that the guitar players learning popular music already get the notes' durations from listening to the actual recordings.

This is the same reason that printing out the lyrics for songs don't require notations of durations for each syllable of every word. People singing karaoke or whatever already get the durations by hearing the recordings. (Indeed, lyrics sheets are also missing the pitch of each syllable.)

On the other hand, traditional notation was invented before recordings so musicians often had no idea what the music sounded like unless they correctly decoded the notes durations on the page.


That's a great point I'd never considered as a guitarist myself who uses both tabs and sheet music.

I think it also explains why in my last 2 years of playing flamenco I never found tabs, the rhythm is almost as hard to play by ear as the notes.


Yes, I already said this but you really hammered the point home with the additional analogy of karaoke lyrics. I feel people playing non-popular forms of music live in this ivory tower where they forget other forms of music exist. I wonder why it happens


While I agree that sheet notation is superior, it actually is fairly common to indicate duration and articulation in tablature, especially classical. See many of the tabs on classtab.org: https://www.classtab.org/tabbing.htm#key

Surprisingly (to me), tablature is apparently older than sheet music. Tabs are also pretty nice when you're dealing with non-standard tunings.

Lastly, even with standard notation, guitar music is often "unnecessarily" annotated with numbers for left hand fingering, roman numerals for barres, "pima" for the right hand, diamonds for harmonics, etc.


There are often several strings that could be usedeto play the same note. However getting the right one is important as they are not substitutable. Thus standard notation isn't enough.


> However, sheet notation tells you precisely the duration of each note

That's why "real" notation is displayed above the tabs or sometimes some other way is used to indicate duration, mostly space between two notes. That's also why it's hard to write an actual usable guitar tab GUI, it needs to display sheet notation too, with all of it's intricacies.


I think that neither notation is wholly superior, and your comment perfectly illustrates why. Sheet music notation tells you the tempo of the notes but gives no guidance on which way you should play them. Tabs tell you exactly how to finger the notes but don't (usually) tell you anything about tempo. Both notations are leaving out crucial info, and so neither is really superior to the other. It's a matter of which defect you are more willing to live with.


Sheet music often has fingering suggestions when adapted for a particular instrument. I say "suggestions" because on some instruments, like the guitar, there are multiple fingerings possible for the same note.

Which leads to something you didn't mention, that sheet music can be used with any instrument, whereas tablature is limited to not only a single instrument, but the specific combination of an instrument and a tuning.

In practice this means you won't be able to play a 6 string lute piece on modern guitar in standard tuning if all you have is the lute tablature.


Sheet music often gives fingering suggestions which make it clear which string to play it on. With fingerings though, there's no correct answer, and often you want to bias towards the best sound (to your taste) vs. the easiest finger execution.


Agreed, the video goes into depth in those tradeoffs.


The biggest advantage of guitar tabs is you don't need to be able to read music. You just need to know how to count. The timing is a non issue as most people will try and learn the song with a tab and a recording of the song.


Which is funny if you presume it is true that tabs precede standard notation (and therefore recording techniques).

Tabs make quite a bit of sense in a post recorded music culture. However, the information density you can get in standard sheet notation is far greater. There's tradeoffs.


Tablature does precede standard notation, by hundreds of years. In fact tabs are older than guitars and were heavily used for lute music.


For most people using tabs, the additional information is not needed as you are most of the time not aiming for an identical replica of the song. You might play it slower or faster, different key, remove sections, etc


On the other hand I think tabs actually do strive to be an actual replica of a song. That's why there are so many versions of the same tab that broadly sound the same, from people trying to get as close as they can by ear to the recording.


Powertabs or guitar pro files fix the tradeoffs at least. You get the sheet music for all instruments, tab, and midi instrument backing tracks to listen to in one view. And a metronome.


Assuming you’re talking about standard guitar with standard tuning system, no, there’s no notes that you can play in 6 different strings.

(But if you’re not talking about standard guitar, then don’t stop at 6, you can have more than that.)


Nit: if you count harmonics, you only need 14 frets to play high E on every string in standard tuning.


Harmonics should be denoted differently. For such notes, you can only play the same note on at most 3 different strings.


I wasn’t responding to the broader topic about music notation, only picking the nit on the claims about whether you can play the same note in six positions on a standard guitar in standard tuning. If you count harmonics— acknowledging one may not count them—but now I’ve repeated almost my entire comment.


If you have an ear then a harmonics should not be counted as the same note. To a layman, they probably can’t tell the difference between the same note from a different string. But it will be very obvious to even a layman a harmonics has a different quality.

That’s the reason they have a different notation. The notation is there to convey what we mean, not a nitpicking. To claim it is still the “same” even when the notation isn’t are really pushing what “the same” is. We might as well start to count the way one scratch on the string to be the same note if they gives the same fundamental.


My pedantry and your pedantry are totally orthogonal. You are, of course, correct in the pedantic points you’re making; the pedantic point I was making, however, was not intended to dispute or even discuss these points.

I could bring the points closer together, say by pointing out that fretted notes also exhibit harmonics; or that picking technique and position can significantly enhance or mask that fact. In so doing, there would certainly be much to dispute if I suggested without any qualification that any pronounced harmonic intonation is “the same” as any other intonation lacking the same pronounced harmonics.

But all of that is moot. I didn’t suggest any of those things. And I did include a qualification that invites you or anyone else to count or not count harmonics as you see fit!

You could just say “I don’t count harmonics”, and I would have no quarrel with that. But I do object to repeatedly conflating my point with points I both did not make and already clarified I did not make, to dispute something I am clearly not saying or even discussing.


It is not about counting harmonics or not, but what should be counted "the same".

We could have gone all formal here, musical theory and physics and all that. But I claimed that you can just tell by ears and use common sense.

What I was going for is accuracy. Someone made a quick comment that one could have played "the same note" on all 6 different strings, which aren't correct under closer inspection and reasonable assumption to define the context.

Similarly, if you include harmonics in the definition of "note" (while still hold the distinction that harmonics are different from normal notes), then still you cannot play "the same note" on all 6 strings, and in fact even lesser (for the same harmonics to be played on different strings) due to the constraints.

Interestingly, if you also include artificial harmonics, (again, while still hold the distinction between normal notes, harmonics, and artificial harmonics), then yes, you finally will be able to play the same note on all 6 strings, theoretically. One could argue whether we should consider harmonics and artificial harmonics the same, as they share different notations, and requires different techniques, but sounds the same to the ear. But either way there exists artificial harmonics that you can play on all 6 strings.

QED


Again, all of what you say checks out, but none is responsive to what I said. I appreciate your dedication to accuracy and I’ll leave it at that.


I suppose a lot depends on what we mean by standard. For example the number of frets varies. Classical guitars are usually 19, acoustics are typically up to 20, and electrics 21 or 22 but sometimes 24.

Those with 24 frets can play E4 on all six strings, but 24 frets is pretty uncommon so I can see an argument for calling those non-standard.

But how about a 22 fret electric with a whammy bar? Those are very common. The highest note on the 6th string without using the whammy bar would be D4. Can you pull on the whammy bar enough to raise that to E4?


The comment I replied to mention sheet notation, last I check we only use that with classical guitar.

(But even “classically”, there are other guitars with many more strings or other tuning systems, etc.)

Lastly, “standard” can be perceived as the most common guitar you can think of. It is very likely if you tell a random Joe go buy a guitar for their nephew, it will be 6 strings 19 frets with EADGBE tuning.


Guitar Pro tabs have time durations on every note (as described in the article), and can also be displayed in standard musical notation. It also has a whole host of articulation symbols, including the standard musical articulations (mezzoforte etc) as well as a bunch of guitar specific special articulations (e.g. artificial harmonics).

Printed guitar tab books also have durations and articulation symbols.

I agree that old fashioned ASCII art guitar tabs without durations aren't great.


some tab viewers do have the rhythm shown as well, just connected to a tab number. Though it might get confusing a bit but more than sheet music imo.


A lot of tabs will put the note length on the "beat" of the tab too.

You can see this in Tuxguitar IIRC.


You are missing the point of tabs. Sheet music people always do. I will explain it below:

- Tabs are meant for music you have the recordings of (so additional details can be obtained by listening to the song)

- Tabs are meant to be an easy way to play a song for people that might not be interested or have the resources to invest the time to learn sheet music


Neat project!

I've been using TuxGuitar for years and I hate the UI so much. The ergonomics around basic functionality like "loop this section" and "speed up / slow down the tempo" are so bad. I feel like it was designed by people who are only interested in writing tabs. The user experience for practice is so crappy. I'm sitting here with a guitar in my lap and I absolutely cannot be bothered to navigate some really poorly-laid out drop down menus just to do basic stuff. I want to have keys on the keyboard do all the basic stuff so it's just a single tap with one hand.

I looked into TuxGuitar's Java source...it's incredibly complicated for what it does. I literally had no idea how I'd alter to make it better or even extract part of it to make my own UI.

If the author reads this: more power to you! And one thing that would be very useful is to make the font REALLY BIG so that players can read it very easily. Squinting at TuxGuitar's default tiny font size sucks so much.


Sounds like you haven't really looked into TuxGuitar....

You can set custom keyboard shortcuts for most menu items, and setting loop and repeat points is pretty easy in my experience...


FYI my focus is solely playing tabs and I do like keyboard shortcuts :)

What kind of shortcuts would you be interested in?


Of the top of my head:

- Play / stop

- Increase / decrease speed

- Go to next section / riff / verse / chorus [1]

- Loop this phrase / riff / verse / chorus

- Turn off drums / bass / guitar tracks (i.e. isolate)

- Switch to click track mode[2]

[1] It'd be great if I could annotate part of the tab as a riff, phrase, or other section, give it a name, and then loop, repeat, jump around amongst riffs in a song (or even multiple songs).

[2] I've always wanted the ability to play a section of the tab as clicks (not notes), just to be able to hear and feel the intended rhythm of a section.


> Since TuxGuitar appears to be unmaintained

The development of TuxGuitar has recently resumed

https://github.com/helge17/tuxguitar


Thanks for the heads-up, I was not aware of this.


30 years ago (oh dear, that's got to be too long?) I wanted to print out a bunch of guitar tab from OLGA (the online guitar archive, probably kicked off the net many times since?), but that ascii format meant that when you shrank it to try to fit more on a page, you just ended up with empty space.

So I wrote this https://ctan.math.utah.edu/pub/ctan/tex-archive/support/psta... (linking to the manual not the code - the manual is itself a program using the code I wrote to do the formatting) - a thing for formatting guitar tab that _ran on our Apple LaserWriter_, because we had pretty much nothing else that could do graphics. I learned postscript to write this, and because I needed to do some diagrams for my PhD, and wrote it in a week... so it's rough. But after the first couple of days I realised, that not only could I get it to format tab typed in the format I could type quickest, but I could get it to parse the ascii tab and reformat it to fit on a page, with nicely drawn lines not minus signs.

It also does stuff like printing verses with chords annotated, chord tables, and suchlike.

I recall going back to this 10 or 15 years later and the output in ghostscript was fugly, but at the time, I got a message from someone who'd used it to publish a book of banjo music in New Zealand - because it was the only thing that handled variable numbers of strings that he'd found!

Of _purely historical_ interest, I wouldn't recommend plumbing the code for any insights, since like I say I was very new to the language, and the stuff I wrote in the manual with my opinions about code are fairly embarrassing. But hey, the past is past.



Owner of https://parture.org here; we should work together. Nice work!


This looks like a cool project, but I notice the date at the bottom is from 2020. Presumably it's still alive if you're posting about it, but how alive is it? (If you're comfortable sharing)


The website has indeed not been redeployed since then, but the Rust stack currently has the following and is still under development every day:

- decentralized server node for hosting scores

- sheet music rendering in browser using WASM with Rust port of VexFlow

- multiplayer live score editing using custom Rust CRDT impl

- search through node's data based on facets like duration, instruments, difficulty, tuning, etc (Meilisearch)

- MIDI playing through soundfonts and RustySynth

- parsing/importing of Guitar Pro files using Rust-port of pyguitarpro

- AI assistant for editing scores using LiveKit, ElevenLabs etc

- support for creating different sheet music editor sites using the WASM core for the frontend

And more to come.


As someone who has been dabbling with both guitar and Rust for a few years, this is very exciting. I'm looking forward to reading this post in full and digging into the app.

It's also the second time that iced has caught my attention today. The first was when I ran into an issue installing sniffnet on a new machine and had to revisit the docs. This led me to iced.rs and I eventually wound up playing with the Halo shader edit for a bit. It looks like a nice library and I'm itching to give it a try.


The very recently written pocket guide available at https://docs.iced.rs/iced/ is both a great little crash course on the library and a bit of an admonition. The disclaimer should really help either make you salivate to dive in or stay away entirely, depending on what you're looking for.


As somebody learning guitar and focused on fingerpicking... One of the things that bugs me about Ultimate Guitar tabs is that there are many places where it would help me better to learn to read the tabs if the relevant chord were displayed over the measures/notes. I'm not sure where you are going with your project, but I thought I'd just mention this since I spend a lot of time deciphering the tabs just to figure out what chord position my hand should be in.


Chord symbol, or chord shape? I'm guessing the latter, because that would tell you: put the left hand fingers in these places, and most of the rest of the tab for that measure would just be which of those notes you pick.


No, I really just want the chord name: C, F#, G/B, etc.


A lot of tabs do have them... Also you're not always picking notes from a chord, though I guess often you are.


You always are [picking notes from a chord]...or purposely omitting them.

c e g b d f a = CMaj13.

Missing/ 'passing' notes -

c# g# d# f# a#.


But that's not useful. So you're saying just put on a CMaj13 grip for playing anything in a scale to the OP? On your 7 string guitar?

EDIT: Also you have to be missing at least one note... CMaj7 had 4 notes + 13 ... c e g b + a (the 13th) so CMaj7/13 Add 4 ?

The OP (as I understand it) was wanting to be able to know what shape/grip to use for picking the relevant notes... I'm sure it can be done but you have to also find the position and reasonable shapes that fit the notes in the bar.


I’m not sure if you use Ultimate Guitar, but if so, go look up a simple fingerpicked song, like Helplessly Hoping, by Crosby Stills and Nash. If you look at the chords… well, that’s a straightforward view mostly for people interested in strumming. The chords are listed above the lyrics and the chord shapes are listed at the top. This is all relevant info.

Then look at the Pro tab. The fingerpicking patterns are shown, and which string/fret should be picked, but there’s no chord name listed when it would be helpful for somebody like me to see just a simple chord name above the measure as a cue for my fretboard hand without having to look at the individual plucked strings/frets spread over the measure to determine the chord. I hope that makes sense.

Sometime it might be a challenge to fit it, but there are many instances where it would be a helpful assist for reading the tab.


Yeah... I understood the ask ;)

In your example the tab is strictly finger-picking over chords since that's how the song goes but some tabs are lead guitar tabs which might be sliding from the 15th fret to the 3rd fret or other things that are not strictly picked from a chord shape. They might still be "from a chord" or "played over a chord" but when you play the tab you may or may not be using that shape at that position. It's still good to know what's the context so definitely having the chord is useful.

If I'm playing a song with a clear picking pattern over chords I might just learn the chords and strum them first and then learn the pattern or often the patterns are just standard and all you need is the chord chart.

I've definitely seen tabs with the chords on top, in Ultimate Guitar it depends on whoever transcribed it, random e.g.: https://tabs.ultimate-guitar.com/tab/misc-traditional/greens...


Tabs seem like they'd be great training material for LLMs and generative music. Does anyone know of projects attempting this?

Update: looks like some papers got into it last year:

Rock Guitar Tablature Generation via Natural Language Processing: https://arxiv.org/pdf/2301.05295

GTR-CTRL: Instrument and Genre Conditioning for Guitar-Focused Music Generation with Transformers: https://arxiv.org/abs/2302.05393


You may find this site interesting: https://folkrnn.org/tune/119105 Thing is tabs and other kinds of notation only capture a small part of the composition, often just the melody. So to generate "real" polyphonic music you need other kinds of data.


I don’t see how they’d be easier than midi.


Hey author here :)

Happy to answer any questions.


Why did you think Rust was the right tool for the job, and why not a language with a GC?


Rust is the language I am the most proficient at this point, so it was a natural choice for me.

Tuxguitar is written in Java and works perfectly fine TBH, even if Rust has clear advantages for high performance software it does not matter that much in this context.


Why would one prefer a language with a GC?

Iced is a great library if you are willing to put in the effort to learn it (as it's new and documentation is still mostly limited to examples)


> Why would one prefer a language with a GC?

One thing less to worry about.


Everything is a tradeoff. Iced is blazing fast, with a low memory footprint (~30MB binary), cross platform, extensible and pretty elegant if a bit challenging to learn.


Your job is to make your users happy. If you spend 2x the amount of time to build a blazing fast UI compared to a normal speed UI, then the question is if you maybe had better spent the time on things your users wanted, like features. Features are not everything, but code that is faster than necessary (or has lower memory footprint) just doesn't bring much to the table from the user's perspective, especially for UI programs. If you were writing an OS kernel or a browser, then maybe (probably even) Rust is a better choice.


> the question is if you maybe had better spent the time on things your users wanted, like features.

That question is for the author of the software alone to decide how they want to build their own software.


For audio software like this, using a GC-free language translates into reliable, stutter-free, low-latency playback, particularly on lower-power devices. A lot of JavaScript-based audio things I've tried, even really simple ones, become miserable experiences once GC pauses start consuming a lot of CPU. I think it's no surprise that GC'd languages are unpopular for audio applications!


But then you should also run it on a realtime OS.


No, why would you? Normal OSes are pretty good at doing reliable audio playback and recording, musicians wouldn't use them otherwise. They don't guarantee five-nines but who cares. They are unlikely to ruin your audio experience.


Yeah? Well, you know, that's just like uh, your opinion, man.


You just said that everything is a trade-off yourself ...


Awesome work! It would be super cool if this could somehow run as a WASM module. Was thinking I would then try to include it in Freetar [0], for example so it can be used to play the tablatures on a page like this: https://freetar.de/tab/joni-mitchell/a-case-of-you-chords-95...

[0] https://github.com/kmille/freetar/


Thanks, I did not know about Freetar!

TBH I have a lot of things to improve before thinking about this kind of interop.

But feel free to create an issue :)


Thanks for the great write-up. I've got an iced application that I wrote 3 years ago, and this has given me the motivation I needed to go update it


I sure do wish that there was an open source alternative to Rocksmith+ that would allow you to play tabs from Ultimate Guitar in a Rockband like presentation format, with scoring and learning tools like repetition and speed-up intervals.

RS+ is great for quickly memorizing new riffs and songs, but when they discontinued RS2014, they cut over to a yearly subscription service, AND made it incompatible with the tens of thousands of user-notated songs created with the old API. Just a lot of back catalog stuff now.

My 8yo niece is so disappointed she can’t use it learn Taylor Swift songs on the little Strat Mini I gifted her.


Try Soundslice (https://www.soundslice.com/), which has an speed training feature (https://www.soundslice.com/help/en/player/basic/286/speed-tr...).

It's not gamified like Rocksmith, but it's got an excellent learning and practice interface — for _any_ music you throw at it. You can import tabs you find online in various formats, and we recently added a PDF scanning feature as well. There's also a built-in tab editor.

Also, it works for sheet music (i.e., not just tabs), so you can use it with any instrument or voice that uses common western music notation.

(I help make the site — happy to answer questions)


Under 'plans', what does "Number of slices you can create" with a 'tick' instead of a number, mean. *getting back into guitar, am taking a look, thanks.


*replying to self.

On desktop, columns are 'unlimited'.


I have neither used Rocksmith nor my links, but I have found these on my guitar quest (not opensource).

https://tonelib.net/jam-overview.html https://yousician.com/guitar

But I have been interested in something like https://github.com/PolyMeilex/Neothesia for guitar.


The previous version still works and has a decent collection of (user made) Taylor Swift songs, though, doesn't it? Why not just use that?


Fantastic project! I loved it. The blog post is informational, and the video is impressive. I dont know nearly enough Rust to understand fully how it was developed, but as a guitar enthusiast who primarily uses tabs to learn new songs/tracks, I love this project!

Would love to see how this can be extended for general purpose tab player. That would be awesome.

Thanks!


Thanks for the kind words!

What do you mean exactly by "general purpose tab player"?


I clicked hoping to see Smoke on the Water mentioned, and there it was right at the start.


Window Defender don't allow the download of this file: ruxguitar-x86_64-pc-windows-msvc.zip. Detected trojan : Script/Phonzy.B!ml False positive ?


TBH I have no Windows machine to test this release binary.

However I can share with you the release script if you want to double check https://github.com/agourlay/ruxguitar/blob/master/.github/wo...


This is awesome, I sorta gave up learning/playing guitar because of the software tax. I can't wait to give this a try!


Watch the sparrow falling Gives new meaning to it all If not today nor yet tomorrow Then some other day


Sadly, those ASCII charts do nothing for me. I find them even worse than sheet music. At least I know how to read a sheet.


[flagged]


There's an edition every three years, so in the next six months we'll get a nice Rust 2024 fad :)


_ in Rust




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: