Get lyrics time #293
-
Hello! Thanks for your library! i'm using it a while. I'm trying to get lyrics time and attach them to the notes. With notes everything is fine - i use converter and get times for them which are adequate and checked. With lyrics first i'm getting absolute time by adding the deltaTimes, but numbers are significantly different. And actually i don't understand what they are. {0, 12, 24, 6, 300} ( probably "300" - is an event came from another track?) In comments near deltaTimes it is written: But timeDivision of tempoMap doesn't hold the value. In documentation i haven't found the right conversion for this. https://melanchall.github.io/drywetmidi/articles/high-level-managing/Time-and-length.html Could you help, please? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi,
You didn't provide an algorithm or even code, so I can't answer the question. I'm not a mind reader unfortunately :-)
The main goal of the library is to provide easy solutions for common practical tasks. Of course you don't need to sum delta-times. Here a sample code which, I hope, answers your questions. var tempoMap = midiFile.GetTempoMap();
var lyricTimedEvents = midiFile
.GetTimedEvents()
.Where(e => e.Event.EventType == MidiEventType.Lyric);
foreach (var e in lyricTimedEvents)
{
var metricTime = e.TimeAs<MetricTimeSpan>(tempoMap);
var lyricText = ((LyricEvent)e.Event).Text;
} Please read articles in the Articles section of the library docs. |
Beta Was this translation helpful? Give feedback.
Hi,
You didn't provide an algorithm or even code, so I can't answer the question. I'm not a mind reader unfortunately :-)
The main goal of the library is to provide easy solutions for common practical tasks. Of course you don't need to sum delta-times. Here a sample code which, I hope, answers your questions.