Skip to contents

Clip a splice so segments are of fixed duration

Usage

clip_splice(splice_dfr, duration, location = "middle")

Arguments

splice_dfr

Splice object.

duration

window duration in seconds.

location

'beginning', 'middle' or 'end'.

Value

a Splice object.

Examples

l <- list(a = c(10, 20), b = c(30, 40),c = c(50, 55))
splice_dfr <- splice_time(l)
clip_splice(splice_dfr, duration = 1)
#>   Segment Start  End
#> 1       a  14.5 15.5
#> 2       b  34.5 35.5
#> 3       c  52.0 53.0
clip_splice(splice_dfr, duration = 6)
#> Warning: Segments too short to clip to duration - using start or end point of segment
#>   Segment Start End
#> 1       a    12  18
#> 2       b    32  38
#> 3       c    50  55
clip_splice(splice_dfr, duration = 1, location = 'beginning')
#>   Segment Start End
#> 1       a    10  11
#> 2       b    30  31
#> 3       c    50  51
clip_splice(splice_dfr, duration = 10, location = 'beginning')
#> Warning: Segments too short to clip to duration - using end point of segment
#>   Segment Start End
#> 1       a    10  20
#> 2       b    30  40
#> 3       c    50  55
clip_splice(splice_dfr, duration = 1, location = 'end')
#>   Segment Start End
#> 1       a    19  20
#> 2       b    39  40
#> 3       c    54  55
clip_splice(splice_dfr, duration = 10, location = 'end')
#> Warning: Segments too short to clip to duration - using start point of segment
#>   Segment Start End
#> 1       a    10  20
#> 2       b    30  40
#> 3       c    50  55