jazz-soft/JZZ-midi-SMF

smfText at tick(0) does not appear in output

keithxemi opened this issue · 5 comments

.smfText('@TMary Was A Little Lame') // Karaoke player will recognize this track by the "@T" tag
.tick(0).smfText('\\Ma') // New verse starts with a backslash "\"
.tick(75).smfText('ry ')
.tick(25).smfText('was ')

Seems to works properly for me...
Can you please provide more details on how to reproduce the error?

When I use the Page source html from this https://jazz-soft.net/demo/WriteMidiFile.html and change the first tick from 100 to 0 as shown in my first comment, the text "Ma" is missing. I see this in both MuseScore and Cakewalk event list. Changing the tick to 1 makes it work.

.tick(0).smfText('\Ma') //text is missing
.tick(1).smfText('\Ma') //text appears
.tick(100).smfText('\Ma') // New verse starts with a backslash ""

I don't have MuseScore or Cakewalk.
For testing, I have added a new test at https://github.com/jazz-soft/test-midi-files
Here is the script that generates the midi file: https://github.com/jazz-soft/test-midi-files/blob/main/code/test-karaoke-kar.js
Here is the midi file contents (obtained by running node index midi/test-karaoke-kar.mid print)

SMF:
  type: 1
  ppqn: 100
  tracks: 3
MTrk:
  0: ff03 -- Sequence Name: Karaoke .KAR Test
  0: ff02 -- Copyright: https://jazz-soft.net
  0: ff01 -- Text: Testing Karaoke in .kar format.\n
  0: ff51 -- Tempo: 90 bpm
  0: ff2f -- End of Track
MTrk:
  0: ff03 -- Sequence Name: Lyrics
  0: ff01 -- Text: @TMary Was A Little Lame
  0: ff01 -- Text: \Ma
  75: ff01 -- Text: ry
  100: ff01 -- Text: was
  150: ff01 -- Text: a
  200: ff01 -- Text: lit
  250: ff01 -- Text: tle
  300: ff01 -- Text: lame,
  400: ff01 -- Text: /Lit
  450: ff01 -- Text: tle
  500: ff01 -- Text: lame,
  600: ff01 -- Text: /Lit
  650: ff01 -- Text: tle
  700: ff01 -- Text: lame,
  800: ff01 -- Text: /Ma
  875: ff01 -- Text: ry
  900: ff01 -- Text: was
  950: ff01 -- Text: a
  1000: ff01 -- Text: lit
  1050: ff01 -- Text: tle
  1100: ff01 -- Text: lame,
  1150: ff01 -- Text: /A
  1200: ff01 -- Text: lit
  1250: ff01 -- Text: tle
  1300: ff01 -- Text: lame
  1350: ff01 -- Text: was
  1400: ff01 -- Text: she!
  1400: ff2f -- End of Track
MTrk:
  0: c0 0b -- Program Change
  0: 90 40 7f -- Note On
  75: 80 40 40 -- Note Off
  75: 90 3e 7f -- Note On
  100: 80 3e 40 -- Note Off
  100: 90 3c 7f -- Note On
  150: 80 3c 40 -- Note Off
  150: 90 3e 7f -- Note On
  200: 80 3e 40 -- Note Off
  200: 90 40 7f -- Note On
  250: 80 40 40 -- Note Off
  250: 90 40 7f -- Note On
  300: 80 40 40 -- Note Off
  300: 90 40 7f -- Note On
  390: 80 40 40 -- Note Off
  400: 90 3e 7f -- Note On
  450: 80 3e 40 -- Note Off
  450: 90 3e 7f -- Note On
  500: 80 3e 40 -- Note Off
  500: 90 3e 7f -- Note On
  590: 80 3e 40 -- Note Off
  600: 90 40 7f -- Note On
  650: 80 40 40 -- Note Off
  650: 90 43 7f -- Note On
  700: 80 43 40 -- Note Off
  700: 90 43 7f -- Note On
  790: 80 43 40 -- Note Off
  800: 90 40 7f -- Note On
  875: 80 40 40 -- Note Off
  875: 90 3e 7f -- Note On
  900: 80 3e 40 -- Note Off
  900: 90 3c 7f -- Note On
  950: 80 3c 40 -- Note Off
  950: 90 3e 7f -- Note On
  1000: 80 3e 40 -- Note Off
  1000: 90 40 7f -- Note On
  1050: 80 40 40 -- Note Off
  1050: 90 40 7f -- Note On
  1100: 80 40 40 -- Note Off
  1100: 90 40 7f -- Note On
  1150: 80 40 40 -- Note Off
  1175: 90 40 7f -- Note On
  1200: 80 40 40 -- Note Off
  1200: 90 3e 7f -- Note On
  1250: 80 3e 40 -- Note Off
  1250: 90 3e 7f -- Note On
  1300: 80 3e 40 -- Note Off
  1300: 90 40 7f -- Note On
  1350: 80 40 40 -- Note Off
  1350: 90 3e 7f -- Note On
  1400: 80 3e 40 -- Note Off
  1400: 90 3c 7f -- Note On
  1500: 90 40 64 -- Note On
  1500: 90 43 64 -- Note On
  1500: 90 48 7f -- Note On
  1590: 80 3c 40 -- Note Off
  1590: 80 40 40 -- Note Off
  1590: 80 43 40 -- Note Off
  1590: 80 48 40 -- Note Off
  1590: ff2f -- End of Track

As you can see, "\Ma" on the clock 0 IS there.
Perhaps, MuseScore/Cakewalk have a problem handling two Text metaevents on the same clock.

It appears that midi standards for lyrics are incomplete as noted in RP-017 "several companies have implemented lyric events in incompatible ways." I see the same behavior with vanBasco's Karaoke player. Replacing the @t text with ('') results in the desired display of the tick(1) text in all three of these applications and they do not appear to make use of the @t string. Of course it would be very unusual for Karaoke to actually place lyrics at this location, since it is expected to have an introduction to establish tempo and pitch before the vocal portion. I am very appreciative of your efforts to support midi in all applications with your well written and comprehensive software.

Thanks a lot, it was an interesting discussion!
And, btw, "tick(0)" does nothing, you can just remove it.