Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adamatronix opened this issue May 18, 2023 · 4 comments

Comments

@adamatronix
Copy link

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.

@lyswhut
Copy link
Owner

lyswhut commented May 18, 2023

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>)

@adamatronix
Copy link
Author

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]

@lyswhut
Copy link
Owner

lyswhut commented May 18, 2023

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

@lyswhut
Copy link
Owner

lyswhut commented Dec 29, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants