Ren'Py Click sound not playing

Mescalino

Active Member
Aug 20, 2017
937
6,633
Ok i have the following code:
Python:
## Choice screen ###############################################################
##
## This screen is used to display the in-game choices presented by the menu
## statement. The one parameter, items, is a list of objects, each with caption
## and action fields.
##
## https://www.renpy.org/doc/html/screen_special.html#choice

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption action i.action


## When this is true, menu captions will be spoken by the narrator. When false,
## menu captions will be displayed as empty buttons.
define config.narrator_menu = True


style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text

style choice_vbox:
    xalign 0.5
    ypos 405
    yanchor 0.5

    spacing gui.choice_spacing

style choice_button is default:
    properties gui.button_properties("choice_button")
    activate_sound "audio/sci-fi-click.ogg"

style choice_button_text is default:
    properties gui.button_text_properties("choice_button")
All pretty standard but it is not playing the click sound. What am i missing?
 

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,671
15,504
Not sure, seems like that should work fine, did a test on a game and it works for me. Could it be something else, like some issue with an audio file or volume of your sound channel in Ren'Py? Or maybe you have some other style for choice_button that overwrites the code?
 

Mescalino

Active Member
Aug 20, 2017
937
6,633
Not sure, seems like that should work fine, did a test on a game and it works for me. Could it be something else, like some issue with an audio file or volume of your sound channel in Ren'Py? Or maybe you have some other style for choice_button that overwrites the code?
No this is a brand new game. All i changed is the main menu and Game menu background. Still trying to figure out how to customize my GUI so i am trying to take baby steps.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,365
15,281
No this is a brand new game.
What left one possibility, where is located your "audio" directory ?
It should be on "[path to Ren'py's projects directory]/[project name]/game". Is it where you put it ?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,365
15,281
H:\My Novel\<Project>\game\audio
Ok.

Like LightmanP , I tested it, and it works without problem. So...

You are expecting the sound to be played when the player will click on the button from a menu choice, right ?
And by "menu choice" I mean this:
Code:
label whatever:
    menu:
        "choice 1":
            pass
        "choice 2":
            pass
If not, what were you trying to do ?

If yes, are you sure that your audio file is a real "ogg" one ?
Did the sound play right when you use a player (whatever hwich one) ?
Open the preference menu.
Is the slider below "voice" at the right of the bar ?
Is the "mute all" not selected ?
Is your speaker turned on ?
Isn't the sound from Ren'py disabled from the system ?
 
  • Like
Reactions: Mescalino

Mescalino

Active Member
Aug 20, 2017
937
6,633
Checked volume all is good as it is playing the menu music. I want the sound to play when you click start/save/load. I converted the file from wav to ogg as it wasn't playing the wav. I will examine the file

Edit, I will post the file later
Edit 2, The file wont play. I have downloaded a new file.
Thanks for the help. will keep you updated on the new file.

(This time i iwll use audacity to convert it.)

I have a bew file converted with Audacity, the file plays in winamp/vlc etc. But not in renpy. I added the file to look.

Update 3: Since im looking for someone to help or make a custom gui i iwll move this asside for now.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,365
15,281
Checked volume all is good as it is playing the menu music. I want the sound to play when you click start/save/load.
I stop you right there. This is the reason why it's not working.

As I said, the change you made apply for menus presented through the menu statement. But where you want it to apply is menu embedded in a screen. What you are looking is effectively located in the "screen.rpy" file, but it's the "quick_menu" and "navigation" screen that you want to modify, because it's where are the menu you want to sound.
 
  • Like
Reactions: Mescalino

Mescalino

Active Member
Aug 20, 2017
937
6,633
I stop you right there. This is the reason why it's not working.

As I said, the change you made apply for menus presented through the menu statement. But where you want it to apply is menu embedded in a screen. What you are looking is effectively located in the "screen.rpy" file, but it's the "quick_menu" and "navigation" screen that you want to modify, because it's where are the menu you want to sound.
Ah thanks. Well since that menu horribly on the left side will be gone in the new GUI i will stop playing with this for now but thanks for the information.