Example #1
0
        private void UpdatePhonemeOto(UVoicePart part)
        {
            var singer = DocManager.Inst.Project.Tracks[part.TrackNo].Singer;

            if (singer == null || !singer.Loaded)
            {
                return;
            }
            foreach (UNote note in part.Notes)
            {
                foreach (UPhoneme phoneme in note.Phonemes)
                {
                    if (phoneme.AutoRemapped)
                    {
                        if (phoneme.Phoneme.StartsWith("?"))
                        {
                            phoneme.Phoneme      = phoneme.Phoneme.Substring(1);
                            phoneme.AutoRemapped = false;
                        }
                        else
                        {
                            string noteString = MusicMath.GetNoteString(note.NoteNum);
                            if (singer.PitchMap.ContainsKey(noteString))
                            {
                                phoneme.RemappedBank = singer.PitchMap[noteString];
                            }
                        }
                    }

                    if (singer.AliasMap.ContainsKey(phoneme.PhonemeRemapped))
                    {
                        phoneme.Oto          = singer.AliasMap[phoneme.PhonemeRemapped];
                        phoneme.PhonemeError = false;
                        if (phoneme.Overlap < 0)
                        {
                            phoneme.Overlap = -phoneme.Overlap;
                        }
                        phoneme.Overlap  = Math.Max(phoneme.Overlap, phoneme.Oto.Overlap);
                        phoneme.Preutter = Math.Max(phoneme.Preutter, phoneme.Oto.Preutter);
                        int vel = (int)phoneme.Parent.Expressions["velocity"].Data;
                        if (vel != 100)
                        {
                            double stretchRatio = Math.Pow(2, 1.0 - (double)vel / 100);
                            phoneme.Overlap  *= stretchRatio;
                            phoneme.Preutter *= stretchRatio;
                        }
                    }
                    else
                    {
                        phoneme.PhonemeError = true;
                        phoneme.Overlap      = 0;
                        phoneme.Preutter     = 0;
                    }
                }
            }
        }
Example #2
0
        public static double InterpolateShapeX(double x0, double x1, double y0, double y1, double y, USTx.PitchPointShape shape)
        {
            switch (shape)
            {
            case USTx.PitchPointShape.io: return(MusicMath.SinEasingInOutX(x0, x1, y0, y1, y));

            case USTx.PitchPointShape.i: return(MusicMath.SinEasingInX(x0, x1, y0, y1, y));

            case USTx.PitchPointShape.o: return(MusicMath.SinEasingOutX(x0, x1, y0, y1, y));

            default: return(MusicMath.LinearX(x0, x1, y0, y1, y));
            }
        }
Example #3
0
 public static float DecibelToVolume(double db)
 {
     return((db == -24) ? 0 : (float)((db < -16) ? MusicMath.DecibelToLinear(db * 2 + 16) : MusicMath.DecibelToLinear(db)));
 }
Example #4
0
 private float DecibelToVolume(double db)
 {
     return(db == -24 ? 0 : db < -16 ? (float)MusicMath.DecibelToLinear(db * 2 + 16) : (float)MusicMath.DecibelToLinear(db));
 }