Best Way to Use Barks / Chirps (short audio clips) Repeatedly

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
Destiny-Smasher
Regular
Posts: 29
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Best Way to Use Barks / Chirps (short audio clips) Repeatedly

#1 Post by Destiny-Smasher » Tue Aug 09, 2022 9:41 am

So I've gotten a batch of voiceover to use for my visual novel - some of it are voice lines, and I can incorporate those manually at the specific points they are used.

However, the vast majority of voice clips I plan to use for this VN will be barks/chirps, quick, shorter noises just to give some personality to imply the mood of a line of dialogue.

What I don't know is the most efficient way to implement them.

Because right now, it looks like this:
voice "audio/voice/Nishiko VO/barks/n_umm2.ogg"
n frown2 "Ummm...?"
Where 'frown2' is a specific face expression sprite. I would figure there might be some way to tag and code voice clips in a similar way to sprites, but I'm not sure how to do it and haven't seen a way to do so - most searches for how to use voice clips involve the 'auto' function or just using them in the first place.

Even if it means the end result would look more like
voice "n umm2"
n frown2 "Ummm...?"
that would still be a lot easier to integrate - though for all I know there's a way to use voicelines in the same line of code as dialogue.

Does anyone have any advice on this? I have a whole batch of clips for different characters, with similar naming conventions, divided into folders to keep them organized.

User avatar
enaielei
Regular
Posts: 114
Joined: Fri Sep 17, 2021 2:09 am
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Best Way to Use Barks / Chirps (short audio clips) Repeatedly

#2 Post by enaielei » Tue Aug 09, 2022 9:48 am


User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Best Way to Use Barks / Chirps (short audio clips) Repeatedly

#3 Post by m_from_space » Tue Aug 09, 2022 9:59 am

Every audio file Renpy finds inside the "audio" folder will be part of the audio object. So you can access them via audio.filename (stripping the extension). You could also just use the filename itself, stipping the extension, since voice is looking inside the audio object. (I don't know the details of the process.)

Code: Select all

voice audio.n_umm2
n frown2 "Ummm...?"

voice n_umm2
n frown2 "Ummm...?"
If your characters only use specific sounds repeatedly, you could implement character callbacks for those sounds specifically:
https://www.renpy.org/doc/html/character_callbacks.html

Code: Select all

define mc = Character("Main Character")
define mc_umm1 = Character(kind=mc, callback=chirpVoice1)
define mc_umm2 = Character(kind=mc, callback=chirpVoice2)

init python:
    def chirpVoice1(event, interact=True, **kwargs):
        if event == "begin":
            renpy.play(audio.n_umm1)
        return
...

label start:
    mc "Hello, I'm not chirping."
    "What?"
    mc_umm1 "Ummm...?"
    "Funny."
    mc_umm2 "Another sound plays when I start talking."

User avatar
Destiny-Smasher
Regular
Posts: 29
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Re: Best Way to Use Barks / Chirps (short audio clips) Repeatedly

#4 Post by Destiny-Smasher » Fri Aug 12, 2022 9:55 am

Great!

Even just

voice n_umm2
n frown2 "Ummm...?"

is going to make things way more convenient. I may look into that second option but I have a lot of barks even just in my first batch of VO, so it may just be easier to use the first method and just give my files universal, simple filenames.

Thanks so much for the help! I knew I was missing something.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]