Quick actions

cmd+k|ctrl+k

Navigation

Languages

confusing wizardry song remake

Snippet info

Language

Lua

Visibility

public

Author

dinoturto

Created

2023-09-20T04:14:23.818695Z

Updated

2023-12-30T04:08:35.427123Z

local owner = game.Players.Dinoturto
local random = Random.new()
local soundTable = {
    ["Bass"] = {};
    ["Ping"] = {};
    ["Snap"] = {}
}

local currentBass = 1
local currentPing = 1
local currentSnap = 1

for i = 1, 3 do
    for s = 1, 6 do
        local sEffect = Instance.new("Sound")
        sEffect.Volume = 1.4
        sEffect.Parent = owner.Character.Torso
        
        if i == 1 then
            sEffect.SoundId = "rbxasset://sounds/bass.mp3"
            table.insert(soundTable["Bass"], sEffect)
        elseif i == 2 then
            sEffect.SoundId = "rbxasset://sounds/electronicpingshort.wav"
            table.insert(soundTable["Ping"], sEffect)
        elseif i == 3 then
            sEffect.SoundId = "rbxasset://sounds/snap.mp3"
            table.insert(soundTable["Snap"], sEffect)
        end
    end
end

function playSound(s, p, v)
    if s == "bass" then
        currentBass = currentBass + 1
        if currentBass > #soundTable["Bass"] then
            currentBass = 1
        end
        
        local sound = soundTable["Bass"][currentBass]
        sound.TimePosition = 0.12
        sound.Pitch = p
        sound.Volume = v
        sound.Playing = true
        return sound
    elseif s == "ping" then
        currentPing = currentPing + 1
        if currentPing > #soundTable["Ping"] then
            currentPing = 1
        end
        
        local sound = soundTable["Ping"][currentPing]
        sound.TimePosition = 0.2
        sound.Pitch = p
        sound.Volume = v
        sound.Playing = true
        return sound
    elseif s == "snap" then
        currentSnap = currentSnap + 1
        if currentSnap > #soundTable["Snap"] then
            currentSnap = 1
        end
        
        local sound = soundTable["Snap"][currentSnap]
        sound.TimePosition = 0.2
        sound.Pitch = p
        sound.Volume = v
        sound.Playing = true
        return sound
    end
end

local sounds = {
    ["NightSong"] = {
        ["Tempo"] = 260;
        ["Patterns"] = {
            [1] = {
                [1] = {
                    [1] = {1.55, 0.2};
                    [2] = {0.9, 2}
                };
                [2] = {
                    [1] = {1.55, 0.4};
                    [2] = {1, 2}
                };
                [3] = {
                    [1] = {1.55, 0.6};
                    [2] = {1.075, 2};
                    [3] = {4, 1}
                };
                [4] = {
                    [1] = {1.55, 0.8};
                    [2] = {1.2, 2}
                };
                [5] = {
                    [1] = {1.55, 1};
                    [2] = {1.35, 2}
                };
                [6] = {
                    [1] = {1.55, 1.2};
                    [2] = {1.425, 2}
                };
                [7] = {
                    [1] = {1.55, 1.4};
                    [2] = {1.6, 2};
                    [3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.55, 1.6};
                    [2] = {1.7, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [2] = {
                [1] = {
                    [1] = {1.55, 1.6};
                    [2] = {1.8, 2}
                };
                [2] = {
                    [1] = {1.55, 1.4};
                    [2] = {1.6, 2}
                };
                [3] = {
                    [1] = {1.55, 1.2};
                    [2] = {1.425, 2};
                    [3] = {1.35, 2}
                };
                [4] = {
                    [1] = {1.55, 1};
                    [2] = {1.35, 2}
                }
            };
            [3] = {
                [1] = {
                    [1] = {1.55, 0.8};
                    [2] = {1.2, 2}
                };
                [2] = {
                    [1] = {1.55, 0.6};
                    [2] = {1.05, 2}
                };
                [3] = {
                    [1] = {1.55, 0.4};
                    [2] = {1, 2};
                    [3] = {1.5, 1.5}
                };
                [4] = {
                    [1] = {1.55, 0.2};
                    [2] = {0.9, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [4] = {
                [1] = {
                    [1] = {1.55, 0.8};
                    [2] = {2.4, 2}
                };
                [2] = {
                    [1] = {1.55, 0.6};
                    [2] = {2.1, 2}
                };
                [3] = {
                    [1] = {1.55, 0.4};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
                [4] = {
                    [1] = {1.55, 0.2};
                    [2] = {1.8, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [5] = {
                [1] = {
                    [1] = {1.225, 0.2};
                    [2] = {0.7, 2}
                };
                [2] = {
                    [1] = {1.225, 0.4};
                    [2] = {0.8, 2}
                };
                [3] = {
                    [1] = {1.225, 0.6};
                    [2] = {0.9, 2};
                    [3] = {4, 1}
                };
                [4] = {
                    [1] = {1.225, 0.8};
                    [2] = {1, 2}
                };
                [5] = {
                    [1] = {1.225, 1};
                    [2] = {1.05, 2}
                };
                [6] = {
                    [1] = {1.225, 1.2};
                    [2] = {1.2, 2}
                };
                [7] = {
                    [1] = {1.225, 1.4};
                    [2] = {1.35, 2};
                    [3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.225, 1.6};
                    [2] = {1.425, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [6] = {
                [1] = {
                    [1] = {1.225, 1.6};
                    [2] = {1.425, 2}
                };
                [2] = {
                    [1] = {1.225, 1.4};
                    [2] = {1.35, 2}
                };
                [3] = {
                    [1] = {1.225, 1.2};
                    [2] = {1.2, 2};
                    [3] = {4, 1}
                };
                [4] = {
                    [1] = {1.225, 1};
                    [2] = {1.05, 2}
                }
            };
            [7] = {
                [1] = {
                    [1] = {1.225, 0.8};
                    [2] = {1, 2}
                };
                [2] = {
                    [1] = {1.225, 0.6};
                    [2] = {0.9, 2}
                };
                [3] = {
                    [1] = {1.225, 0.4};
                    [2] = {0.8, 2};
                    [3] = {1.5, 1.5}
                };
                [4] = {
                    [1] = {1.225, 0.2};
                    [2] = {0.7, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [8] = {
                [1] = {
                    [1] = {1.225, 0.8};
                    [2] = {2.4, 2}
                };
                [2] = {
                    [1] = {1.225, 0.6};
                    [2] = {2.1, 2}
                };
                [3] = {
                    [1] = {1.225, 0.4};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
                [4] = {
                    [1] = {1.225, 0.2};
                    [2] = {1.8, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [9] = {
                [1] = {
                    [1] = {1.0375, 0.2};
                    [2] = {1.2, 2}
                };
                [2] = {
                    [1] = {1.0375, 0.4};
                    [2] = {1.05, 2}
                };
                [3] = {
                    [1] = {1.0375, 0.6};
                    [2] = {1, 2};
                    [3] = {4, 1}
                };
                [4] = {
                    [1] = {1.0375, 0.8};
                    [2] = {0.9, 2}
                };
                [5] = {
                    [1] = {1.0375, 1};
                    [2] = {2.4, 2}
                };
                [6] = {
                    [1] = {1.0375, 1.2};
                    [2] = {2.1, 2}
                };
                [7] = {
                    [1] = {1.0375, 1.4};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.0375, 1.6};
                    [2] = {1.8, 2};
                    [3] = {1.5, 1.5}
                };
                [9] = {
                    [1] = {1.0375, 1.6};
                    [2] = {1.2, 2}
                };
                [10] = {
                    [1] = {1.0375, 1.4};
                    [2] = {1.05, 2}
                };
                [11] = {
                    [1] = {1.0375, 1.2};
                    [2] = {1, 2};
                    [3] = {4, 1}
                };
                [12] = {
                    [1] = {1.0375, 1};
                    [2] = {0.9, 2}
                };
                [13] = {
                    [1] = {1.0375, 0.8};
                    [2] = {2.4, 2}
                };
                [14] = {
                    [1] = {1.0375, 0.6};
                    [2] = {2.1, 2}
                };
                [15] = {
                    [1] = {1.0375, 0.4};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
                [16] = {
                    [1] = {1.0375, 0.2};
                    [2] = {1.8, 2};
                    [3] = {1.5, 1.5}
                }
            };
            [10] = {
                [1] = {
                    [1] = {1.15, 0.2};
                    [2] = {1.35, 2}
                };
                [2] = {
                    [1] = {1.15, 0.4};
                    [2] = {1.2, 2}
                };
                [3] = {
                    [1] = {1.15, 0.6};
                    [2] = {1.15, 2};
                    [3] = {4, 1}
                };
                [4] = {
                    [1] = {1.15, 0.8};
                    [2] = {1, 2}
                };
                [5] = {
                    [1] = {1.15, 1};
                    [2] = {2.7, 2}
                };
                [6] = {
                    [1] = {1.15, 1.2};
                    [2] = {2.4, 2}
                };
                [7] = {
                    [1] = {1.15, 1.4};
                    [2] = {2.3, 2};
                    [3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.15, 1.6};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
                [9] = {
                    [1] = {1.15, 1.6};
                    [2] = {1.35, 2}
                };
                [10] = {
                    [1] = {1.15, 1.4};
                    [2] = {1.2, 2}
                };
                [11] = {
                    [1] = {1.15, 1.2};
                    [2] = {1.15, 2};
                    [3] = {4, 1}
                };
                [12] = {
                    [1] = {1.15, 1};
                    [2] = {1, 2}
                };
                [13] = {
                    [1] = {1.15, 0.8};
                    [2] = {2.7, 2}
                };
                [14] = {
                    [1] = {1.15, 0.6};
                    [2] = {2.4, 2}
                };
                [15] = {
                    [1] = {1.15, 0.4};
                    [2] = {2.3, 2};
                    [3] = {1.5, 1.5}
                };
                [16] = {
                    [1] = {1.15, 0.2};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
            };
            [11] = {
                [1] = {
                    [1] = {1.15, 0.2};
                    [2] = {1.35, 2}
                };
                [2] = {
                    [1] = {1.15, 0.4};
                    [2] = {1.2, 2}
                };
                [3] = {
                    [1] = {1.15, 0.6};
                    [2] = {1.15, 2};
                    [3] = {4, 1}
                };
                [4] = {
                    [1] = {1.15, 0.8};
                    [2] = {1, 2}
                };
                [5] = {
                    [1] = {1.15, 1};
                    [2] = {2.7, 2}
                };
                [6] = {
                    [1] = {1.15, 1.2};
                    [2] = {2.4, 2}
                };
                [7] = {
                    [1] = {1.15, 1.4};
                    [2] = {2.3, 2};
                    [3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.15, 1.6};
                    [2] = {2, 2};
                    [3] = {1.5, 1.5}
                };
                [9] = {
                    [1] = {1.15, 1.6};
            	    [2] = {0.675, 2}
                };
                [10] = {
                    [1] = {1.15, 1.4};
                	[2] = {0.75, 2}
                };
                [11] = {
                    [1] = {1.15, 1.2};
                	[2] = {0.85, 2};
                	[3] = {4, 1}
                };
                [12] = {
                    [1] = {1.15, 1};
                	[2] = {0.9, 2}
                };
                [13] = {
                    [1] = {1.15, 0.8};
                	[2] = {1, 2}
                };
                [14] = {
                    [1] = {1.15, 0.6};
                	[2] = {1.05, 2}
                };
                [15] = {
                    [1] = {1.15, 0.4};
                	[2] = {1.2, 2};
                	[3] = {1.5, 1.5}
                };
                [16] = {
                    [1] = {1.15, 0.2};
                	[2] = {1.35, 2};
                	[3] = {1.5, 1.5}
                }
            };
            [12] = {
                [1] = {
                    [1] = {1.55, 0.2};
                	[2] = {0.9, 2}
                };
                [2] = {
                    [1] = {1.55, 0.4};
                	[2] = {0.675, 2}
                };
                [3] = {
                    [1] = {1.55, 0.6};
                	[2] = {0.9, 2};
                	[3] = {4, 1}
                };
                [4] = {
                    [1] = {1.55, 0.8};
                	[2] = {1, 2}
                };
                [5] = {
                    [1] = {1.55, 1};
                	[2] = {0.675, 2}
                };
                [6] = {
                    [1] = {1.55, 1.2};
                	[2] = {1, 2}
                };
                [7] = {
                    [1] = {1.55, 1.4};
                	[2] = {1.05, 2};
                	[3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.55, 1.6};
                	[2] = {0.675, 2};
                	[3] = {1.5, 1.5}
                };
                [9] = {
                    [1] = {1.55, 1.6};
                	[2] = {1.05, 2}
                };
                [10] = {
                    [1] = {1.55, 1.4};
                	[2] = {1.2, 2}
                };
                [11] = {
                    [1] = {1.55, 1.2};
                	[2] = {0.675, 2};
                	[3] = {4, 1}
                };
                [12] = {
                    [1] = {1.55, 1};
                	[2] = {1.2, 2}
                };
                [13] = {
                    [1] = {1.55, 0.8};
                	[2] = {1.35, 2}
                };
                [14] = {
                    [1] = {1.55, 0.6};
                	[2] = {0.675, 2}
                };
                [15] = {
                    [1] = {1.55, 0.4};
                	[2] = {1, 2};
                	[3] = {1.5, 1.5}
                };
                [16] = {
                    [1] = {1.55, 0.2};
                	[2] = {1.35, 2};
                	[3] = {1.5, 1.5}
                };
                [17] = {
                    [1] = {1.55, 0.2};
	                [2] = {1.8, 2}
                };
                [18] = {
                    [1] = {1.55, 0.4};
	                [2] = {1.35, 2}
                };
                [19] = {
                    [1] = {1.55, 0.6};
                	[2] = {1.05, 2};
                	[3] = {4, 1}
                };
                [20] = {
                    [1] = {1.55, 0.8};
                	[2] = {1.35, 2}
                };
                [21] = {
                    [1] = {1.55, 1};
                	[2] = {1.05, 2}
                };
                [22] = {
                    [1] = {1.55, 1.2};
                	[2] = {0.9, 2}
                };
                [23] = {
                    [1] = {1.55, 1.4};
                	[2] = {1.05, 2};
                	[3] = {1.5, 1.5}
                };
                [24] = {
                    [1] = {1.55, 1.6};
                	[2] = {0.9, 2};
                	[3] = {1.5, 1.5}
                };
                [25] = {
                    [1] = {1.55, 1.6};
                	[2] = {0.675, 2}
                };
                [26] = {
                    [1] = {1.55, 1.4};
                	[2] = {0.9, 2}
                };
                [27] = {
                    [1] = {1.55, 1.2};
                	[2] = {0.675, 2};
                	[3] = {4, 1}
                };
                [28] = {
                    [1] = {1.55, 1};
                	[2] = {0.525, 2}
                };
                [29] = {
                    [1] = {1.55, 0.8};
                	[2] = {2.4, 2}
                };
                [30] = {
                    [1] = {1.55, 0.6};
                	[2] = {2.1, 2}
                };
                [31] = {
                    [1] = {1.55, 0.4};
                	[2] = {2, 2};
                	[3] = {1.5, 1.5}
                };
                [32] = {
                    [1] = {1.55, 0.2};
                	[2] = {1.8, 2};
                	[3] = {1.5, 1.5}
                };
            };
            [13] = {
                [1] = {
                    [1] = {1.225, 0.2};
                	[2] = {0.7, 2}
                };
                [2] = {
                    [1] = {1.225, 0.4};
                	[2] = {0.525, 2}
                };
                [3] = {
                    [1] = {1.225, 0.6};
                	[2] = {0.7, 2};
                	[3] = {4, 1}
                };
                [4] = {
                    [1] = {1.225, 0.8};
                	[2] = {0.8, 2}
                };
                [5] = {
                    [1] = {1.225, 1};
                	[2] = {0.525, 2}
                };
                [6] = {
                    [1] = {1.225, 1.2};
                	[2] = {0.8, 2}
                };
                [7] = {
                    [1] = {1.225, 1.4};
                	[2] = {0.9, 2};
                	[3] = {1.5, 1.5}
                };
                [8] = {
                    [1] = {1.225, 1.6};
                	[2] = {0.525, 2};
                	[3] = {1.5, 1.5}
                };
                [9] = {
                    [1] = {1.225, 1.6};
                	[2] = {0.9, 2}
                };
                [10] = {
                    [1] = {1.225, 1.4};
                	[2] = {1, 2}
                };
                [11] = {
                    [1] = {1.225, 1.2};
                	[2] = {0.525, 2};
                	[3] = {4, 1}
                };
                [12] = {
                    [1] = {1.225, 1};
                	[2] = {1, 2}
                };
                [13] = {
                    [1] = {1.225, 0.8};
                	[2] = {1.05, 2}
                };
                [14] = {
                    [1] = {1.225, 0.6};
                	[2] = {0.525, 2}
                };
                [15] = {
                    [1] = {1.225, 0.4};
                	[2] = {0.9, 2};
                	[3] = {1.5, 1.5}
                };
                [16] = {
                    [1] = {1.225, 0.2};
                	[2] = {1.05, 2};
                	[3] = {1.5, 1.5}
                };
                [17] = {
                    [1] = {1.225, 0.2};
                	[2] = {1.425, 2}
                };
                [18] = {
                    [1] = {1.225, 0.4};
                	[2] = {1.05, 2}
                };
                [19] = {
                    [1] = {1.225, 0.6};
                	[2] = {0.9, 2};
                	[3] = {4, 1}
                };
                [20] = {
                    [1] = {1.225, 0.8};
                	[2] = {1.05, 2}
                };
                [21] = {
                    [1] = {1.225, 1};
                	[2] = {0.9, 2}
                };
                [22] = {
                    [1] = {1.225, 1.2};
                	[2] = {0.7, 2}
                };
                [23] = {
                    [1] = {1.225, 1.4};
                	[2] = {0.9, 2};
                	[3] = {1.5, 1.5}
                };
                [24] = {
                    [1] = {1.225, 1.6};
                	[2] = {0.7, 2};
                	[3] = {1.5, 1.5}
                };
                [25] = {
                    [1] = {1.225, 1.6};
                	[2] = {0.525, 2}
                };
                [26] = {
                    [1] = {1.225, 1.4};
                	[2] = {0.7, 2}
                };
                [27] = {
                    [1] = {1.225, 1.2};
                	[2] = {0.525, 2};
                	[3] = {4, 1}
                };
                [28] = {
                    [1] = {1.225, 1};
                	[2] = {0.45, 2}
                };
                [29] = {
                    [1] = {1.225, 0.8};
                	[2] = {2.4, 2}
                };
                [30] = {
                    [1] = {1.225, 0.6};
                	[2] = {2.1, 2}
                };
                [31] = {
                    [1] = {1.225, 0.4};
                	[2] = {2, 2};
                	[3] = {1.5, 1.5}
                };
                [32] = {
                    [1] = {1.225, 0.2};
                	[2] = {1.8, 2};
                	[3] = {1.5, 1.5}
                };
            }
        };
        ["Measures"] = {
            1;
            2;
            3;
            1;
            2;
            4;
            5;
            6;
            7;
            5;
            6;
            8;
            9;
            10;
            9;
            11;
            12;
            13;
            9;
            10;
            9;
            11
        }
    }
}

local speed = 1

owner.Chatted:Connect(function(msg)
    if msg:sub(1, 3) == '/e ' then
        msg = msg:sub(4)
    end
    
    if msg:sub(1, 6) == "speed " then
        speed = msg:sub(7)
    end
end)

local function playSong(song)
    task.spawn(function()
        local tempo = 60 / song["Tempo"]
        local patterns = song["Patterns"]
        local measures = song["Measures"]
        local currentMeasure = 1
        local currentPattern = measures[currentMeasure]
        local currentNote = 0
        
        while true do
            currentNote = currentNote + 1
            currentPattern = measures[currentMeasure]
            
            if currentNote > #patterns[currentPattern] then
                currentMeasure = currentMeasure + 1
                if currentMeasure > #measures then
                    currentMeasure = 1
                end
                currentNote = 1
                currentPattern = measures[currentMeasure]
            end
            
            if patterns[currentPattern][currentNote][1] ~= nil then
                playSound("bass", patterns[currentPattern][currentNote][1][1] * speed, patterns[currentPattern][currentNote][1][2])
            end
            
            if patterns[currentPattern][currentNote][2] ~= nil then
                playSound("ping", patterns[currentPattern][currentNote][2][1] * speed, patterns[currentPattern][currentNote][2][2])
            end
            
            if patterns[currentPattern][currentNote][3] ~= nil then
                playSound("snap", patterns[currentPattern][currentNote][3][1] * speed, patterns[currentPattern][currentNote][3][2])
            end
            task.wait(tempo / speed)
        end
    end)
end

playSong(sounds["NightSong"])
INFO