Play a sound twice? Help!

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
Shaylayy
Newbie
Posts: 5
Joined: Mon Jan 19, 2015 6:39 pm
Deviantart: IceWolfNight98
Contact:

Play a sound twice? Help!

#1 Post by Shaylayy »

Hi.
I'm really new here.

I have a scene where two sound effects are played twice. But it only works the first time.

Here is my code:

Code: Select all

    play sound "punch1.ogg"
    
    show glomp at left
    with hpunch
    
    sa "Shay! <3"
    
    sh "Uwah!!"
    
    play sound "impact1.ogg"
This one works.

But this code, using the exact same sound files:

Code: Select all

    sh "Do you know why you're here-"
    
    play sound "punch1.ogg"
    
    $ creator = 'surprised_talk'
    $ sade = 'shockblush'
    $ shayflip = 'neutral'

    i "Creator's here!"
    
    play sound "impact1.ogg"
...doesn't work for some reason.

No one else seems to have this issue so maybe I'm overlooking something.
Please help! Thanks!

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Play a sound twice? Help!

#2 Post by mjshi »

Two things--

1. This might not help, but is it possible the problem is caused by the wait time inbetween the two sfx segments? If there is even a minimal chance of this being the case, I would like to ask you to please do 2)

2. Could you paste the code between the first example and the second example? i.e, give us

Code: Select all

[segment inbetween][code that doesn't work], or perhaps paste the entire scene if it isn't too long?

Shaylayy
Newbie
Posts: 5
Joined: Mon Jan 19, 2015 6:39 pm
Deviantart: IceWolfNight98
Contact:

Re: Play a sound twice? Help!

#3 Post by Shaylayy »

@ mjshi

Thanks so much for your suggestions.
I actually managed to solve it. I added in some transitions directly underneath the 'play sound' commands and they suddenly started working.

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Play a sound twice? Help!

#4 Post by mjshi »

An unreliable method, to be sure, but I'm glad you managed to solve it xD

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Play a sound twice? Help!

#5 Post by philat »

Well, assuming that the transitions take time, it sounds like it was just the second sound effect cutting off the first. Just try to make sure there's enough time between the first and second sound effects.

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Play a sound twice? Help!

#6 Post by mjshi »

^
Yes, so it may be possible to solve simply by adding "pause 3" or something like that inbetween the segments.

Post Reply

Who is online

Users browsing this forum: Imperf3kt