NAME
MIDI::Bassline::Walk - Generate walking basslines
VERSION
version 0.0506
SYNOPSIS
use MIDI::Bassline::Walk;
my $bassline = MIDI::Bassline::Walk->new(verbose => 1);
my $notes = $bassline->generate('F7b5', 8);
$bassline = MIDI::Bassline::Walk->new(
verbose => 1,
guitar => 1,
wrap => 'C3',
modal => 1,
keycenter => 'Bb',
);
$notes = $bassline->generate('F7b5', 8);
# $score->n('qn', $_) for @$notes; # MIDI
DESCRIPTION
MIDI::Bassline::Walk
generates randomized, walking basslines.
Chords and the key use #
and b
for accidentals.
The "formula" implemented by this module is basically: "Play any notes of the chord, modal chord scale, or chord-root scale (and drop any notes replaced by extended jazz chords)."
The chords recognized by this module, are those known to Music::Chord::Note. Please see the source of that module for the list.
The logic and music theory implemented here, can generate some possibly 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.
ATTRIBUTES
guitar
$guitar = $bassline->guitar;
Transpose notes below E1
(midinum 28
) up an octave. This is the lowest note of a bass guitar in standard tuning.
Default: 0
wrap
$wrap = $bassline->wrap;
Transpose notes that are above this ISO pitch (e.g. C3), down an octave.
Default: 0
(do not wrap)
modal
$modal = $bassline->modal;
Maintain the key-center and only choose notes within a mode.
Default: 0
chord_notes
$chord_notes = $bassline->chord_notes;
Use unique chord notes that may possibly lie outside of the scale (e.g. b5
"flavor") for note choices.
Default: 1
keycenter
$keycenter = $bassline->keycenter;
The key-center for modal accompaniment.
Default: C
intervals
$intervals = $bassline->intervals;
Allowed intervals passed to Music::VoiceGen.
Default: [ -3 -2 -1 1 2 3 ]
octave
$octave = $bassline->octave;
Lowest MIDI octave.
Default: 1
scale
$scale = $bassline->scale->($chord);
The musical scale to use, based on a given chord (i.e. $_[0]
here).
Default if not modal:
sub { $_[0] =~ /^[A-G][#b]?m/ ? 'minor' : 'major' }
Otherwise, select the appropriate mode (ionian, dorian, phrygian, lydian, mixolydian, aeolian, locrian) given the named chord and the modal keycenter.
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 (unless the chord_notes attribute is 0
). The last walks only the notes of the chord (no scale).
tonic
$tonic = $bassline->tonic;
Play one of the first, third or fifth (I, III, V) notes of the scale on the first note of the generated phrase.
Default: 0
verbose
$verbose = $bassline->verbose;
Show progress.
Default: 0
METHODS
new
$bassline = MIDI::Bassline::Walk->new;
$bassline = MIDI::Bassline::Walk->new(
guitar => $guitar,
intervals => $intervals,
octave => $octave,
scale => $scale,
chord_notes => $chord_notes,
modal => $modal,
keycenter => $key_center,
verbose => $verbose,
);
Create a new MIDI::Bassline::Walk
object.
generate
$notes = $bassline->generate;
$notes = $bassline->generate($chord);
$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.
If the modal attribute is set, then the chosen notes will be within the modal scale given the keycenter setting. If it is not set (the default), notes will be chosen as if the key has changed to the current chord!
Defaults:
chord: C
n: 4
next_chord: undef
SEE ALSO
The t/ and eg/ programs
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2022 by Gene Boggs.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)