function p = choosepitch(f) %%%% Function takes in a number and returns a number. That is, it takes in a frequency, %%%% and returns the number of the musical pitch. Notes the the frequency must be in the %%%% middle-C octave range or else the function will return an error. if f >= 254.284 & f < 269.4045 p = 1; elseif f >= 269.4045 & f < 285.424 p = 2; elseif f >= 285.424 & f < 302.396 p = 3; elseif f >= 302.396 & f < 320.3775 p = 4; elseif f >= 320.3775 & f < 339.428 p = 5; elseif f >= 339.428 & f < 359.611 p = 6; elseif f >= 359.611 & f < 380.9945 p = 7; elseif f >= 380.9945 & f < 403.65 p = 8; elseif f >= 403.65 & f < 427.6525 p = 9; elseif f >= 427.6525 & f < 453.082 p = 10; elseif f >= 453.082 & f < 480.0235 p = 11; elseif f >= 480.0235 & f < 508.567 p = 12; else error('frequency outside of acceptable range') end