- TO DO
- SEE ALSO
- COPYRIGHT AND LICENSE
MIDI::Ngram - Find the top repeated note phrases of a MIDI file
use MIDI::Ngram; my $mng = MIDI::Ngram->new( in_file => [ 'eg/twinkle_twinkle.mid' ], ngram_size => 3, patches => [qw( 68 69 70 71 72 73 )], random_patch => 1, bounds => 1, ); my $analysis = $mng->process; print Dumper $mng->net; my $playback = $mng->populate; $mng->write;
MIDI::Ngram parses a given list of MIDI files, finds the top repeated note phrases, outputs the analysis, transition network, and renders them to a MIDI file if desired.
Required. An ArrayRef of MIDI files to process.
Ngram phrase size.
The maximum number of phrases to analyze/play.
Beats per minute.
The note durations to choose from (at random).
[hn qn en]
The patches to choose from (at random) if given the random_patch option.
[0 .. 127]
MIDI output file.
Insert a rest of the given duration after each phrase.
'' (no resting)
ArrayRef of the channels to analyze. If not given, all channels are analyzed.
The number of times to choose a weighted phrase. * This only works with the weight option.
Boolean. Play phrases by their ngram repetition occurrence.
Boolean. Choose a random patch from patches for each channel.
0 (meaning "use the piano patch")
Boolean. Shuffle the non-weighted phrases before playing them.
Boolean. Allow single occurrence ngrams.
Boolean. Accumulate phrases onto a single channel.
Boolean. Include pitch range in the analysis.
The score object in "MAIN-ROUTINES" in MIDI::Simple. Constructed at runtime.
The hash-reference bucket of ngrams. Constructed by the process method.
A hash-reference ngram transition network. Constructed by the process method.
$mng = MIDI::Ngram->new(%arguments);
Create a new
$analysis = $mng->process;
Find all ngram phrases and return the note analysis.
$playback = $mng->populate;
Add notes to the MIDI score and return the playback notes.
Write out the MIDI file.
Preserve note durations instead of random assignment.
Gene Boggs <email@example.com>
This software is copyright (c) 2020 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.