-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transcriber.h
53 lines (38 loc) · 1.4 KB
/
Transcriber.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <vector>
#include "BeatAnalyzer.h"
#include "Config.h"
#include "Note.h"
#include "transcription/Transcription.h"
namespace RhythmTranscriber
{
class Transcriber
{
public:
Transcriber(float *timestamps, unsigned int length);
std::vector<BaseNote> notes;
RhythmTranscriber::Transcription::Transcription transcription;
void transcribe();
void transcribe(float bpm);
void transcribe(float bpm, unsigned int depth);
void transcribe(float *timestamps, unsigned int length);
private:
BeatAnalyzer beatAnalyzer;
void create_notes(float *timestamps, unsigned int length);
inline void add_beat(const Beat &beat)
{
for (unsigned int j = 0; j < beat.notesLen; j++)
{
Transcription::NoteElement note;
note.timestamp = beat.notes[j].timestamp;
note.duration = beat.notes[j].duration;
/// @todo Simplify note ratio before adding to transcription.
note.rhythm = Transcription::NoteRhythm{
.notes = (unsigned short)beat.division.consequent,
.beats = (unsigned short)beat.noteRatios[j].antecedent};
note.placement = Transcription::NotePlacement::PLACEMENT_HEAD;
transcription.notes.push_back(note);
}
}
};
}