Skip to content

Commit

Permalink
Fix PitchDetector web reference documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstadler committed Sep 26, 2023
1 parent 26b8a1b commit 5c45c57
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/processing/sound/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Common superclass of all audio analysis classes
* @webref Analysis
*/
abstract class Analyzer {
public abstract class Analyzer {

protected SoundObject input;

Expand Down
2 changes: 1 addition & 1 deletion src/processing/sound/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import processing.core.PApplet;

// common superclass for JSyn filters that have a 'Q' unitport
abstract class Filter<E extends FilterBiquadCommon> extends Effect<E> {
public abstract class Filter<E extends FilterBiquadCommon> extends Effect<E> {

public Filter(PApplet parent) {
super(parent);
Expand Down
12 changes: 5 additions & 7 deletions src/processing/sound/PitchDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@
/**
* Detects the pitch (also known as the 'fundamental frequency') of a sound
* signal. For complex signals this is not a trivial task, so the analyzer only
* returns a frequency measurement (measured in Hertz, or 'Hz') when its
* measurement exceeds a 'confidence level' that can be specified by the user.
* returns a frequency measurement (measured in Hertz) when its measurement
* exceeds a 'confidence level' that can be specified by the user.
*
* @webref Analysis:PitchDetector
* @webBrief Detects the fundamental frequency of a sound signal
* @webref
*/
public class PitchDetector extends Analyzer {
private final com.jsyn.unitgen.PitchDetector detector;

private float minimumConfidence = 0.8f;

/**
* Creates a new PitchDetector object.
*
* @param parent Typically "this"
* @param parent typically "this"
* @param minimumConfidence the minimum confidence level required for
* frequency measurements, between 0 (accept all measurements, no matter how
* unreliable) to 1 (only accept perfect measurements). Defaults to 0.8.
Expand Down Expand Up @@ -56,14 +54,14 @@ public float analyze() {
* Returns an estimate of the current pitch (or 'fundamental frequency') of
* the input sound signal, in Hertz. If the confidence in the current
* measurement does not exceed the minimum confidence, this method returns 0.
* @webref Analysis:PitchDetector
* @webBrief Detect the fundamental frequency of the input sound signal.
* @param minimumConfidence the minimum confidence level required for
* frequency measurements, between 0 (accept all measurements, no matter how
* unreliable) to 1 (only accept perfect measurements). If omitted, uses the
* confidence level specified when this PitchDetector was created.
* @param target a float array of length 2 that will be filled with the
* frequency and confidence in that frequency measurement
* @webref
*/
public float analyze(float minimumConfidence) {
return (float) (this.detector.confidence.getValue() >= minimumConfidence ? this.detector.frequency.getValue() : 0.0);
Expand Down

0 comments on commit 5c45c57

Please sign in to comment.