/// <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); }
/// <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); } }
/// <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); } }
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); }