Sound/Movie Partial Playback

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
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:

Sound/Movie Partial Playback

#1 Post by PyTom »

As of Ren'Py 6.99.9, it will be possible to play back portions of an audio or video file.

The syntax I've chosen for this feature involves angle brackets at the start of the filename string, which contain optional start and stop times, separated with a dash.

The audio filename "<-15.5>karaoke.ogg" will play the first 15.5 seconds of karaoke.ogg. The filename "<22->karakoke.ogg" will play from 22 seconds to the end of the file. The missing portion could be played with "<15.5-22>karaoke.ogg", which plays for 6.5 seconds.

The reason for this syntax is that Ren'Py already uses strings to represent sound files, and so it's easier to pass this around a "filename", rather than dealing with special objects, syntax, etc.


Notably, this will allow one of the most requested features. Using code like:

Code: Select all

play music "neverending.ogg"
queue music "<12.2->neverending.ogg"
It's possible to play a song that has an intro, and then seamlessly loop a section of that song, using only a single file.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Sound/Movie Partial Playback

#2 Post by korova »

What a great piece of news!
I've been dreaming about this feature for a long time...

Thanks for this, Pytom!

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Sound/Movie Partial Playback

#3 Post by jack_norton »

Cool that will be useful in some cases :)
follow me on Image Image Image
computer games

AXYPB
Regular
Posts: 95
Joined: Thu Sep 04, 2014 3:04 am
Github: AXYPB
Contact:

Re: Sound/Movie Partial Playback

#4 Post by AXYPB »

How precise can time arguments be?

User avatar
uyjulian
Regular
Posts: 128
Joined: Sun Mar 08, 2015 1:40 pm
Github: uyjulian
Contact:

Re: Sound/Movie Partial Playback

#5 Post by uyjulian »

Is it possible to play by samples as well as by seconds?
If so, this update will be even nicer... since giant floating point numbers is annoying

User avatar
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: Sound/Movie Partial Playback

#6 Post by PyTom »

I'm planning on floating point times, since this happens after sample rate conversion.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
csky
Regular
Posts: 93
Joined: Sun Sep 14, 2014 3:46 pm
Completed: Perceptions of the Dead, Embers of Magic
Projects: Various Commissioned Artwork
Contact:

Re: Sound/Movie Partial Playback

#7 Post by csky »

This is great! Thank you for this feature, it will be very useful compared to fiddling around with dozens of different tracks.

Question: Will there be the possibility to fade out the track into itself, so that sounds that have tails won't be jarringly stopped?
For example, if you are playing between point A and B, when the loop point is reached, A starts playing again, but the tail of B(A few milliseconds after point B) fades out while A starts playing.

User avatar
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: Sound/Movie Partial Playback

#8 Post by PyTom »

I've tweaked this a bit, so the syntax is a lot of more understandable and extensible. Here are some examples:

* "<from 5.5 to 10.75>foo.ogg" plays foo.ogg from the 5.5 to the 10.75 second points. You can also use the from and to clauses individually.

* "<loop 3.21>bar.ogg" will play bar.ogg all the way through once, and then on the second and later loops, start 3.21 seconds in.

* "<silence 1.5>" will play 1.5 seconds of pure silence. (Note that no filename is required.)

csky>>> I don't think what you want makes sense to include in Ren'Py. It's the domain of digital audio programs that can do beat-matching and so on. I think it makes sense to pre-bake that overlap into the end of the track, and then loop back to a clean part in the middle.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

ReAnimator
Regular
Posts: 67
Joined: Mon Dec 16, 2013 1:00 pm
Contact:

Re: Sound/Movie Partial Playback

#9 Post by ReAnimator »

Hi,
is it possible to specify the frame instead of time for video playback?

User avatar
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: Sound/Movie Partial Playback

#10 Post by PyTom »

No, other than by converting.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

ReAnimator
Regular
Posts: 67
Joined: Mon Dec 16, 2013 1:00 pm
Contact:

Re: Sound/Movie Partial Playback

#11 Post by ReAnimator »

Thanks, PyTom.
I'm not used to work with this unit but it works alright.
This is really great, powerful feature. Really appreciate that you implemented!

Post Reply

Who is online

Users browsing this forum: No registered users