Commit d35eccd1 authored by André Anjos's avatar André Anjos 💬

Finish first implemenation of xbob.ap

parent 7053b7c8
......@@ -41,6 +41,7 @@ setup(
"xbob/ap/energy.cpp",
"xbob/ap/frame_extractor.cpp",
"xbob/ap/spectrogram.cpp",
"xbob/ap/ceps.cpp",
"xbob/ap/main.cpp",
],
packages = packages,
......
This diff is collapsed.
......@@ -165,13 +165,16 @@ static int PyBobApEnergy_Init(PyBobApEnergyObject* self,
}
static PyObject* PyBobApEnergy_Repr(PyBobApEnergyObject* self) {
static const int MAXSIZE = 256;
char buffer[MAXSIZE];
auto count = std::snprintf(buffer, MAXSIZE, "%s(sampling_frequency=%f, win_length_ms=%f, win_shift_ms=%f)", Py_TYPE(self)->tp_name, self->cxx->getSamplingFrequency(), self->cxx->getWinLengthMs(), self->cxx->getWinShiftMs());
return
# if PY_VERSION_HEX >= 0x03000000
PyUnicode_FromFormat
PyUnicode_FromStringAndSize
# else
PyString_FromFormat
PyString_FromStringAndSize
# endif
("%s(sampling_frequency=%f, win_length_ms=%f, win_shift_ms=%f)", Py_TYPE(self)->tp_name, self->cxx->getSamplingFrequency(), self->cxx->getWinLengthMs(), self->cxx->getWinShiftMs());
(buffer, (count<=MAXSIZE)?count:MAXSIZE);
}
static PyObject* PyBobApEnergy_RichCompare (PyBobApEnergyObject* self,
......
......@@ -167,13 +167,16 @@ static int PyBobApFrameExtractor_Init(PyBobApFrameExtractorObject* self,
}
static PyObject* PyBobApFrameExtractor_Repr(PyBobApFrameExtractorObject* self) {
static const int MAXSIZE = 256;
char buffer[MAXSIZE];
auto count = std::snprintf(buffer, MAXSIZE, "%s(sampling_frequency=%f, win_length_ms=%f, win_shift_ms=%f)", Py_TYPE(self)->tp_name, self->cxx->getSamplingFrequency(), self->cxx->getWinLengthMs(), self->cxx->getWinShiftMs());
return
# if PY_VERSION_HEX >= 0x03000000
PyUnicode_FromFormat
PyUnicode_FromStringAndSize
# else
PyString_FromFormat
PyString_FromStringAndSize
# endif
("%s(sampling_frequency=%f, win_length_ms=%f, win_shift_ms=%f)", Py_TYPE(self)->tp_name, self->cxx->getSamplingFrequency(), self->cxx->getWinLengthMs(), self->cxx->getWinShiftMs());
(buffer, (count<=MAXSIZE)?count:MAXSIZE);
}
static PyObject* PyBobApFrameExtractor_RichCompare (PyBobApFrameExtractorObject* self,
......
......@@ -123,8 +123,8 @@ static int PyBobApSpectrogram_InitParameters
double win_shift_ms = 10.;
Py_ssize_t n_filters = 24;
double f_min = 0.;
double f_max = 0.;
double pre_emphasis_coeff = 0.;
double f_max = 4000.;
double pre_emphasis_coeff = 0.95;
PyObject* mel_scale = Py_True;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|ddndddO", kwlist,
&sampling_frequency, &win_length_ms, &win_shift_ms,
......@@ -201,14 +201,17 @@ static int PyBobApSpectrogram_Init(PyBobApSpectrogramObject* self,
}
static PyObject* PyBobApSpectrogram_Repr(PyBobApSpectrogramObject* self) {
static const int MAXSIZE = 256;
char buffer[MAXSIZE];
Py_ssize_t n_filters = self->cxx->getNFilters();
auto count = std::snprintf(buffer, MAXSIZE, "%s(sampling_frequency=%f, win_length_ms=%f, win_shift_ms=%f, n_filters=%" PY_FORMAT_SIZE_T "d, f_min=%f, f_max=%f, pre_emphasis_coeff=%f, mel_scale=%s)", Py_TYPE(self)->tp_name, self->cxx->getSamplingFrequency(), self->cxx->getWinLengthMs(), self->cxx->getWinShiftMs(), n_filters, self->cxx->getFMin(), self->cxx->getFMax(), self->cxx->getPreEmphasisCoeff(), self->cxx->getMelScale()?"True":"False");
return
# if PY_VERSION_HEX >= 0x03000000
PyUnicode_FromFormat
PyUnicode_FromStringAndSize
# else
PyString_FromFormat
PyString_FromStringAndSize
# endif
("%s(sampling_frequency=%f, win_length_ms=%f, win_shift_ms=%f, n_filters=%" PY_FORMAT_SIZE_T "d, f_min=%f, f_max=%f, pre_emphasis_coeff=%f, mel_scale=%s)", Py_TYPE(self)->tp_name, self->cxx->getSamplingFrequency(), self->cxx->getWinLengthMs(), self->cxx->getWinShiftMs(), n_filters, self->cxx->getFMin(), self->cxx->getFMax(), self->cxx->getPreEmphasisCoeff(), self->cxx->getMelScale()?"True":"False");
(buffer, (count<=MAXSIZE)?count:MAXSIZE);
}
static PyObject* PyBobApSpectrogram_RichCompare (PyBobApSpectrogramObject* self,
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment