Jump to content

CAL Script to change Event Type


Recommended Posts

Hello Support!

I have this problem: when I import a midi file containing text I can see the text events in the event list of the track but these events are not (I think obviously) treated as song lyrics, probably because whoever edited the midi file used the event type for the title and copyright texts instead of the one for the song lyrics

So I need to change the event type from TEXT to LYRICS.

Despite being a developer I can't understand the syntax in CAL scripts very well, especially to assign a value to the Event Type property.

do (

        (forEveryEvent

             (do

                 ( if (== Event.TEXT Type)

                       (= ???? I don't know how to set the event type to LYRIC)

                     ) ; if statement

               )  ; do statement

           ) ; forEachEvent statement

); do main statement

 

Regards.

 

Link to comment
Share on other sites

First of all, your statement:    ( if (== Event.TEXT Type)
should be: ( if (== Event.Kind TEXT)

However, according to some documentation I have, you CANNOT change the Event.Kind (e.g. from TEXT to LYRIC).

Here's a quote from Page 17/101 of "The Cakewalk Application Language Programming Guide for SONAR".

   The constants: “CHORD”, “EXPRESSION”, “HAIRPIN”, “LYRIC”, “MCI”, “NRPN”, “RPN”,
   “SYSX”, “SYSXDATA”, “TEXT”, “WAVE” allow an “Event.Kind” test to locate these “Events”
   in a sequence, and yet there are no provisions for viewing, accessing or changing the values
   associated with them. This makes their use rather limited to merely hunting for this type of event,
   but not being able to do anything with it, once it has been found, except deleting them!
   Nevertheless, I list them here mostly because, for many of them, their existence as they relate to
   CAL is undocumented. These constants are only available in the versions of Cakewalk that support
   these data types as part of their feature package.


BTW, that manual seems hard to find these days. Mine says:

The Cakewalk Application Language Programming Guide for SONAR
Version: 2.2
Original author: D. Glen Gardenas
Editing and adaptations: Ton Valkenburgh
Review: Frans H.M. Bergen
Febrary, 24, 2010
http://www.MIDI-Kit.nl  [this no longer seems to work]

  • Like 1
Link to comment
Share on other sites

the event kind is read-only. if you need to "change" an event kind to something else, you could create a new one of the desired event kind, assigning whatever value made sense, then delete the one you found (or leave it). in essence - you're replacing the event kind you want to change with a new one of the kind you want ? 

  • Like 1
Link to comment
Share on other sites

33 minutes ago, Glenn Stanton said:

the event kind is read-only. if you need to "change" an event kind to something else, you could create a new one of the desired event kind, assigning whatever value made sense, then delete the one you found (or leave it). in essence - you're replacing the event kind you want to change with a new one of the kind you want ? 

Good thought, but unfortunately, you can't INSERT an EVENT of type LYRIC.  This is according to page 30/101 of the above-mentioned "The Cakewalk Application Language Programming Guide for SONAR".  (The only 6 types you can INSERT are:  NOTE CONTROL WHEEL PATCH KEYAFT CHANAFT).

  • Like 2
Link to comment
Share on other sites

I don't know if you want or need  to use a CAL script to solve this problem, however if you want to solve the midi text/lyrics problem you can also use this MFX plugin Text2lyrics. I had the same problem as you and I solved with this one. Thanks again to AZSlow for this plugin!

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Quote

LYRIC This constant equals 2. The data associated with this event is a single syllable or word that is to be sung at that instant in the song. These lyrics can be displayed during playback in the ‘Staff’ view. The variable contains a single text word of syllable, and is not accessible by CAL.

 

  • Like 1
Link to comment
Share on other sites

4 hours ago, tparker24 said:

First of all, your statement:    ( if (== Event.TEXT Type)
should be: ( if (== Event.Kind TEXT)

However, according to some documentation I have, you CANNOT change the Event.Kind (e.g. from TEXT to LYRIC).

Here's a quote from Page 17/101 of "The Cakewalk Application Language Programming Guide for SONAR".

   The constants: “CHORD”, “EXPRESSION”, “HAIRPIN”, “LYRIC”, “MCI”, “NRPN”, “RPN”,
   “SYSX”, “SYSXDATA”, “TEXT”, “WAVE” allow an “Event.Kind” test to locate these “Events”
   in a sequence, and yet there are no provisions for viewing, accessing or changing the values
   associated with them. This makes their use rather limited to merely hunting for this type of event,
   but not being able to do anything with it, once it has been found, except deleting them!
   Nevertheless, I list them here mostly because, for many of them, their existence as they relate to
   CAL is undocumented. These constants are only available in the versions of Cakewalk that support
   these data types as part of their feature package.


BTW, that manual seems hard to find these days. Mine says:

The Cakewalk Application Language Programming Guide for SONAR
Version: 2.2
Original author: D. Glen Gardenas
Editing and adaptations: Ton Valkenburgh
Review: Frans H.M. Bergen
Febrary, 24, 2010
http://www.MIDI-Kit.nl  [this no longer seems to work]

Thank you very much for your reply! 

Link to comment
Share on other sites

4 hours ago, Glenn Stanton said:

the event kind is read-only. if you need to "change" an event kind to something else, you could create a new one of the desired event kind, assigning whatever value made sense, then delete the one you found (or leave it). in essence - you're replacing the event kind you want to change with a new one of the kind you want ? 

Thank you very much for your reply!  Yes, i thought so also...  if i try to change by cakewalk event list it reset the old value.

Link to comment
Share on other sites

3 hours ago, Ronny.G said:

I don't know if you want or need  to use a CAL script to solve this problem, however if you want to solve the midi text/lyrics problem you can also use this MFX plugin Text2lyrics. I had the same problem as you and I solved with this one. Thanks again to AZSlow for this plugin!

Thank you, I've downloaded the Text2lyrics and put the 2 dlls files into all the plugins folders of cakewalk and choose Fx plugin but when for the Text track i cannot find any lyrics anyway.

did you ever tried this plugin ?

image.thumb.png.579fad5c1ec2ed669399af11e3ff035f.png

Link to comment
Share on other sites

8 hours ago, Giuliano Cocco said:

did you ever tried this plugin ?

Yes, as I said I used it a lot in the past for solve the problem that some midi files have "words" saved as text and not as lyrics and this plugin is the only one that works. You have to apply the effect not insert it. 

You have to:

- select the track with "words"

- right click

- Process Effect - MIDI Effects...

- Uncategorized - AZ Text2Lyrics

- OK

Conversion done, now you can view the lyrics tab of the track and the "words" are there. Not perfect as page layout and margin but the syllabs are preserved. This is the best that can be automatically done by the plugin. Consider also that CbB isn't a dedicated fine tuned program for display midi lyrics, so it's limited if you need to display lyrics on screen in a live situation.

Edited by Ronny.G
Update with steps
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...