ATL animation + sound effect

DoctorPervic

Well-Known Member
Game Developer
Aug 13, 2019
1,060
4,391
Hello, I'm trying to figure out how to add a sound effect to my ALT animations. Below is a simple string of images I call to play an animation.
I just use the show and hide commands to show the animations.
show ease_in
hide ease_in
show short_loop
hide short_loop


What I want to know is how can I play a sound file, like a fucking sound or girl moaning sound for every other image. for example. play a girl moaning every image 5 or play the fucking sound effect for whatever image I need to show full penetration.

Here is the code I use in my animation, any help is greatly appreciated. Thanks

Code:
default animDelay=0.2

### I usually put these in a seperate file or even more than one since they get long
image ease_in:
    "tst_1.jpg"
    0.2
    "tst_2.jpg"
    0.2
    "tst_3.jpg"
    0.2
    "tst_4.jpg"
    0.2
    "tst_5.jpg"
    0.2
    "tst_6.jpg"
    0.2
    "tst_7.jpg"

image short_loop:
    "tst_6.jpg"
    0.2
    "tst_5.jpg"
    0.2
    "tst_4.jpg"
    0.2
    "tst_3.jpg"
    0.2
    "tst_2.jpg"
    0.2
    "tst_1.jpg"
    0.2
    "tst_2.jpg"
    0.2
    "tst_3.jpg"
    0.2
    "tst_4.jpg"
    0.2
    "tst_5.jpg"
    0.2
    "tst_6.jpg"
    0.2
    "tst_7.jpg"
    0.2
    repeat
 

DoctorPervic

Well-Known Member
Game Developer
Aug 13, 2019
1,060
4,391
So I think I figured out one way, but other ways are always appreciated or if this way can be improved.

So I use

Code:
init -1 python:
    def play_effect(trans, st, at):
        renpy.play("audio/moan.ogg")
then

Code:
image ease_in:
    "tst_1.jpg"
    0.2
    "tst_2.jpg"
    0.2
    "tst_3.jpg"
    0.2
    "tst_4.jpg"
    function play_effect
    0.2
    "tst_5.jpg"
    0.2
    "tst_6.jpg"
    0.2
    "tst_7.jpg"
function play_effect plays the sound file for each image.

now what I need to do is learn how to create a list to randomize the moan sound effects.
 
  • Like
Reactions: ErgoVis

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,125
14,803
So I think I figured out one way, but other ways are always appreciated or if this way can be improved.
I don't think there's one. As its name say, the "Animation and Transformation Language" is here to help you animate and transform, therefore it focus on the visual and nothing else.


now what I need to do is learn how to create a list to randomize the moan sound effects.
One way to do this is:
Python:
# List of all the possible moaning sounds.
define moaningSounds = [ "audio/moan.ogg", "audio/moan1.ogg", "audio/moan2.ogg" ]

init python:
    # Renamed to give it a more obvious name. It always help to have obvious names.
    def play_moaning(trans, st, at):
        # Let the /random/ module pick a sound for you, among the list provided.
        renpy.play( renpy.random.choice( moaningSounds ) )
 
  • Like
Reactions: DoctorPervic

DoctorPervic

Well-Known Member
Game Developer
Aug 13, 2019
1,060
4,391
I was able to get it done by doing something similar.

Code:
default soundList=["audio/moan1.ogg", "audio/moan2.ogg", "audio/moan3.ogg", "audio/moan4.ogg"]
default randomSound="audio/moan1.ogg"
init -1 python:
    def play_effect(trans, st, at):
        randomSound =  renpy.random.choice(soundList)
        renpy.play(randomSound )
 
  • Like
Reactions: ErgoVis