Music notation ABC

Hi,

Do you know something about library for parse ABC music notation?

I want something or write something to load files containig mutliple ABC
tunes, organise then cherche for similar tunes in the files, create
listes of tunes from the files, sets of tunes and books of sets whith
index.

I leanr Ruby (beginner) and I think it’s a good thing o do for a
musician to work around is center of interests.

Here is a linl about ABC notation: http://www.walshaw.plus.com/abc/

Thanks for informations and afflicted to make you undergo my aglais.

-------- Original-Nachricht --------

Datum: Thu, 20 Dec 2007 00:01:05 +0900
Von: Lunatic D. [email protected]
An: [email protected]
Betreff: Music notation ABC

musician to work around is center of interests.

Here is a linl about ABC notation: http://www.walshaw.plus.com/abc/

Thanks for informations and afflicted to make you undergo my aglais.

Posted via http://www.ruby-forum.com/.

Hello,

welcome to Ruby :).
I couldn’t find any ready-made library for abc in Ruby.
But as the link you gave shows that the notation is done in ASCII
text, you can search that text for tune bits (=Strings) or
for Regular Expressions. These are patterns which allow you
to search for occurrences of many strings at the same time, e.g.,
you can search for all Strings having

“at least three, but at most
five occurrences of any of “a”,“b”,“c”, followed but a letter, which
is anything but “C” or “D”, then something arbitrary and a “c” at the
end.”

The corresponding Regexp is

reg=/[a-c]{3,5}[^CD].+c$/ . So, for

tune1=“CDEabcacdAAc”
tune2=“CDabcacdCCc”
ref1=reg.match(tune1)
ref2=reg.match(tune2)
p ref1[0] => “abcacdAAc”
p ref2[0] => “abcacdCCc”

There is more comprehensive information about what Regexps
can do for you here:

http://www.rubyist.net/~slagell/ruby/regexp.html
http://www.regular-expressions.info/ruby.html .

I know too little about music to say what similarity between
tunes might mean to a musician (… please tell me) , but I guess
it can somewhat be boiled down to the number of replacements
on tune1 to get to tune2 (possibly one needs to exclude some
tunes that are too awkward using a Regexp search first).

This is what Levenstein distance
(http://en.wikipedia.org/wiki/Levenshtein_distance)
and the diff/lcs algorithms do.

A Ruby implementation of Levenstein distance is here:

http://rubyforge.org/projects/text

Diff/LCS is implemented here:

http://raa.ruby-lang.org/project/diff-lcs/

Best regards,

Axel

Lunatic D. wrote:

Here is a linl about ABC notation: http://www.walshaw.plus.com/abc/

Thanks for informations and afflicted to make you undergo my aglais.

No, there isn’t any ABC notation package available AFAIK. But it would
be extremely easy to do one, since the format itself isn’t very advanced
or complicated.

If you want to do a ABC parser, you should make a header loader and a
tune loader. And for each loaded section in the header, do syntax check
of the input specific to that section. But before you begin, make sure
you are a master of regular expressions (as Axel already said), it’s the
foundation of parsing text.

FWIW, I’m writing a MusicXML library for Ruby. The package should be
available sometime very early next year as a gem.

Best regards,

Jari W.

Jari W. wrote:

FWIW, I’m writing a MusicXML library for Ruby. The package should be
available sometime very early next year as a gem.

ok, thanks to Axel and jari!

First you confirm that there is probably nothing about ABC in ruby and I
think it is a good thing to do this:)

Second a musicXML parser will be very interersting too:

ABC is generaly used by trad musician peoples and I hop that the stat of
the norm is certanly larger than the usage need. a musicXML parser will
permit to write some tools between the ABC world and tools like “finale”
ABC2musicXML and musiXML2ABC with the ability to choice the
granuralirity of details you want to get. Then there are tools to
complète graphicaly like “finale” or print directly from tune or tune
list if more simple… and there is “lilypond”…

Ok I retrn to ruby and regular expressions :wink:

regards,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs