local obs = obslua local ffi = require("ffi") local winmm = ffi.load("Winmm") hotkey_id = obs.OBS_INVALID_HOTKEY_ID -- Put a path to the sound of your choosing PROP_AUDIO_FILEPATH = "C:\\Windows\\Media\\Windows Hardware Remove.wav" ffi.cdef[[ bool PlaySound(const char *pszSound, void *hmod, uint32_t fdwSound); ]] function playsound(filepath) winmm.PlaySound(filepath, nil, 0x00020003) end function onPress(pressed) if pressed then playsound(PROP_AUDIO_FILEPATH) end end function script_load(settings) -- Register keybind hotkey_id = obs.obs_hotkey_register_frontend("audioPlayOnKeybind", "Play audio on this keybind", onPress) -- Load saved keybind local hotkey_save_array = obs.obs_data_get_array(settings, "audioBind.trigger") obs.obs_hotkey_load(hotkey_id, hotkey_save_array) obs.obs_data_array_release(hotkey_save_array) end function script_save(settings) -- Save keybind local hotkey_save_array = obs.obs_hotkey_save(hotkey_id) obs.obs_data_set_array(settings, "audioBind.trigger", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array) end -- This Lua script was downloaded from https://gist.github.com/DareFox/fd91bab3b8b5f26601f5e47ae2cf9f07 -- Credits: -- snakecase (https://gist.github.com/snakecase/e816384a071cec31efbb4b9e429c108d) -- upgradeQ (https://gist.github.com/upgradeQ/b2412242d76790d7618d6b0996c4562f), -- gima (https://gitlab.com/gima/obsnotification) -- Thank you guys!