Skip to content

Commit

Permalink
Add basic pitch tracking #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Jun 19, 2022
1 parent 7385430 commit dd636db
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/voyx/alg/NaivePitchTracking.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include <voyx/Header.h>
#include <voyx/etc/Convert.h>

class NaivePitchTracking
{

public:

NaivePitchTracking(const voyx_t concertpitch) :
concertpitch(concertpitch)
{
}

voyx_t operator()(const voyx_t f0) const
{
const voyx_t key = std::round($$::midi::key(f0, concertpitch));
const voyx_t freq = $$::midi::freq(key, concertpitch);

return freq;
}

private:

const voyx_t concertpitch;

};

0 comments on commit dd636db

Please sign in to comment.