Making background noise stop when characters speak?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
ShojiAmasawa
Veteran
Posts: 211
Joined: Fri May 11, 2012 5:26 pm
Completed: EVOLVEd: Echoes Of The Codex War, [ASH] the Seeds of Destruction
Projects: Cult of the Lily (18+)
Organization: PaperDoor Studios
Tumblr: paperdoorstudios
Deviantart: ShojiAmasawa
Soundcloud: Greyberry
Location: Cloudbase
Contact:

Making background noise stop when characters speak?

#1 Post by ShojiAmasawa »

Unfortunately, I could not think of a way this question would make sense out of context, so I should say that this is regarding my 18+ WiP. I was unsure if questions involving adult content were allowed here, but there isn't a section for technical questions under the adult board. For caution's sake I will spoiler tag the following problem. Please remove or relocate the thread if appropriate.
While coding a scene for the demo of my game Cult of the Lily, I ran into an unexpected problem. The scene is voiced, and the voice actress provided some sexy vocalizations as well as the lines of dailogue. What I want to happen is for the vocalisations to play under the narration on a loop, only stopping when the character speaks a line of dialogue. What happens instead is that the sexy sounds play under the dialogue, which is very distracting. The looping is easy, but the only way I can get the general effect I want is to start and stop the recording with each line of dialogue, which seems needlessly difficult.

I have the sounds in a separate "voice" channel called "hentai". Here is an example of what the script looks like:

Options

Code: Select all

    renpy.music.register_channel("hentai", "voice", True)
Script

Code: Select all

voice "Voice_file_9.wav"

su "Blablabla I am an example"
 
play hentai "Sexy_voice_file_1.wav"

voice "Voice_file_9.wav

su "More examples"
This seems to be standard in most mainstream eroge, but I am completely lost on how to do it. I have not been able to find a similar problem posted here, but I never know exactly what to look up. Forgive me if there is already an answer to this somewhere, and kindly link me to it. Also, please let me know if any more information is needed.
Thank you!
~Shoji~

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making background noise stop when characters speak?

#2 Post by PyTom »

Have you taken a look at config.emphasize_voice?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
ShojiAmasawa
Veteran
Posts: 211
Joined: Fri May 11, 2012 5:26 pm
Completed: EVOLVEd: Echoes Of The Codex War, [ASH] the Seeds of Destruction
Projects: Cult of the Lily (18+)
Organization: PaperDoor Studios
Tumblr: paperdoorstudios
Deviantart: ShojiAmasawa
Soundcloud: Greyberry
Location: Cloudbase
Contact:

Re: Making background noise stop when characters speak?

#3 Post by ShojiAmasawa »

PyTom wrote:Have you taken a look at config.emphasize_voice?
I don't seem to have that anywhere in the Options file. I tried adding it and it returned an error.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/options.rpy", line 329, in script
    init -1 python hide:
  File "game/options.rpy", line 351, in <module>
    config.emphasize_voice
Exception: config.emphasize_voice is not a known configuration variable.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/options.rpy", line 329, in script
    init -1 python hide:
  File "/Applications/renpy-6.99.6-sdk/renpy/ast.py", line 805, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/Applications/renpy-6.99.6-sdk/renpy/python.py", line 1460, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/options.rpy", line 351, in <module>
    config.emphasize_voice
  File "/Applications/renpy-6.99.6-sdk/renpy/defaultstore.py", line 80, in __getattr__
    raise Exception('config.%s is not a known configuration variable.' % (name))
Exception: config.emphasize_voice is not a known configuration variable.

Darwin-15.3.0-x86_64-i386-64bit
Ren'Py 6.99.7.858
Cult of the Lily 0.0
Not entirely sure how I should be handling this.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making background noise stop when characters speak?

#4 Post by PyTom »

Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Bing [Bot]