Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pre = "rbxassetid://"
- local bass = pre.."5706402256"
- local sine = pre.."146750669"
- local square = pre.."9040512330"
- local piano = pre.."179578660"
- local sawtooth = pre.."9040512075"
- local static = pre.."9040512492"
- local waid = 1/8
- --{id, length}
- local instruments = {
- ["bass"] = {bass, nil};
- ["sine"] = {sine, 2*waid};
- ["square"] = {square, 2*waid};
- ["sawtooth"] = {sawtooth, waid*1.5};
- ["static"] = {static, waid*1.5};
- ["piano"] = {piano, nil};
- }
- function preload()
- for i, v in pairs(instruments) do
- local sound = Instance.new("Sound", script)
- sound.SoundId = v[1]
- if not sound.IsLoaded then
- sound.Loaded:Wait()
- end
- instruments[i] = {sound, v[2]}
- end
- end
- preload()
- local char = workspace:WaitForChild("kaibrown4")
- local track, loop, instrument, shift = ...
- track = track or 2
- loop = loop or false
- instrument = instrument or "sine"
- shift = shift or 0
- shift = tonumber(shift)
- track = tonumber(track)
- loop = loop == "true" and true or false
- local vol = 0.08
- function convrang(x, minx, maxx, miny, maxy)
- return ((x - minx)/(maxx-minx))*(maxy - miny) + miny
- end
- local s = {6, 3, 6, 6, 3, 6, 3, 3, 5, 3, 5, 5, 1, 5, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, -2, 1, -2, -2, -4, -2, -4, -4, 3, -4, 3, 3, 3, 3, 3, 3, 5, 3, 5, 5, 8, 5, 8, 8, 5, 8, 5, 5, 3, 5, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, [-1] = -4; [-2] = 64; [-3] = 1; [-4] = "that one part from kerosene";}
- local b = {
- [1] = {48};
- [2] = {55, 72, 48, 51};
- [3] = {51, 48};
- [4] = {55, 67, 48};
- [5] = {55, 48};
- [6] = {55, 48, 60};
- [7] = {60, 48};
- [8] = {48, 55, 72};
- [9] = {48};
- [10] = {55, 48, 67};
- [11] = {48};
- [12] = {55, 60, 48};
- [13] = {48};
- [14] = {55, 72, 48};
- [15] = {48};
- [16] = {58, 63, 51};
- [17] = {51};
- [18] = {58, 75, 55, 51};
- [19] = {55, 51};
- [20] = {51, 70, 58};
- [21] = {58, 70, 51};
- [22] = {51, 58, 63};
- [23] = {63, 51};
- [24] = {51, 58, 75};
- [25] = {51};
- [26] = {51, 58, 70};
- [27] = {70, 51};
- [28] = {51, 58, 63};
- [29] = {51};
- [30] = {75, 58, 51};
- [31] = {75, 51};
- [32] = {57, 62, 50};
- [33] = {62, 50};
- [34] = {57, 54, 74, 50};
- [35] = {50, 54, 74};
- [36] = {69, 50, 57};
- [37] = {69, 57, 50};
- [38] = {57, 50, 62};
- [39] = {62, 50};
- [40] = {50, 57, 74};
- [41] = {50};
- [42] = {69, 50, 57};
- [43] = {69, 50};
- [44] = {50, 57, 62};
- [45] = {50};
- [46] = {51, 58, 74};
- [47] = {57, 50};
- [48] = {49, 56, 61};
- [49] = {61, 49};
- [50] = {49, 73, 53, 56};
- [51] = {53, 49, 73};
- [52] = {56, 68, 49};
- [53] = {49, 68, 56};
- [54] = {49, 56, 61};
- [55] = {61, 49};
- [56] = {56, 73, 49};
- [57] = {73, 49};
- [58] = {49, 56, 68};
- [59] = {68, 49};
- [60] = {49, 56, 61};
- [61] = {61, 49};
- [62] = {49, 73, 56};
- [63] = {49, 73};
- [0] = {60, 48, 55};
- [-1] = 48;
- [-2] = 64;
- [-4] = "random song i made";
- }
- local c = {
- [32] = {57, 67};
- [34] = {55, 67};
- [4] = {52};
- [6] = {54};
- [8] = {54};
- [10] = {52};
- [12] = {54};
- [14] = {54};
- [16] = {52};
- [62] = {54};
- [18] = {54};
- [60] = {52};
- [20] = {54};
- [56] = {54};
- [22] = {56, 68};
- [50] = {66, 54};
- [24] = {57, 68};
- [48] = {52};
- [26] = {56, 68};
- [44] = {54, 66};
- [28] = {52, 68};
- [38] = {54, 66};
- [30] = {55, 67};
- [36] = {52, 67};
- [-1] = 52;
- [-2] = 64;
- [-4] = "another song i made";
- }
- local d = {
- [0] = {74};
- [4] = {84, 72};
- [70] = {81};
- [72] = {70, 82, 58};
- [76] = {65, 82, 58, 70};
- [78] = {84};
- [16] = {74, 62};
- [126] = {74};
- [18] = {86, 74};
- [124] = {71, 55, 67, 62};
- [20] = {84, 72};
- [122] = {67};
- [22] = {80, 68};
- [120] = {67, 55};
- [88] = {57, 69};
- [118] = {71};
- [26] = {67, 79};
- [116] = {55, 74, 67, 59};
- [28] = {77, 65};
- [114] = {79};
- [30] = {79, 67};
- [112] = {67, 55, 83};
- [96] = {56, 68};
- [110] = {82};
- [108] = {80, 68, 63, 56};
- [104] = {80, 56, 68};
- [36] = {84, 72};
- [102] = {79};
- [38] = {81, 69};
- [100] = {80, 60, 56, 68};
- [40] = {83, 71};
- [94] = {76};
- [92] = {64, 57, 73, 69};
- [90] = {69};
- [44] = {79, 67};
- [86] = {73};
- [46] = {77, 65};
- [84] = {57, 61, 69, 76};
- [48] = {74, 62};
- [82] = {81};
- [50] = {86, 74};
- [80] = {69, 57, 85};
- [52] = {84, 72};
- [6] = {81, 69};
- [54] = {81, 69};
- [8] = {83, 71};
- [56] = {79, 67};
- [14] = {77, 65};
- [58] = {77, 65};
- [12] = {79, 67};
- [60] = {79, 67};
- [64] = {58, 70};
- [62] = {81, 69};
- [68] = {70, 58, 62, 82};
- [-1] = 80;
- [-2] = 126;
- [-4] = "that one song about the funny skeleton (the other song)"
- }
- local e = {
- [0] = {73, 57};
- [2] = {68, 61};
- [4] = {73, 64};
- [6] = {68, 61};
- [8] = {73, 64};
- [10] = {61, 68};
- [12] = {73, 57};
- [14] = {61, 68};
- [16] = {73, 64};
- [18] = {61, 68};
- [20] = {73, 64};
- [22] = {68, 61};
- [24] = {66, 54};
- [26] = {58, 64};
- [28] = {68, 61};
- [30] = {58};
- [32] = {61, 64};
- [94] = {59};
- [34] = {66, 58};
- [92] = {68, 64};
- [36] = {71, 54};
- [90] = {59};
- [38] = {70, 58};
- [88] = {69, 64};
- [40] = {71, 61};
- [86] = {59};
- [42] = {73, 58};
- [84] = {56, 71};
- [44] = {70, 61};
- [82] = {61, 73};
- [46] = {58, 66};
- [80] = {71, 64};
- [48] = {73, 50};
- [78] = {69, 61};
- [50] = {66, 54};
- [76] = {73, 64};
- [52] = {73, 57};
- [74] = {69, 61};
- [54] = {66, 54};
- [72] = {57, 73};
- [56] = {73, 57};
- [70] = {53};
- [58] = {66, 54};
- [68] = {74, 57};
- [60] = {73, 49};
- [66] = {65, 53};
- [62] = {65, 53};
- [64] = {73, 57};
- [-1] = 60;
- [-2] = 94;
- [-4] = "fallen down - Toby Fox";
- }
- print(math.min(table.unpack(s)))
- print(math.max(table.unpack(s)))
- --print(convrang(3-1, 0, 3, 0, 11+1))
- local tracks = {s, b, c, d, e}
- local sel = tracks[track]
- print("track: "..track, "loop: "..tostring(loop))
- owner.Chatted:Connect(function(msg)
- if msg:sub(1, 6) == "shift:" then
- local nshift = tonumber(msg:sub(8, -1))
- if not nshift then error("invalid pitch-shift") end
- shift = tonumber(msg:sub(8, -1))
- end
- if msg:sub(1, 6) == "instr:" then
- local instr = msg:sub(8, -1)
- if not instruments[instr] then error("invalid instrument") end
- instrument = instr
- end
- if msg:sub(1, 4) == "vol:" then
- local nvol = tonumber(msg:sub(6, -1))
- if not nvol then error("invalid volume") end
- vol = nvol
- end
- if msg:sub(1, 6) == "speed:" then
- local s_speed = tonumber(msg:sub(8,-1))
- if not s_speed then error("invalid speed") end
- waid = 1/(8*s_speed)
- end
- end)
- local times = 0
- local wm = Instance.new("WorldModel", script)
- local displaypart = Instance.new("Part", wm)
- displaypart.Anchored = true
- displaypart.Size = Vector3.one
- displaypart.Transparency = 0.8
- local billboardg = Instance.new("BillboardGui", displaypart)
- billboardg.Size = UDim2.fromScale(20,4)
- billboardg.MaxDistance = 55
- billboardg.Adornee = displaypart
- local text = Instance.new("TextLabel", billboardg)
- text.Size = UDim2.fromScale(1,1)
- text.TextScaled = true
- text.Position = UDim2.fromScale(0,-0.5)
- text.BackgroundTransparency = 1
- text.TextColor3 = Color3.new(1,1,1)
- text.TextStrokeColor3 = Color3.new()
- text.TextStrokeTransparency = 0
- local prog = Instance.new("Part", wm)
- prog.Size = Vector3.new(0.5, 0.5, 128)
- prog.Color = Color3.new(1,1,1)
- prog.Transparency = 0.5
- prog.Anchored = true
- prog.Material = "SmoothPlastic"
- print(instrument, instruments[instrument])
- function play(pos)
- times = times + 1
- displaypart.Position = pos + Vector3.yAxis*3/2
- text.Text = "Now Playing: "..sel[-4]
- for i = sel[-3] or 0,sel[-2]-1+(sel[-3] or 0) do
- local val = sel[i]
- prog.Position = Vector3.new(-i, 3, 63.5)/2 + pos
- if type(sel[i]) == "number" then sel[i] = {val} end
- if not val then task.wait(waid) continue end
- for j = 1,#sel[i] do
- local val2 = sel[i][j]
- local sound = instruments[instrument][1]:Clone()
- sound.Parent = prog
- sound.Pitch = 2 * 2 ^ ((val2 - sel[-1] + shift)/12)
- sound.Volume = vol
- sound.PlaybackRegionsEnabled = true
- sound.RollOffMinDistance = 80
- sound.RollOffMaxDistance = 80
- --sound.Pitch = convrang(s[i], 1, 8, 0.5, 1)
- --local pitch = Instance.new("PitchShiftSoundEffect", sound)
- --pitch.Octave = convrang(s[i], 0, 8, 1, 1+1)
- if times == 1 then
- local part = Instance.new("Part", wm)
- part.Material = "Neon"
- part.Position = Vector3.new(-i, 3, val2 + shift)/2 + pos
- part.Size = Vector3.one/2
- part.Anchored = true
- part.Color = Color3.fromHSV(((val2 - sel[-1]) % 12)/12, 1, 0.6)
- end
- local len = instruments[instrument][2] or sound.TimeLength/2
- sound.PlaybackRegion = NumberRange.new(sound.TimeLength/2 - len, sound.TimeLength/2 + len)
- sound:Play()
- print(sound.IsLoaded)
- end
- task.wait(waid)
- end
- end
- if loop then
- local headpos = owner.Character.Head.Position
- play(headpos)
- while task.wait() do
- play(headpos)
- end
- else
- play(owner.Character.Head.Position)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement