Logo Search packages:      
Sourcecode: csound version File versions  Download package

double csound::Voicelead::conformToPitchClassSet ( double  pitch,
const std::vector< double > &  pcs,
size_t  divisionsPerOctave = 12 
) [static]

Return the pitch that results from making the minimum adjustment to the pitch-class of the pitch argument that is required to make its pitch-class the same as one of the pitch-classes in the pitch-class set argument. I.e., "round up or down" to make the pitch fit into a chord or scale.

Definition at line 445 of file Voicelead.cpp.

References closestPitch(), and pc().

Referenced by csound::Score::setPitchClassSet(), and csound::Score::setVoicing().

  {
    double divisionsPerOctave = round(double(divisionsPerOctave_));
    double pc_ = pc(pitch);
    double closestPc = closestPitch(pc_, pcs);
    double octave = std::floor(pitch / divisionsPerOctave) * divisionsPerOctave;
    double closestPitch = octave + closestPc;
    return closestPitch;
  }


Generated by  Doxygen 1.6.0   Back to index