Open Source Virtual Pianos

May I please see photos of it before I download it?

I’m not quite sure I understand what you mean here :sweat_smile:

They are physical piano models that you play using your laptop keyboard. But in order to use them, you have to actually insert the model, they aren’t just audio files of piano music :laughing:

If that helps answer your question any, I glad I could help! If not, shoot me back a message!

Sure! You can check my post here:

I can guarantee you the files are safe, they are in .rbxm format and have been used in Soro’s Italian Restaraunt and Virtual Piano Visualizations! :smile:

@nooneisback and @DeclinedCalls Ooh! I thought they where audio! Not models! :sweat_smile: :flushed:

Really nice models, I don’t know if I’ll ever end up using them, but they work really nice. Though I think the keys should stay dark as long as they are held and return to their color when you release. It feels a bit awkward having a key darkened when you already let go of it, or return to normal when you’re still holding it.

1 Like

The GUI is a bit outdated, I only made the physical models themselves :sweat_smile:

Scripting credits go to:
NickPatella
FumeiSencho
brianops1

1 Like

After 20 minutes of tinkering (the code’s quite a bit of a mess), I fixed that visual feedback issue in the PianoGui portion. Doing the same with the 3D movement and the sound would require adding an additional path for key up, which would probably require a bit of a rewrite.

FixedPianoGui.rbxm (19.1 KB)

EDIT: Forgot to remove a few prints and to clear unneeded connections.

5 Likes

Hey! That’s really nice of you my dude! Keep up the good work!

Hi,

Awesome models by the way.

I’ve seen tons of GUI and script elements and would like to ask you if these are working pianos, and if yes; How exactly do you get them to work?

Instructions are inside! It should be a script labeled ‘READ ME’

1 Like

I’ve tried reading that, hence why I tried to build contact with you here.

The problem is, I don’t really code to be able to read this.

You don’t need to be able to code, just follow the instructions provided in the “READ ME” script. No coding at all is required!

1 Like

I’ve actually realized this is uselss considering roblox’s new audio filtering system has blocked use of the audios needed to play the pianos in the first place!

Sorry to wake up an ond thread, but does anyone know of a way to play a song automatically on loop? sort of how that old autohotkey hack used virtualpiano.net to play these pianos.

Thanks for any help!

The simplest way is to interface with the events that trigger the piano to actually play a note using a table of timings and keypresses.

local bps = 70 / 60
local t = {
    {"i-f"},
    {"s"},
    {"a"},
    {"o"},
    {"i-f"},
    {"u-f", bps * 2}
}
-- equiv. to: "[if] s a o [if]| |[uf]"

local Connector = workspace.GlobalPianoConnector
for _, data in ipairs(t) do
    local waitTime = data[2] or bps
    task.wait(waitTime)
    for _, note in ipairs(data[1]:split("-")) do
        Connector:FireServer("play", note, 1, 0)
    end
end

example song

2 Likes

Thanks for the solution! coukd you tell me where I should insert this script? thanks!

Last night I actually did fiddle with this and figured out you’ll have to do something like this, It doesn’t look nice clarity-wise but it was something I quickly put together:

local bps = (70 / 60) / 3
local transpo = 0
local song = {
    "u-f", "g", "h", "k", "i-f", "|l" ,"s", "|k", ...
}

-----

local Connector = workspace.Pianos.RemoteEvents.GlobalPianoConnector
local letterNoteMap = "1!2@34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm"
local function letterToNote(key)
    local note = letterNoteMap:find(key, 1, true)
    if note then
        return note + trans
end

while true do
    for _, keyData in ipairs(song) do
        if key:match("^|") then
            task.wait(bps / 2)
            key = key:sub(2)
        else
            task.wait(bps)
        end

        for _, key in ipairs(key:split("-")) do
            local note = LetterToNote(key)
            Connector:FireServer("play", { Note = note, Transposition = transpo, Volume = 1 })
        end
    end
end

To be honest, it doesn’t really matter, but for clarity put it inside the piano.

As good as this is, it no longer has a use due to the roblox audio update.

1 Like

Solution:

(Replace to code from “Settings” with this)

local settings = {}

Piano = script.Parent
Box = Piano.Keys.Camera

--EDIT BELOW----------------------------------------------------------------------
settings.PianoSoundRange = 50

settings.KeyAesthetics = true

settings.PianoSounds = {
	"233836579",
	"233844049",
	"233845680",
	"233852841",
	"233854135",
	"233856105"
}
-- Each note takes up exactly 8 seconds in audio. i.e C2 lasts 8 secs, C2# lasts 8 secs, C3 lasts 8 secs, C3# lasts 8 secs etc. for each audio
-- These are the IDs of the piano sounds.

settings.SoundSource = Piano.Keys.KeyBox

settings.CameraCFrame = CFrame.new(
	(Box.CFrame * CFrame.new(0, 0, 1)).p, -- +z is towards player
	(Box.CFrame * CFrame.new(0, 0, 0)).p
)
-----------------------------------------------------------------------------------

return settings

2 Likes

This works. Thank you so so so so so so so so so so so much man

훌륭한 오픈소스를 제공해 주셔서 감사합니다.
하지만 @을 누르면 피아노가 깨지는 것 같습니다.
출력에는 오류 메시지가 없지만 @를 누르면 마우스로 키를 누를 때는 정상적으로 작동하지만 키보드로는 작동하지 않습니다.
하지만 마우스로 아무 곳이나 클릭하면 오류가 해결됩니다.