Skip to content

Integrated updated pitch detection algorithm#27

Open
eadenise wants to merge 1 commit into
Audio-Project-Workgroup:mainfrom
eadenise:feature/issue-16/update-pitch-detection
Open

Integrated updated pitch detection algorithm#27
eadenise wants to merge 1 commit into
Audio-Project-Workgroup:mainfrom
eadenise:feature/issue-16/update-pitch-detection

Conversation

@eadenise
Copy link
Copy Markdown

@eadenise eadenise commented Jun 4, 2026

  • Added pitch detection based on the YIN algorithm
  • Moved .cpp and .h files to respective DSP folder
  • Created BackendendTest.cpp script to check if it passes the sine wave test
  • Passed all 3 automated Google tests
  • Passed all 4 CMake test although Test no. 4 shows slow run time (15s)
  • Updated test and plugin CMakeLists.txt since the AudioFile library has been used to load the sine wave file for testing purposes. Treat as placeholder (see: https://github.com/adamstark/AudioFile.git)

What's needed:

  • Reduction time complexity. YIN algorithm can still be improved. Will explore using FFT to optimise it.
  • Integration to JUCE plugin

Fixing #16

@eadenise eadenise force-pushed the feature/issue-16/update-pitch-detection branch from 31c51f3 to 89985b5 Compare June 4, 2026 12:36
@eadenise eadenise self-assigned this Jun 4, 2026
@eadenise eadenise added the DSP Digital Signal Processing label Jun 4, 2026
// void set_sample_rate(int newRate) { msampleRate = newRate; }

// int get_buffer_size() { return mbufferSize; }
// int get_sample_rate() { return msampleRate; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these commented out? could be removed if not used.

#endif

// This sets up a shared environment (Fixture) for your test cases
class PitchDetectorTest : public ::testing::Test {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file should be put in test/source/DSP/PitchDetectorTest.cpp for easier finding the relevant tests when more tests are added.

#define YIN_THRESHOLD 0.1


class YinAlgorithm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class and file name should match. Perhaps there could be a PitchDetector which has an instance of the YinAlgorithm, then it would be possible to swap them if wanted to test other algoritms later.

Comment thread test/CMakeLists.txt

FetchContent_Declare(
audiofile_github
GIT_REPOSITORY https://github.com/adamstark/AudioFile.git
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my PR I used JUCE built in file reader to read Wav files and called it, WavImporter. Not sure which is best approach but just wanted to check if this dependency is needed?

Comment thread test/CMakeLists.txt

target_compile_definitions(${PROJECT_NAME}
PRIVATE
TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test_data"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any test_data, should it be there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DSP Digital Signal Processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants