Code Sketch


sanavi pawar
By: Mhalsakant School
Category: Programming
clear()

// =====================================================
//     ACOUSTIC STRINGS + AUTOMATIC HARRY POTTER
// =====================================================

// Dark studio background to focus completely on the acoustic strings
setBackground(ColorMaker.hsl(222, 0.40, 0.08))

// -----------------------------------------------------
// UI Text Labels
// -----------------------------------------------------
val title = Picture {
    setPenColor(white)
    setPenFontSize(28)
    write("HARRY POTTER STRINGS")
}
title.setPosition(-160, 220)
draw(title)

val subtitle = Picture {
    setPenColor(ColorMaker.rgb(230, 135, 45)) // Warm acoustic orange-brown accent text
    setPenFontSize(13)
    write("Playing automatic acoustic guitar melody at max volume...")
}
subtitle.setPosition(-175, 190)
draw(subtitle)


// =====================================================
//     MATHEMATICALLY SPACED VISUAL ACOUSTIC STRINGS
// =====================================================

val startX = -100
val startY = -140
val stringLen = 300
val spacing = 40
val clickPad = 12

var i = 0
repeat(6) {
    val string = Picture {
        setFillColor(ColorMaker.rgba(0, 0, 0, 0)); setPenColor(noColor)
        repeat(2) { forward(stringLen); right(90); forward(clickPad * 2); right(90) }
        // Displays the classic brass/bronze gradient tones of steel acoustic strings
        setPosition(clickPad, 0); setPenColor(ColorMaker.rgb(225, 185, 120)); setPenThickness(3.5 - (i * 0.4)); forward(stringLen)
    }
    string.setPosition(startX + (spacing * i) - clickPad, startY)
    draw(string)
    i = i + 1
}

invisible()


// =====================================================
//    ULTIMATE 24-LAYER ACOUSTIC HARRY POTTER ENGINE
// =====================================================

// Hedwig's Theme staccato melody notes mapped at absolute maximum volume
val hpMelody = "X[Volume]=16383 " +
    "B4h. E5q. G5i F#5q E5h B5q A5h. F#5h. " +
    "E5q. G5i F#5q D5h D#5q B4h. Rq " +
    "B4h. E5q. G5i F#5q E5h B5q D6h C6q G5h. " +
    "C6q. B5i A#5q G5h E5q G5h. B4w"

// Stacking 24 parallel tracks to force the acoustic guitar voice to maximum possible volume
val acousticScore = MusicScore(
    Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody),
    Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody),
    Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody),
    Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody),
    Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody),
    Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody), Melody("Guitar", hpMelody)
)

// Blow out all 24 audio channels at the exact same time on execution startup
playMusic(acousticScore)