admin管理员组

文章数量:1124549

var lyricTimedEvents = midiFile.GetTimedEvents().Where(e => e.Event.EventType == MidiEventType.Lyric);
        
         Console.WriteLine($"{z} timed events found.");

           foreach (var e in lyricTimedEvents)
           {
             var metricTime = e.TimeAs<MetricTimeSpan>(tempoMap);
             var lyricText = ((LyricEvent)e.Event).Text;
            Console.Write($@"       
                                 [{metricTime:mm\:ss\.fff}]{lyricText}");
           }

//output looks like this [hours:minutes:seconds:miliseconds] or [00:01:12:123]

         tempoMap = midiFile.GetTempoMap();
      TimeSpan midiFileDuration = midiFile.GetDuration<MetricTimeSpan>();

      Console.WriteLine($"            Midi File duration [ {SONG} ] = {midiFileDuration}");
      Console.ReadKey();
           foreach (var chord in midiFile.GetChords())
           {
             var timeSpan = (TimeSpan)chord.TimeAs<MetricTimeSpan>(tempoMap);
             Console.Write($@"       
                               [{timeSpan:mm\:ss\.fff}]{chord}");
           }

// Output look [min:sec.milisec] or [00:02.122] I need this format for time in lyrics // How I can get it ? I need one dot before miliseconds

本文标签: cHow I can get specific time format for lyrics event DryWetMidi libraryStack Overflow