Music::BachChoralHarmony - Parse the UCI Bach choral harmony data set
version 0.0100
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 ];
Music::BachChoralHarmony parses the UCI Bach choral harmony data set of 60 chorales.
Music::BachChoralHarmony
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.
jsbchorales.net
music21
See the eg/ programs for usage examples.
eg/
The local file where the Bach choral harmony data set resides.
Default: dist_dir()/jsbach_chorals_harmony.data
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
$bach = Music::BachChoralHarmony->new(%arguments);
Create a new Music::BachChoralHarmony object.
$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.
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
Dan Book (DBOOK) for the ShareDir clues.
Gene Boggs <gene@cpan.org>
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.
To install Music::BachChoralHarmony, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Music::BachChoralHarmony
CPAN shell
perl -MCPAN -e shell install Music::BachChoralHarmony
For more information on module installation, please visit the detailed CPAN module installation guide.