Text display sound?
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.
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.
Text display sound?
Hi everyone,
I just have a quick question. Is it possible in renpy to have a sound effect playing while text is being displayed? Like in Phoenix Wright, with the "blipping" sound that happens every few characters ot text, when characters are talking, kinda like a speech emulation without any words actually being said.
It's possible to create custom sound clips for each sentence yes, but if it were possible to do it dynamically based on sentence length (time) it would be much easier....
I just have a quick question. Is it possible in renpy to have a sound effect playing while text is being displayed? Like in Phoenix Wright, with the "blipping" sound that happens every few characters ot text, when characters are talking, kinda like a speech emulation without any words actually being said.
It's possible to create custom sound clips for each sentence yes, but if it were possible to do it dynamically based on sentence length (time) it would be much easier....
haha yes!
I'm absolutely new (today!) to ren'py, python and haven't coded anything in years, but I was trying to figure out a way to perhaps output 1 character at a time. Here's how I was trying it. The output does not show properly at all, literally showing "%(dtxt)s" (though it does do it a number of times that corresponds with the length of the string). Other details include a need to have it somehow output each character onto the same line, ability to stagger the speed of the text, and inserting an actual sound. For my purposes i wouldn't need rollback to work with this.
[/code]
I'm absolutely new (today!) to ren'py, python and haven't coded anything in years, but I was trying to figure out a way to perhaps output 1 character at a time. Here's how I was trying it. The output does not show properly at all, literally showing "%(dtxt)s" (though it does do it a number of times that corresponds with the length of the string). Other details include a need to have it somehow output each character onto the same line, ability to stagger the speed of the text, and inserting an actual sound. For my purposes i wouldn't need rollback to work with this.
Code: Select all
python:
def stxt(sinput): #sinput = string input
stext = list(sinput) #parse string character by character into list
for ltxt in stext: #ltxt = list text,
dtxt = ltxt #dtxt = display text
say("Speaker", "%(dtxt)s")
return
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
Hm... that code won't work, because it just doesn't fit into the way Ren'Py does user interaction.
If you wrote
"%(dtxt)s" % locals()
then it would start working, but since the say statement waits for a pause, it would show one character per click, which probably isn't what you want.
To get slow text, you want to go into Preferences and adjust down the text speed slider. There's code to do that the first time a user starts a game at:
http://www.renpy.org/wiki/renpy/doc/coo ... ed_Setting
You probably want to drop 100 to something more reasonable.
Now, as to the sound... it would be easiest if I add it myself. Do you have a sound effect I can use for testing purposes? If so, please email it over to me.
If you wrote
"%(dtxt)s" % locals()
then it would start working, but since the say statement waits for a pause, it would show one character per click, which probably isn't what you want.
To get slow text, you want to go into Preferences and adjust down the text speed slider. There's code to do that the first time a user starts a game at:
http://www.renpy.org/wiki/renpy/doc/coo ... ed_Setting
You probably want to drop 100 to something more reasonable.
Now, as to the sound... it would be easiest if I add it myself. Do you have a sound effect I can use for testing purposes? If so, please email it over to me.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Heh, registered and waiting for the activation mail....
In the meantime:
http://youtube.com/watch?v=6ik7s-C2ycU <---this is an example of the effect I am trying to recreate. Phoenix Wright's engine seems to allow mid-text box text speed changes. That'd be cool to have, but I'd be happy with just blipping haha.
ttp://omoshiroi.info/files/blip.wav <---here is a blipping sound. if there'd be a way to have it blip every time X number of characters was output in a text box...
In the meantime:
http://youtube.com/watch?v=6ik7s-C2ycU <---this is an example of the effect I am trying to recreate. Phoenix Wright's engine seems to allow mid-text box text speed changes. That'd be cool to have, but I'd be happy with just blipping haha.
ttp://omoshiroi.info/files/blip.wav <---here is a blipping sound. if there'd be a way to have it blip every time X number of characters was output in a text box...
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
Well, I don't have any plans for mid-box text speed changes, since that would be kinda hard with the current design of Ren'Py. (Which assumes the text speed is a constant, and so just multiplies time by speed to get the number of characters to show.)
I'll see what I can do with the blipping.
(The problem is, I generally dislike the text speed control, prefering instant text. So I'm not highly motivated to put much work into what I consider to be a mis-feature.)
I'll see what I can do with the blipping.
(The problem is, I generally dislike the text speed control, prefering instant text. So I'm not highly motivated to put much work into what I consider to be a mis-feature.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
Actually, looking at this, I'm somewhat worried that Ren'Py's 1/10th or so of a second resolution on sounds is a bit too large for this purpose. So I'll probably hold off on the blipping for a while.
(Unless I change my mind again today.)
(Unless I change my mind again today.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
*hopes he changes his mind xD*
In my opinion 1/10th of a second should be enough resolution. The sound clip I provided is short but if you want i can give you a bigger one with some silence inserted. Essentially, it would only have to "blip" 2 or 3 times a second, i think? Or at a rate derived from the # of characters over time divided by 2 or 3 (does that make sense? i'm sleep deprived lol)
In my opinion 1/10th of a second should be enough resolution. The sound clip I provided is short but if you want i can give you a bigger one with some silence inserted. Essentially, it would only have to "blip" 2 or 3 times a second, i think? Or at a rate derived from the # of characters over time divided by 2 or 3 (does that make sense? i'm sleep deprived lol)
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
Okay, I've decided that the way to go is to add some callbacks to Character, which would be enough to come up with a cookbook recipie that implements the "slow text talking" feature.
I need to determine exactly what callbacks would be useful. I'm thinking something like:
1. "begin" - begin saying a line of dialogue.
2. "show" - called when part of a line of dialogue is shown to the screen. May be called several times, if there are pauses in the dialoge.
3. "slow_done" - called when slow text finishes showing.
4. "end" - called when we're done saying a line of dialogue.
Note that if interact=False, 3 may occur after 4.
So with this, we could write something like:
I need to determine exactly what callbacks would be useful. I'm thinking something like:
1. "begin" - begin saying a line of dialogue.
2. "show" - called when part of a line of dialogue is shown to the screen. May be called several times, if there are pauses in the dialoge.
3. "slow_done" - called when slow text finishes showing.
4. "end" - called when we're done saying a line of dialogue.
Note that if interact=False, 3 may occur after 4.
So with this, we could write something like:
Code: Select all
init:
python:
def callback(event, **kwargs):
if event == "show":
renpy.sound.queue("talking.ogg")
elif event == "slow_done" or event == "end":
renpy.sound.stop()
lawyer = Character("Fawkes Right", callback=callback)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
If I understand correctly, the code you described could also allow one to run a mouth moving animation while the text is displaying?
Sounds good at any rate!
As an aside, my attempt to register on the forums seems to have failed; I didn't recieve the authorization e-mail D:
I'll try again from a different account once the name I signed up with expires...
Sounds good at any rate!
As an aside, my attempt to register on the forums seems to have failed; I didn't recieve the authorization e-mail D:
I'll try again from a different account once the name I signed up with expires...
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
At least theoretically, yes.Blitzwing02 wrote:If I understand correctly, the code you described could also allow one to run a mouth moving animation while the text is displaying?
I went ahead and activated your Blitzwing01 account by hand. I suggest you change the email, so it doesn't bounce onto poor lemma's lap.As an aside, my attempt to register on the forums seems to have failed; I didn't recieve the authorization e-mail D:
I'll try again from a different account once the name I signed up with expires...
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Resurrecting this for one question : you say mid-text speed changing is not feasible (and I see why), but could it be settable per text-screen?
I'll admit outright that I'm in a Phoenix Wright craze right now and I want to see how much of its style is doable in Ren'Py ... I have the shaking... but there would be a need for a change of speed for at least some sentences. The game has a way to let you feel the tone and feelings behind sentences just through speed and associated expressions. People slowing down at the end of an unfinished sentence and so on... impressive trick, no need for voice acting .
Anyway... the other needed thing is mid-text changes of the displayed sprites, such as someone going from smile to frown in the middle of a sentence... but I have an idea for this one : use the "no interaction" option for the beginning of the sentence and follow it with the graphical change and then a regular text line to finish the sentence. Haven't tried it but that would work, right?
I'll admit outright that I'm in a Phoenix Wright craze right now and I want to see how much of its style is doable in Ren'Py ... I have the shaking... but there would be a need for a change of speed for at least some sentences. The game has a way to let you feel the tone and feelings behind sentences just through speed and associated expressions. People slowing down at the end of an unfinished sentence and so on... impressive trick, no need for voice acting .
Anyway... the other needed thing is mid-text changes of the displayed sprites, such as someone going from smile to frown in the middle of a sentence... but I have an idea for this one : use the "no interaction" option for the beginning of the sentence and follow it with the graphical change and then a regular text line to finish the sentence. Haven't tried it but that would work, right?
I have to wonder if you could implement text-speed effects with style tags. Thus...monele wrote:Resurrecting this for one question : you say mid-text speed changing is not feasible (and I see why), but could it be settable per text-screen?
e "My morning caffeine hasn't kicked on yet... {speed=50}oh, wait, now I think I feel something!{/speed}"
Of course, this would 'read' radically different if the user set his default text speed to 25 vs 0/100.
Ultimately, I worry that though you can spend a large amount of time setting up pretty text effects, many pf them 'break' if the user sets the text speed to max. So you either have to program an extra level fo workaround to accommodate a different effect if they do so- or you have to be 'evil' and override the user's text preferences.
(In my case I'm leaning towards being evil on a very local scale, force-slowing a seldom-used narration dialog only.)
That seems to be what the (currently broken) slow_speed does anyway, so...
If you wanted to use style tags, you could make them relative... {speed=50%} (half) or {speed=200%} (double.)
If the speed was already '0', using those as multipliers wouldn't affect the test speed- it would remain 'infinite.'
Who is online
Users browsing this forum: Semrush [Bot]