public int[] BuildVibrato(VibratoInfo vibratoInfo, VibratoInfo vibratoPrevInfo)
        {
            var pitches = new List <int>();
            var interv  = INTERVAL_TICK;

            for (var x = 0; x <= vibratoInfo.Length; x += interv)
            {
                double y = 0;
                //Apply vibratos
                if (MusicMath.Current.TickToMillisecond(x, Tempo) < vibratoPrevInfo.End &&
                    MusicMath.Current.TickToMillisecond(x, Tempo) >= vibratoPrevInfo.Start && vibratoPrevInfo.Vibrato != null)
                {
                    y += InterpolateVibrato(vibratoPrevInfo.Vibrato,
                                            MusicMath.Current.TickToMillisecond(x, Tempo) - vibratoPrevInfo.Start, vibratoPrevInfo.Length);
                }

                if (MusicMath.Current.TickToMillisecond(x, Tempo) < vibratoInfo.End &&
                    MusicMath.Current.TickToMillisecond(x, Tempo) >= vibratoInfo.Start)
                {
                    y += InterpolateVibrato(vibratoInfo.Vibrato, MusicMath.Current.TickToMillisecond(x, Tempo) - vibratoInfo.Start,
                                            vibratoInfo.Length);
                }

                pitches.Add((int)Math.Round(y));
            }

            return(pitches.ToArray());
        }
        public void BuildVibratoInfo(RenderNote note, RenderNote prevNote, RenderNote nextNote, out VibratoInfo vibratoInfo, out VibratoInfo vibratoPrevInfo)
        {
            vibratoInfo = new VibratoInfo {
                Start = 0, End = 0, Vibrato = note.Vibrato, Length = note.FinalLength
            };
            if (prevNote != null)
            {
                vibratoPrevInfo = new VibratoInfo
                {
                    Start   = 0,
                    End     = 0,
                    Vibrato = prevNote.Vibrato,
                    Length  = prevNote.FinalLength
                }
            }
            ;
            else
            {
                vibratoPrevInfo = new VibratoInfo {
                    Start = 0, End = 0, Vibrato = null, Length = 0
                }
            };

            if (note.Vibrato != null && note.Vibrato.Depth != 0)
            {
                vibratoInfo.End   = MusicMath.Current.TickToMillisecond(note.FinalLength, Tempo);
                vibratoInfo.Start = vibratoInfo.End * (1 - note.Vibrato.Length / 100);
            }

            if (prevNote != null && prevNote.Vibrato != null && prevNote.Vibrato.Depth != 0)
            {
                vibratoPrevInfo.Start = -MusicMath.Current.TickToMillisecond(prevNote.FinalLength, Tempo) * prevNote.Vibrato.Length / 100;
                vibratoPrevInfo.End   = 0;
            }
        }