A simple Lua script which plays a .wav sound whenever replay buffer is saved. | |
## Installation | |
1. Download Half-Life 2 City Scanner NPC's camera shutter sound: | |
https://github.com/sourcesounds/hl2/blob/master/sound/npc/scanner/scanner_photo1.wav | |
--OR-- | |
Use any .wav sound but make sure to match its name either in "Beep on replay buffer save.lua" (edit with any text editor) or rename your .wav file to "sound_npc_scanner_scanner_photo1.wav". | |
2. Put it in the same location with "Beep on replay buffer save.lua". | |
A good way is to create a separate "scripts" folder in %AppData%\obs-studio\ and keep all your scripts there in case you need to backup your OBS Settings. | |
3. OBS -> Tools -> Scripts -> + | |
This Lua script was downloaded from https://gist.github.com/snakecase/e816384a071cec31efbb4b9e429c108d | |
Credits: upgradeQ (https://gist.github.com/upgradeQ/b2412242d76790d7618d6b0996c4562f), gima (https://gitlab.com/gima/obsnotification) | |
Thank you guys! |
local obs = obslua | |
local ffi = require("ffi") | |
local winmm = ffi.load("Winmm") | |
-- Put a sound of your choosing next to "Beep on replay save.lua" and don't forget to match its name either in code below or rename your file. | |
PROP_AUDIO_FILEPATH = script_path() .. "sound_npc_scanner_scanner_photo1.wav" | |
ffi.cdef[[ | |
bool PlaySound(const char *pszSound, void *hmod, uint32_t fdwSound); | |
]] | |
function playsound(filepath) | |
winmm.PlaySound(filepath, nil, 0x00020003) | |
end | |
function on_event(event) | |
if event == obs.OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED | |
then playsound(PROP_AUDIO_FILEPATH) | |
end | |
end | |
function script_load(settings) | |
obs.obs_frontend_add_event_callback(on_event) | |
end | |
-- This Lua script was downloaded from https://gist.github.com/snakecase/e816384a071cec31efbb4b9e429c108d | |
-- Credits: upgradeQ (https://gist.github.com/upgradeQ/b2412242d76790d7618d6b0996c4562f), gima (https://gitlab.com/gima/obsnotification) | |
-- Thank you guys! |
Thanks for this. Works great and was exactly what I was looking for!
Worked great! Although the revised -10db sound is still just a tad too loud, so here's a revised quieter version of that revision (-15db in total, I think). Other than that, the script worked flawless :)
(attached it as .mp4 because non-authors can't send .mp3 for some reason. just make sure to rename it to .wav)
https://user-images.githubusercontent.com/36707936/197033922-51507751-bab9-468f-88f5-18f1b36af11d.mp4
Does it still work for OBS version 29.0.2? Does not seem to work for me.
Does it still work for OBS version 29.0.2? Does not seem to work for me.
Using Windows 11, no errors in the log, my suspicion is this part of the code:
winmm.PlaySound(filepath, nil, 0x00020003)
The winmm for the soundsystem has probably changed on Windows 11?
Does it still work for OBS version 29.0.2? Does not seem to work for me.
Using Windows 11, no errors in the log, my suspicion is this part of the code:
winmm.PlaySound(filepath, nil, 0x00020003)
The winmm for the soundsystem has probably changed on Windows 11?
I'm not sure about Windows 11, but it's been working perfectly fine for me on Windows 10 (OBS 29.0.2).
I'm on the same specs but it's not working for me either... :/
Working fine for me with OBS 29.0.2 on Windows 11 (22H2). Does the script still show for you under Tools->Scripts
?
Working fine for me with OBS 29.0.2 on Windows 11 (22H2). Does the script still show for you under
Tools->Scripts
?
Yep
Hey is anyone else having an issue where the sound effect is very delayed after hitting the replay buffer hotkey? The sound plays about 10-15 seconds after I hit the key. Don't know how to fix it, also I'm on Windows 11, OBS 29.02.
Hey is anyone else having an issue where the sound effect is very delayed after hitting the replay buffer hotkey? The sound plays about 10-15 seconds after I hit the key. Don't know how to fix it, also I'm on Windows 11, OBS 29.02.
How long is your replay?
Hey is anyone else having an issue where the sound effect is very delayed after hitting the replay buffer hotkey? The sound plays about 10-15 seconds after I hit the key. Don't know how to fix it, also I'm on Windows 11, OBS 29.02.
How long is your replay?
My replay is 30 seconds long.
oh that makes sense! It does sound familiar. I don't use SteamVR but it might even be Steam's default screenshot sound effect, now that I think about it...