MIDI::Bassline::Walk - Generate walking basslines
version 0.0306
use MIDI::Bassline::Walk; my $bassline = MIDI::Bassline::Walk->new(verbose => 1); my $notes = $bassline->generate('C7b5', 8); # MIDI: # $score->n('qn', $_) for @$notes;
MIDI::Bassline::Walk generates randomized, walking basslines.
MIDI::Bassline::Walk
The "formula" implemented by this module is basically, "play any notes of the chord-root scale, plus the notes of the chord that may differ, minus the notes those replaced."
The logic (and music theory) implemented here, can generate some sour notes. This is an approximate composition tool, and not a drop-in bass player. Import rendered MIDI into a DAW and alter notes until they sound suitable.
The chords recognized by this module, are those known to Music::Chord::Note. Please see the source of that module for the list.
$guitar = $bassline->guitar;
Transpose notes below E2 (40) up an octave.
E2
40
Default: 0
0
$verbose = $bassline->intervals;
Allowed intervals passed to Music::VoiceGen.
Default: -3 -2 -1 1 2 3
-3 -2 -1 1 2 3
$octave = $bassline->octave;
Lowest MIDI octave.
Default: 2
2
$scale = $bassline->scale;
The musical scale to use, based on a given chord (i.e. $_[0] here).
$_[0]
Default: sub { $_[0] =~ /^[A-G][#b]?m/ ? 'minor' : 'major' }
sub { $_[0] =~ /^[A-G][#b]?m/ ? 'minor' : 'major' }
Alternatives:
sub { 'chromatic' } sub { $_[0] =~ /^[A-G][#b]?m/ ? 'pminor' : 'pentatonic' } sub { '' }
The first walks the chromatic scale no matter what the chord. The second walks either the major or minor pentatonic scale, plus the notes of the chord. The last walks only the notes of the chord (no scale).
$tonic = $bassline->tonic;
Play the first note of the scale on the first note of the generated phrase.
$verbose = $bassline->verbose;
Show progress.
$bassline = MIDI::Bassline::Walk->new; $bassline = MIDI::Bassline::Walk->new( guitar => $guitar, intervals => $intervals, octave => $octave, scale => $scale, verbose => $verbose, );
Create a new MIDI::Bassline::Walk object.
$notes = $bassline->generate; $notes = $bassline->generate($chord, $n); $notes = $bassline->generate($chord, $n, $next_chord);
Generate n MIDI pitch numbers given the chord.
If given a next_chord, perform an intersection of the two scales, and replace the final note of the generated phrase with a note of the intersection, if there are notes in common.
Defaults:
chord: C n: 4 next_chord: undef
The t/ and eg/ programs
Data::Dumper::Compact
Carp
List::Util
Music::Chord::Note
Music::Note
Music::Scales
Music::VoiceGen
Moo
strictures
namespace::clean
Gene Boggs <gene@cpan.org>
This software is Copyright (c) 2022 by Gene Boggs.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install MIDI::Bassline::Walk, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MIDI::Bassline::Walk
CPAN shell
perl -MCPAN -e shell install MIDI::Bassline::Walk
For more information on module installation, please visit the detailed CPAN module installation guide.