Audio Duration Bar [solved]
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.
- Morhighan
- Miko-Class Veteran
- Posts: 975
- Joined: Sun Jun 27, 2010 12:54 pm
- Completed: AIdol, When Our Journey Ends, Forgotten Not Lost
- Organization: MysteryCorgi
- Tumblr: MysteryCorgi
- Deviantart: MysteryCorgi
- Soundcloud: MysteryCorgi
- itch: MysteryCorgi
- Location: USA
- Contact:
Audio Duration Bar [solved]
I was wondering if it would be possible/not terribly difficult to add an audio duration bar for spoken lines in one of my games, so players will know when the voice actor is done talking. Some performers add pauses to the dialogue, which is good, but it may come off as confusing. I'm not entirely sure how to program this, to be honest, so I thought I'd come to the forum for help.
Something like the attached image perhaps?
Something like the attached image perhaps?
Last edited by Morhighan on Sun Jan 15, 2017 1:22 pm, edited 1 time in total.
- Kia
- Eileen-Class Veteran
- Posts: 1040
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
- Contact:
Re: Audio Duration Bar
I think you can get the info about playing audio with https://www.renpy.org/doc/html/voice.ht ... voice_info
I'm sure there are more of these _get commands for audio channels, search the documentation
I'm sure there are more of these _get commands for audio channels, search the documentation
- 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: Audio Duration Bar
You can probably use a bar with AudioPositionValue(channel='voice') to do this.
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
Re: Audio Duration Bar
I tried to use AudioPositionValue() but the bar gets filled in a few seconds even though the audio has more than one minute duration.
I also tried to use renpy.music.get_pos() and renpy.music.get_duration() but then the bar is instant filled at once.
Help please!
Code: Select all
bar:
value AudioPositionValue(channel='music')
xsize 500
xmaximum 500
Code: Select all
bar:
value renpy.music.get_pos(channel='music')
range renpy.music.get_duration(channel='music')
xsize 500
xmaximum 500
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Audio Duration Bar
AudioPositionValue() works no problem for me. There's nothign wrong on your code. So problem is different: bar style or music declaration.
BTW, renpy.music.get_pos(channel='music') won't work in this case, because it's only updated at interaction, not real time.
BTW, renpy.music.get_pos(channel='music') won't work in this case, because it's only updated at interaction, not real time.
Re: Audio Duration Bar
nyaatrap, would you mind checking this test project?
I'm using the new GUI, no changes on styles.
I'm using the new GUI, no changes on styles.
Code: Select all
screen audio_duration():
bar:
value AudioPositionValue(channel='music')
xalign 0.5
yalign 0.5
xsize 500
xmaximum 500
label start:
image bg black = "#000000"
$ bgm_test = "test.mp3"
scene bg black
play music bgm_test
#play music "test.mp3"
call screen audio_duration
return
- Attachments
-
- Music Loop.zip
- (6.69 MiB) Downloaded 55 times
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Audio Duration Bar
Problem is mp3. Converting music into ogg solved problem.
Re: Audio Duration Bar
Many thanks nyaatrap ♡
- Morhighan
- Miko-Class Veteran
- Posts: 975
- Joined: Sun Jun 27, 2010 12:54 pm
- Completed: AIdol, When Our Journey Ends, Forgotten Not Lost
- Organization: MysteryCorgi
- Tumblr: MysteryCorgi
- Deviantart: MysteryCorgi
- Soundcloud: MysteryCorgi
- itch: MysteryCorgi
- Location: USA
- Contact:
Re: Audio Duration Bar
Problem solved!
Re: Audio Duration Bar
Big big newbie here! Sorry to come back to this so late. This works great! Any idea how to make this user adjustable? So I can see its duration but also adjust it as its playing? Thanks in advance!Kaen wrote: ↑Tue Dec 20, 2016 1:07 pm nyaatrap, would you mind checking this test project?
I'm using the new GUI, no changes on styles.
Code: Select all
screen audio_duration(): bar: value AudioPositionValue(channel='music') xalign 0.5 yalign 0.5 xsize 500 xmaximum 500 label start: image bg black = "#000000" $ bgm_test = "test.mp3" scene bg black play music bgm_test #play music "test.mp3" call screen audio_duration return
Who is online
Users browsing this forum: Andredron