User Submitted CoyoteScript

Random Melody Generator

Author: Sander

Script Version: 2

Minimum CoyoteMIDI Build: 560

When ran, this script plays a random short melody.
				
					$scalemap = major: (0,2,4,5,7,9,11,12), minor: (0,2,3,5,7,8,10,12), lydian: (0,2,4,6,7,9,11,12), dorian: (0,2,3,5,7,9,10,12)
$scales = (mapkeys $scalemap)
$root = 65
$scalechoice = ($scales (random 1 (count $scalemap) true))
$scale = ($scalemap $scalechoice)
$scalesize = (count $scale)

indicator true R:240,G:165,B:110 60 50

$start = $root + ($scale (random 1 $scalesize true))
midi cc 64 127 true

$i = 0
$lastchord = -10
repeat (random 10 20)

    if (random 1 10) < 4 && ($i - $lastchord) > 2
        $chord = true
        $lastchord = $i

    else
        $chord = false

    $note = $root + ($scale  (random 1 $scalesize true))

    midi note $note (random 40 70) true

    if $chord
        $chord_offset = ($scale (random 1 $scalesize true)) - 12
        midi note ($note + $chord_offset) (random 50 80) true
        midi note ($note - 12 + $chord_offset) (random 60 90) true
        midi note ($note - 5 + $chord_offset) (random 70 100) true
    
    if $trigger && $trigger contains translationid
        animatetranslation ($trigger translationid)

    rest (1 / (random 1 4 true))
    midi note $note 0 true

    if $chord
        midi note ($note + $chord_offset) 0 true
        midi note ($note - 12 + $chord_offset) 0 true
        midi note ($note - 5 + $chord_offset) 0 true
        midi cc 64 0 true
        midi cc 64 127 true

    $i + 1

indicator false default default 50
midi cc 64 0 true
saverecording
				
			

16 downloads