Hi, I’m able to reproduce audio of kar files dealing with them exactly as if them were midi files. However, it is possible to access the lyrics and their syncronization data through fmod?
My idea is to develop a karaoke application for iPhone platform, showing the lyrics and highlighting the current sillabe.
Cheers
- victorin asked 9 years ago
- You must login to post comments
Hey guys, thanks to your help I’m able to read the lyrics/time tags from the kar file.
The problem is that values from Text "(Time Ms)" tag seems to be wrong:
[quote:3mk58ld9]
2009-07-03 15:39:46.445 playstream[8244:20b] ->\So
2009-07-03 15:39:46.446 playstream[8244:20b] MS->16117120
2009-07-03 15:39:46.446 playstream[8244:20b] ->clo
2009-07-03 15:39:46.447 playstream[8244:20b] MS->16117376
2009-07-03 15:39:46.447 playstream[8244:20b] ->se
2009-07-03 15:39:46.447 playstream[8244:20b] MS->16117632
[/quote:3mk58ld9]
The start at 16117120 ms. You’ve said that ms value is an integer, so I print them like this:
NSLog(@"MS->%d",(int*)tag.data);
Thx so much, I’m almost have it!!!
- victorin answered 9 years ago
- You must login to post comments
you are formating the address of data, converted into an adress of a int pointer… It’s pointer confusing, I know…
I did it in 2 steps because I get cockeyed with this stuff
int v = (int)tag.data;
NSLog(@"MS->%d",*v);
- icuurd12b42 answered 9 years ago
- You must login to post comments
Oh sorry, it was a noob mistake
Thx so much!
- victorin answered 9 years ago
- You must login to post comments
It would be nice if the tag system would hold these…
Anyway, the midi meta type 0x1 (Text Event) and 0x5 (Karaoke Lyric event) in the midi file hold the lyrics. Usually, the text event is mostly used.
You have to sync it yourself from the midi event time stamp, back to the playing sound’s position.
It not very easy though.
- icuurd12b42 answered 9 years ago
- You must login to post comments
Hi, I’m a newbie to FMOD. This is my first post. I can use FMOD for iOS app to play .KAR file with DLS sound bank. It works great.
My problem is about getting lyrics text using tags in .KAR file. I try to implement it but not success yet. Here is my logic.
- After create sound already, I check for how many tags in this .KAR file. It’s return 1,248 tags.
[code:mx9z7jxh]//check how many tags in KAR file?
result = sound1->getNumTags(&numtags, &numtagsupdated);
ERRCHECK(result);[/code:mx9z7jxh]
- I try to get ‘Text’ and ‘Text (Time MS)’ tags by looping it.
[code:mx9z7jxh]//Loop through to get a specific tags
FMOD_TAG tagtext; //Text
FMOD_TAG tagtime; //Text (Time MS)
for (int i = 0; i < numtags; i++)
{
result = sound1->getTag("Text", 0, &tagtext);
ERRCHECK(result);
result = sound1->getTag("Text (Time Ms)", 0, &tagtime);
ERRCHECK(result);
}[/code:mx9z7jxh]
*** The simulator is freeze at this point.
If I could get these tags, I will keep it in the NSDictionary object. Anybody has an idea how to display the text with highlight the word while playing the music? Many thanks and sorry for my English.
- danjirawat answered 7 years ago
- You must login to post comments
Some modifications were added a while ago to the MIDI codec for .kar support. To use it you need to use our tag API, you will see tags with the name "Text" have the lyric fragments, then there will be a corresponding "Text (Time Ms)" tag that will have the time offset for that lyrics fragment.
You don’t need to parse the MIDI file manually, just build up a table with the FMOD tag information and display the lyric fragments at the correct offsets.
- Mathew Block answered 9 years ago
- You must login to post comments
That code doesn’t look quite right to me.
getNumTags will return a total number of tags, not just a count of "Text" tags, so I wouldn’t use that for loop.
I would recommend doing something like the readtags example. Continue to call getTag for "Text" with index -1 until it returns TAGNOTFOUND.
- Mathew Block answered 7 years ago
- You must login to post comments
Really!!? That’s great. I’ll go fiddle with my karaoke example right now!!
- icuurd12b42 answered 9 years ago
- You must login to post comments
Thank you very much Mathew for your quick reply. Then I change my code to below. It’s now can get both ‘Text’ and ‘Text (Time Ms)’ tags. But it took a bit long time (more than 1 minute to complete). Is this normal or how to improve the speed to read the tags?
[code:34dcx53w]while (true)
{
if (sound1->getTag("Text",-1, &tagtext) != FMOD_OK)
{
break;
}
if (tagtext.datatype == FMOD_TAGDATATYPE_STRING)
{
outputtext.text = [outputtext.text stringByAppendingFormat:@"%s = %s \n\n", tagtext.name, tagtext.data];
}
if (sound1->getTag("Text (Time Ms)",-1, &tagtime) != FMOD_OK)
{
break;
}
if (tagtime.datatype == FMOD_TAGDATATYPE_INT)
{
outputtext.text = [outputtext.text stringByAppendingFormat:@"%s = %d \n\n", tagtime.name, tagtime.data];
}
}
[/code:34dcx53w]
- danjirawat answered 7 years ago
- You must login to post comments
Yep, according to revision.txt it went in on the 05/03/09 (v4.23.07).
- Mathew Block answered 9 years ago
- You must login to post comments
I had a quick check of how getTag works, and it might be more efficient for you to do a loop over all tags by index…
[code:3hnbrhaj]unsigned int numTags;
sound->getNumTags(&numTags, NULL);
for (unsigned int i = 0; i < numTags; i++)
{
FMOD_TAG tag;
sound->getTag(NULL, i, &tag);
/* check if this is a tag you are interested in */
}[/code:3hnbrhaj]
- Mathew Block answered 7 years ago
- You must login to post comments
Ah, I got 4.22.01, so not time stamp though the lyrics are there. Update time!
- icuurd12b42 answered 9 years ago
- You must login to post comments
[quote:39m9m5cz]
+ Added new "Text (Time Ms)" tag to MIDI files so it can be used in conjunction
with the "Text" tag that conains lyrics. This supports the ".kar" file format.
[/quote:39m9m5cz]
These are the tags:data I get from a Stairway to Heaven .kar
[quote:39m9m5cz]
Track 1 Name:Soft karaoke
Text:@KMIDI KARAOKE FILE
Track 2 Name:Words
Text:@LENGL
Text:@TSTAIRWAY TO HEAVEN
Text:@TBy Led Zeppelin
Text:@TKaraoke file by Alex Villa
Track 3 Name:Steel String Gt
Track 4 Name:Recorder
Track 5 Name:12-string
Track 6 Name:Keyboard
Track 7 Name:12-string
Track 8 Name:Vocals
Track 9 Name:Standard
Track 10 Name:Fingered Bass
Track 11 Name:Feedback Gt
Text:\There’s
Text: a
Text: la
Text:dy
Text: who’s
Text: sure
Text:/All
Text: that
Text: glit
Text:ters
Text: is
Text: go
Text:ld
Text:/And
Text: she’s
Text: buy
Text:ing
Text: a
Text: stair
Text:way
Text: to
Text: hea
Text:ven
Text:\When
Text: she
Text: gets
Text: there
Text: she
Text: knows
Text:/If
Text: the
Text: stores
Text: are
Text: all
Text: clo
Text:sed
Text:/With
Text: a
Text: word
Text: she
Text: can
Text: get
Text: what
Text: she
Text: came
Text: for
Text:\O
Text:o
Text:oh
Text: o
Text:oh
Text:o
Text:ooh
Text:/And
Text: she’s
Text: bu
Text:y
Text:ing
Text: a
Text: sta
Text:ir
Text:way
Text: to
Text: hea
Text:ven
Text:\There’s
Text: a
Text: sign
Text: on
Text: the
Text: wa
Text:ll
Text:/But
Text: she
Text: wants
Text: to
Text: be
Text: su
Text:re
Text:\’Cause
Text: you
Text: know
Text: some
Text:times
Text: words
Text:/Have
Text: two
Text: mean
Text:ings
Text:\In
Text: a
Text: tree
Text: by
Text: the
Text: bro
Text:ok
Text:/There’s
Text: a
Text: song
Text:bird
Text: who
Text: si
Text:ngs
Text:/Some
Text:times
Text: all
Text: of
Text: our
Text: thoughts
Text: are
Text: mis
Text:gi
Text:ven
Text:\Ooh
Text: it
Text: makes
Text: me
Text: won
Text:der
Text:/Ooh
Text: it
Text: makes
Text: me
Text: won
Text:der
Text:\There’s
Text: a
Text: fee
Text:ling
Text: I
Text: get
Text:/When
Text: I
Text: look
Text: to
Text: the
Text: west
Text:/And
Text: my
Text: spi
Text:rit
Text: is
Text: cry
Text:ing
Text: for
Text: lea
Text:ving
Text:\In
Text: my
Text: thoughts
Text: I
Text: have
Text: seen
Text:/Rings
Text: of
Text: smoke
Text: through
Text: the
Text: trees
Text:/And
Text: the
Text: voi
Text:ces
Text: of
Text: those
Text: who
Text: standing
Text: look
Text:ing
Text:\Ooh
Text: it
Text: makes
Text: me
Text: won
Text:der
Text:/Ooh
Text: it
Text: really
Text: makes
Text: me
Text: wonder
Text:\And
Text: it’s
Text: whis
Text:pered
Text: that
Text: soon
Text:/If
Text: we
Text: all
Text: call
Text: the
Text: tune
Text:/Then
Text: the
Text: pi
Text:per
Text: will
Text: lead
Text: us
Text: to
Text: rea
Text:son
Text:\And
Text: a
Text: new
Text: day
Text: will
Text: dawn
Text:/For
Text: those
Text: who
Text: stand
Text: long
Text:/And
Text: the
Text: fo
Text:rests
Text: will
Text: e
Text:cho
Text: with
Text: laugh
Text:ter
Text:\If
Text: there’s
Text: a
Text: bus
Text:tle
Text: in
Text: your
Text: hedge
Text:row
Text:/Don’t
Text: be
Text: alar
Text:med
Text: now
Text:/It’s
Text: just
Text: a
Text: spring
Text: clean
Text: for
Text: the
Text: May
Text: queen
Text:\Yes,
Text: there
Text: are
Text: two
Text: paths
Text: you
Text: can
Text: go
Text: by
Text:/But
Text: in
Text: the
Text: long
Text: run
Text:/There’s
Text: still
Text: time
Text: to
Text: change
Text: the
Text: road
Text: you’re
Text: on
Text:\And
Text: it
Text: makes
Text: me
Text: won
Text:der
Text:\Your
Text: head
Text: is
Text: humm
Text:ing
Text: and
Text: it
Text: won’t
Text: go
Text:/In
Text: case
Text: you
Text: don’t
Text: know
Text:/The
Text: pi
Text:per’s
Text: call
Text:ing
Text: you
Text: to
Text: join
Text: him
Text:\Dear
Text: la
Text:dy,
Text: can
Text: you
Text: hear
Text: the
Text: wind
Text: blow
Text:/And
Text: did
Text: you
Text: know
Text:/Your
Text: stair
Text:way
Text: lies
Text: on
Text: the
Text: whis
Text:pering
Text: wi
Text:nd
Text:\And
Text: as
Text: we
Text: wind
Text: on
Text: down
Text: the
Text: road
Text:/Our
Text: shad
Text:ows
Text: tal
Text:ler
Text: than
Text: our
Text: so
Text:ul
Text:/There
Text: wal
Text:ks
Text: a
Text: lady
Text: we
Text: all
Text: kn
Text:ow
Text:\Who
Text: shines
Text: white
Text: light
Text: and
Text: wants
Text: to
Text: sh
Text:ow
Text:/How
Text: ev’
Text:ry
Text:thing
Text: still
Text: turns
Text: to
Text: gold
Text:\And
Text: if
Text: you
Text: lis
Text:ten
Text: ve
Text:ry
Text: ha
Text:rd
Text:/The
Text: tune
Text: will
Text: come
Text: to
Text: you
Text: at
Text: la
Text:st
Text:\When
Text: all
Text: are
Text: one
Text: and
Text: one
Text: is
Text: a
Text:ll
Text:/To
Text: be
Text: a
Text: rock
Text: and
Text: not
Text: to
Text: roll
Text:\And
Text: she’s
Text: bu
Text:y
Text:ing
Text: a
Text: sta
Text:ir
Text:wa
Text:y
Text: to
Text: hea
Text:ven.
[/quote:39m9m5cz]
Some other file also have a Lyric text…
Would you care to explain the quote in the update release, the one about the time stamp, because I see no time stamp.., Nor do I see any tag that looks like "Time (ms)"
I do check if the tag is a string dtata
[code:39m9m5cz]
if (FMOD_Sound_GetTag(sound, 0, -1, &tag) != FMOD_OK)
{
return (double)0;
}
if (tag.datatype == FMOD_TAGDATATYPE_STRING)
{
[/code:39m9m5cz]
Perhaps the tag is not text???
BTW, is your help file up to date?
Mine says
WHAT’S NEW
Stable 4.18
Features…
<nothing else>
In the What’s New section… Or did I screw up somewhere getting/using the wrong version?
- icuurd12b42 answered 9 years ago
- You must login to post comments
There should be another tag called "Text (Time Ms)", it carries the time as an int (FMOD_TAGDATTATYPE_INT).
And that "What’s New" section of the docs has been removed in our newer branches as it fell out of date, just use revision.txt to see any changes.
- Mathew Block answered 9 years ago
- You must login to post comments
Got it thanks
Had to change my code to handle all types. It used to skip over all non string types…
Text: wind.
Text (Time Ms):164102
Text is followed by a Text (Time Ms) tag now. Thanks for the extra bit of info.
- icuurd12b42 answered 9 years ago
- You must login to post comments
Please login first to submit.