Live data from Hacker News

Show HN: Generate guitar tablature using a constraint solver

github.com

11–20 of 28 posts

Re: Show HN: Generate guitar tablature using a constraint solver

#12

If you’re looking for a more practical algorithm: this problem can be formulated as a shortest path problem on the graph whose vertices are (n, fret, finger, string) tuples. A simple dynamic programming solution is to fill out a distance table whose entry distance[n, fret, finger, string] is the optimal cost of the prefix of the melody ending at note n, which can be computed as 0 if n = 1, or in terms of the entries…

How did you learn this. Math undergrad? Comp sci? Something else?

Re: Show HN: Generate guitar tablature using a constraint solver

#13
post #4

Author here. TablaZinc is a proof-of-concept tablature generator for fretted string instruments -- such as the guitar, bass, mandolin, banjo, etc. It is a week-end project that I started for two reasons: * As a software developer, I was looking for an original case study to learn constraint programming. * As a guitar player whot is not fluent reading sheet music, I was interested in a tool to rapidly convert existing…

Jesus, what's going on between -O3 and -O4? This type of a gain warrants investigation. Have you tried profiling both cases?

Re: Show HN: Generate guitar tablature using a constraint solver

#14

If you’re looking for a more practical algorithm: this problem can be formulated as a shortest path problem on the graph whose vertices are (n, fret, finger, string) tuples. A simple dynamic programming solution is to fill out a distance table whose entry distance[n, fret, finger, string] is the optimal cost of the prefix of the melody ending at note n, which can be computed as 0 if n = 1, or in terms of the entries…

How did you learn this. Math undergrad? Comp sci? Something else?

You would definitely cover some graph and dynamic programming algorithms in a good introductory algorithms course.

Re: Show HN: Generate guitar tablature using a constraint solver

#16

If you’re looking for a more practical algorithm: this problem can be formulated as a shortest path problem on the graph whose vertices are (n, fret, finger, string) tuples. A simple dynamic programming solution is to fill out a distance table whose entry distance[n, fret, finger, string] is the optimal cost of the prefix of the melody ending at note n, which can be computed as 0 if n = 1, or in terms of the entries…

I agree with that and I definitely will try.

As explained in the first comment, one of the motivations for the project was to learn constraint programming. The tablature generator could be a nice example to compare different paradigms and algorithms.

Re: Show HN: Generate guitar tablature using a constraint solver

#17
post #13
post #4

Author here. TablaZinc is a proof-of-concept tablature generator for fretted string instruments -- such as the guitar, bass, mandolin, banjo, etc. It is a week-end project that I started for two reasons: * As a software developer, I was looking for an original case study to learn constraint programming. * As a guitar player whot is not fluent reading sheet music, I was interested in a tool to rapidly convert existing…

Jesus, what's going on between -O3 and -O4? This type of a gain warrants investigation. Have you tried profiling both cases?

The authors of the Gecode solver could explain it better than me, but I think that -O3 and -O4 perform a first pass that pre-compute variable bounds and values, which could reduce the exploration space significantly.

Re: Show HN: Generate guitar tablature using a constraint solver

#18

You can also formulate the problem as a dynamic programming problem. Here's a Java repo I made back in college solving the simpler problem: given a tab, what's the easiest fingering to play it? https://github.com/twschiller/optimal-guitar . It works by modeling the (1) the difficulty of hand positions, and (2) transitions

Definitely. This could be the next step in my exploration of programming techniques to solve this problem. I will have a look at your implementation.

Re: Show HN: Generate guitar tablature using a constraint solver

#20
post #17
post #13

Earlier quoted context omitted.

Jesus, what's going on between -O3 and -O4? This type of a gain warrants investigation. Have you tried profiling both cases?

The authors of the Gecode solver could explain it better than me, but I think that -O3 and -O4 perform a first pass that pre-compute variable bounds and values, which could reduce the exploration space significantly.

That is about right. What happens at -O4 is that for every variable, the upper and lower bounds are tested, and if using the bound as the value for the variable would make the problem unsolvable, then that bound is discarded. For some problems, this can be very useful and reduce the time to find a solution significantly. For other problems, it might not find any value to remove, or the values removed might not help solution times at all. The -O5 level is the same, but instead of just testing boundary values for immediate failure, all values in the domain are tested.

As a side note, while MiniZinc uses Gecode for the optimization this is not actually anything special built-in to Gecode, it is just a usage of the library.

Post reply on HN