/// <summary>
        /// The pitch was detected - add the record
        /// </summary>
        /// <param name="pitch"></param>
        private PitchRecord AddPitchRecord(float pitch)
        {
            var midiNote  = 0;
            var midiCents = 0;

            PitchDsp.PitchToMidiNote(pitch, out midiNote, out midiCents);

            var record = new PitchRecord();

            record.RecordIndex = m_curPitchIndex;
            record.Pitch       = pitch;
            record.MidiNote    = midiNote;
            record.MidiCents   = midiCents;

            m_curPitchRecord = record;

            if (m_recordPitchRecords)
            {
                if (m_pitchRecordHistorySize > 0 && m_pitchRecords.Count >= m_pitchRecordHistorySize)
                {
                    m_pitchRecords.RemoveAt(0);
                }

                m_pitchRecords.Add(record);
            }

            //if (this.PitchDetected != null)
            //   this.PitchDetected(this, record);
            return(record);
        }
예제 #2
0
        /// <summary>
        /// The pitch was detected - add the record
        /// </summary>
        /// <param name="pitch"></param>
        private void AddPitchRecord(float pitch)
        {
            var midiNote  = 0;
            var midiCents = 0;

            PitchDsp.PitchToMidiNote(pitch, out midiNote, out midiCents);

            var record = new PitchRecord();

            record.RecordIndex = curPitchIndex;
            record.Pitch       = pitch;
            record.MidiNote    = midiNote;
            record.MidiCents   = midiCents;

            curPitchRecord = record;

            if (recordPitchRecords)
            {
                if (pitchRecordHistorySize > 0 && pitchRecords.Count >= pitchRecordHistorySize)
                {
                    pitchRecords.RemoveAt(0);
                }

                pitchRecords.Add(record);
            }

            if (this.PitchDetected != null)
            {
                this.PitchDetected(this, record);
            }
        }
예제 #3
0
        /// <summary>
        /// The pitch was detected - add the record
        /// </summary>
        /// <param name="pitch"></param>
        private void AddPitchRecord(float pitch)
        {
            var midiNote  = 0;
            var midiCents = 0;

            PitchDsp.PitchToMidiNote(pitch, out midiNote, out midiCents);

            var record = new PitchRecord
            {
                RecordIndex = m_curPitchIndex,
                Pitch       = pitch,
                MidiNote    = midiNote,
                MidiCents   = midiCents
            };

            m_curPitchRecord = record;

            if (m_recordPitchRecords)
            {
                if (m_pitchRecordHistorySize > 0 && m_pitchRecords.Count >= m_pitchRecordHistorySize)
                {
                    m_pitchRecords.RemoveAt(0);
                }

                m_pitchRecords.Add(record);
            }

            if (this.PitchDetected != null)
            {
                this.PitchDetected(this, record);
            }
        }
예제 #4
0
 private void setNumbers(float pitch)
 {
     if (pitch < 0)
     {
         pitch = 0;
     }
     // Set pitch
     Pitch    = pitch;
     MidiNote = PitchDsp.PitchToMidiNote(pitch);
     Note     = PitchDsp.GetNoteName((int)MidiNote, true, true);
 }