Open / Close Menu Sound

Any help at all will be appreciated.

Well, if you open the menu in your game, you will hear the 'Accept' sound you set in the database. The same with closing the menu; you will hear the 'Cancel' sound. Is there a way of changing these sounds without changing the 'Accept' or 'Cancel' sounds in the database? If you don't understand the context or want more information, put it in the comments.

Thank you for your inestimable help and hope I can find a solution to this minor problem, thanks to you!!!
Pretty sure that'll need a plugin... 😅
  • "OK" sound on opening the menu seems to be played here:
    Spoiler: Scene_Map.prototype.callMenu
    Code:
    Scene_Map.prototype.callMenu = function() {
        SoundManager.playOk();
        SceneManager.push(Scene_Menu);
        Window_MenuCommand.initCommandPosition();
        $gameTemp.clearDestination();
        this._mapNameWindow.hide();
        this._waitCount = 2;
    };
  • I think this code is responsible for the "cancel" sound on closing:
    Spoiler: inherited from Window_Selectable.prototype.processCancel
    Code:
    Window_MenuCommand.prototype.processCancel = function() {
        SoundManager.playCancel();
        this.updateInputData();
        this.deactivate();
        this.callCancelHandler();
    };
So it looks like you could make a simple plugin: copy+paste those two methods and edit the SoundManager lines as desired. What to replace those lines with? It depends which sounds you'd like to use instead: SoundManager is an interface to AudioManager specifically for system sounds, as defined in the database (cf. rpg_managers.js), but you could probably use AudioManager.playSe to play a non-system SE here without major issues. (I think the major functional difference is that system sounds are precached.)
So it looks like you could make a simple plugin: copy+paste those two methods and edit the SoundManager lines as desired. What to replace those lines with? It depends which sounds you'd like to use instead: SoundManager is an interface to AudioManager specifically for system sounds, as defined in the database (cf. rpg_managers.js), but you could probably use AudioManager.playSe to play a non-system SE here without major issues. (I think the major functional difference is that system sounds are precached.)

Wow!!! That's REALLY interesting 😂. Thank you for your AWESOME help. But I can't seem to put this right. Look at this picture and tell me what's wrong. (BTW when I run the game I don't hear any sound when opening the menu, but I hear all of the others).

5MatI0I.png
Oh, I should have given an example, sorry! playSe needs an "audio object" for its input, not just a string, e.g.
Code:
AudioManager.playSe({ name: 'Equipar4', volume: 20, pitch: 100 });
  • name is a string, the name of the audio file
  • volume is a number from 0~100
  • pitch is a number from 50~150
Hope that helps! 🙏

Edit @DiegoAngelGamer: also, I'd recommend changing the Window_Selectable part to Window_MenuCommand, otherwise I think it'll override the cancel sound for all selectable windows rather than just the pause menu. 👋

(I originally wrote Window_Selectable in my first post, I guess you copied it before I corrected it. 😴)
@caethyril Sorry, I was away for a bit. THAT WAS AWESOME!!! 😂😢 It worked exactly as planned!!! (Also I was going to edit my comment to say that after opening the menu I couldn't hear the 'Cancel' sound anywhere). Your great knowledge of JavaScript should make you the administrator of the forum!!! Not only did you tell me how to do it, but you searched for the exact lines of code that I wanted and gave me an example... 😍
@caethyril Sorry, I was away for a bit. THAT WAS AWESOME!!! 😂😢 It worked exactly as planned!!! (Also I was going to edit my comment to say that after opening the menu I couldn't hear the 'Cancel' sound anywhere).
Yay! You're welcome, happy RPG Making! 😂

Original thread: https://forums.rpgmakerweb.com/threads/open-close-menu-sound.114845/