-
Notifications
You must be signed in to change notification settings - Fork 0
/
praatpitch.cpp
49 lines (38 loc) · 1.04 KB
/
praatpitch.cpp
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
#include <iostream>
#include <stdlib.h>
#include <string>
#include "sndfile.h"
#include "Sound.h"
#include "Sound_to_Pitch.h"
#include "Pitch_to_PitchTier.h"
#include "RealTier.h"
#include "PitchTier.h"
#include "Pitch.h"
#include "LongSound.h"
#include "melder.h"
#include "Manipulation.h"
#include "NUMmachar.h"
int main(int argc, const char * argv[])
{
if (argc != 2) {
return 1;
}
NUMmachar();
size_t size = strlen(argv[1]) + 1;
wchar_t path[size];
mbstowcs(path, argv[1], size);
MelderFile mf;
structMelderFile file2 = { 0 };
Melder_relativePathToFile(path, &file2);
mf = &file2;
Sound snd = Sound_readFromSoundFile(mf);
Manipulation manip = Sound_to_Manipulation(snd, 0.01, 75, 600);
int nPoints = manip->pitch->f_getNumberOfPoints();
RealPoint *points = (RealPoint*)manip->pitch->points->item;
for (int i = 1; i < nPoints + 1; i++) {
double time = points[i]->number;
double pitch = points[i]->value;
std::cout << time << "," << pitch << std::endl;
}
return 0;
}