Code Sketch


full happy birthday song by sanavi pawar
By: Mhalsakant School
Category: Programming
clear()

// =====================================================
//     VIRTUAL STRINGS (ULTRA-LOUD HAPPY BIRTHDAY FULL)
// =====================================================

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

// -----------------------------------------------------
// UI Text Labels
// -----------------------------------------------------
val title = Picture {
    setPenColor(white)
    setPenFontSize(28)
    write("HAPPY BIRTHDAY")
}
title.setPosition(-120, 220)
draw(title)

val subtitle = Picture {
    setPenColor(ColorMaker.rgb(255, 180, 50))
    setPenFontSize(13)
    write("Playing automatic full birthday melody at maximum volume...")
}
subtitle.setPosition(-165, 190)
draw(subtitle)


// =====================================================
//        MATHEMATICALLY SPACED VISUAL 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) }
        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 BIRTHDAY ENGINE
// =====================================================

// Part 1: Happy Birthday to you melody
val part1Birthday = "C4i C4i D4q C4q F4q E4h " +     // Happy Birthday to you
                    "C4i C4i D4q C4q G4q F4h " +     // Happy Birthday to you
                    "C4i C4i C5q A4q F4q E4q D4q " + // Happy Birthday dear friend
                    "A#4i A#4i A4q F4q G4q F4h "     // Happy Birthday to you

// Part 2: May God Bless You traditional blessing verse
val part2Blessing = "Rq C4i C4i D4q C4q F4q E4h " +    // May God bless you now
                    "C4i C4i D4q C4q G4q F4h " +    // May God bless you now
                    "C4i C4i C5q A4q F4q E4q D4q " + // May God bless dear friend
                    "A#4i A#4i A4q F4q G4q F4w"     // May God bless you

// Complete combined full song notation mapped at absolute maximum volume
val fullBirthdaySong = "X[Volume]=16383 " + part1Birthday + part2Blessing

// Stacking 24 parallel tracks to push the acoustic guitar notes to their loudest possible volume
val birthdayScore = MusicScore(
    Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong),
    Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong),
    Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong),
    Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong),
    Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong),
    Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong), Melody("Guitar", fullBirthdaySong)
)

// Play all 24 audio layers at once on execution startup
playMusic(birthdayScore)