The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Music::BachChoralHarmony - Parse the UCI Bach choral harmony data set

VERSION

version 0.0100

SYNOPSIS

  use Music::BachChoralHarmony;

  my $bach = Music::BachChoralHarmony->new;
  my $songs = $bach->parse;

  # show all the song ids:
  print Dumper [ keys %$songs ];

  # show all the song titles:
  print Dumper [ map{ $songs->{$_}{title} } keys %$songs ];

DESCRIPTION

Music::BachChoralHarmony parses the UCI Bach choral harmony data set of 60 chorales.

This module does a few simple things:

1. It turns the UCI CSV data into a perl data structure.

2. It converts the UCI YES/NO note specification into a bit string.

3. It combines the Bach BWV number, song title and key with the data.

The BWV and titles were collected from an old Internet Archive of jsbchorales.net. The keys were computed with a music21 program. Check out the links in the "SEE ALSO" section.

See the eg/ programs for usage examples.

ATTRIBUTES

data_file

The local file where the Bach choral harmony data set resides.

Default: dist_dir()/jsbach_chorals_harmony.data

key_title

The local file where the key signatures and titles for each song are listed by BWV number (with a few unfortunate gaps).

Default: dist_dir()/jsbach_BWV_keys_titles.txt

METHODS

new()

  $bach = Music::BachChoralHarmony->new(%arguments);

Create a new Music::BachChoralHarmony object.

parse()

  $songs = $bach->parse();

Parse the data_file and key_title files into a hash reference of each song keyed by the song id. Each song includes a BWV identifier, title, key and list of events. The event list is made of hash references with keys for the notes bit string, bass note, the accent value and the resonating chord.

SEE ALSO

Moo

Text::CSV

File::ShareDir

https://archive.ics.uci.edu/ml/datasets/Bach+Choral+Harmony

https://web.archive.org/web/20140515065053/http://www.jsbchorales.net/bwv.shtml

http://www.bach-chorales.com/BachChorales.htm

http://web.mit.edu/music21/

https://github.com/ology/Bach-Chorales/blob/master/bin/key.py

THANK YOU

Dan Book (DBOOK) for the ShareDir clues.

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.