Ejemplo n.º 1
0
            public bool Equals(CVVCEve_French_Syllable obj)
            {
                if (obj == null)
                {
                    return(false);
                }

                return(obj.Onset == this.Onset &&
                       obj.Nucleus == this.Nucleus &&
                       obj.Coda == this.Coda);
            }
Ejemplo n.º 2
0
            /// takes a lyric and splits it into its onset/nucleus/coda parts
            /// returns a CVVC_English_Syllable of [null, null, null] if not recognized
            public static CVVCEve_French_Syllable SplitSyllable(string lyric)
            {
                var matches = syllable_RE.Match(lyric).Groups;
                var result  = new CVVCEve_French_Syllable();

                if (matches.Count < 3)
                {
                    // not recognized
                    result.Onset   = null;
                    result.Nucleus = null;
                    result.Coda    = null;
                    return(new CVVCEve_French_Syllable((string)null, null, null));
                }

                result.Onset   = matches[1].Value;
                result.Nucleus = matches[2].Value;
                result.Coda    = matches[3].Value;

                // otherwise, return as expected
                return(result);
            }
Ejemplo n.º 3
0
        /// Return the current note, split up as necessary to match the prev and next notes
        /// (Returns a new copy of all notes; the inputs are unchanged)
        public static List <UtauNote> GetConnectingNotes(UtauNote prev, UtauNote curr, UtauNote next)
        {
            CVVCEve_French_Syllable lyric_split = CVVCEve_French_Syllable.SplitSyllable(curr.Lyric);
            string nextlyric_start = CVVCEve_French_Syllable.StartingConsonant(next.Lyric);


            List <UtauNote> toReturn = new List <UtauNote>();

            //if unrecognized, return the note untouched
            if (lyric_split.Onset == null && lyric_split.Nucleus == null)
            {
                return(new List <UtauNote> {
                    new UtauNote(curr)
                });
            }

            // add in the base note
            UtauNote CV = new UtauNote(curr);

            CV.Lyric = lyric_split.Onset + lyric_split.Nucleus;
            toReturn.Add(CV);

            // add in the VC note (first figuring out what C to add in)
            UtauNote VC = new UtauNote(curr);
            string   VC_consonant;

            if (lyric_split.Coda != "")
            {
                VC_consonant = lyric_split.Coda;
            }

            else if (nextlyric_start != "")
            {
                VC_consonant = " " + nextlyric_start;
            }
            else
            {
                VC_consonant = null;
            }

            if (VC_consonant != null)
            {
                VC.Lyric  = lyric_split.Nucleus + VC_consonant;
                VC.Length = 120; //TODO: something more clever with lengths. For now, 120 is a 16th note
                toReturn.Add(VC);
                CV.Length = CV.Length - 120;
            }

            // adjust first sound if previous note is a rest (and this note has no starting consonant)
            if (prev == null || prev.IsRest)
            {
                toReturn[0].Lyric = "- " + toReturn[0].Lyric;
            }

            //TODO: double-check what's going on with the UtauNote copy constructor and why the tempo is being copied from the next note or something
            //for now, hack:
            toReturn.ForEach(note =>
            {
                //note.MainValues.Remove("Tempo"); //remove if exists
            });
            return(toReturn);
        }