lrc-file-parser icon indicating copy to clipboard operation
lrc-file-parser copied to clipboard

Is there a way to pass in an offset value, to shift all time stamps a certain amount?

Open adamatronix opened this issue 1 year ago • 4 comments

I'm a bit new to lrc files, but essentially the audio file i am using is from the music video and it has an intro which the lrc doesnt account for. If possible I would like to shift all the time stamps a certain amount without have to edit each line directly.

adamatronix avatar May 18 '23 09:05 adamatronix

You can use the offset option, which will apply to all lyrics and be calculated separately from the offset tag value inside each lyrics:

var lrc = new Lyric({
  offset: 150, // offset time(ms), default is 150 ms
  // ...
})

But currently this option does not provide a method to update it, you can use lrc.offset = <new offset value> to update it, and then re-call lrc.play(<current time>)

lyswhut avatar May 18 '23 09:05 lyswhut

Thanks for the response. What was happening for me, when setting the offset to say 10000ms, it would start the lines at [00:10.61] and ignore all the lines before it. I would want [00:10.61] to be [00:20.61]

adamatronix avatar May 18 '23 09:05 adamatronix

Sorry, I don't understand what you mean, can you give a detailed example? offset will offset the playback time of all lines

lyswhut avatar May 18 '23 09:05 lyswhut

In what scenario do you have to do this? Does this seem to want to intercept the lyrics of some time? For this situation, I think it should provide a Hook method similar to afterParse. It is called after parsing the original lyrics. You can modify the parsed lyrics then return.

lyswhut avatar Dec 29 '23 03:12 lyswhut