From d87c81f6db0e16795f4d58adf8aee15441c835c6 Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Wed, 5 Jan 2022 14:51:16 +0100 Subject: [PATCH 1/5] Updates README.md with a section on how to execute tests --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c64e1b3..0ba4328 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This repo contains sources of the backend of the articulatory synthesizer [Vocal ``` git clone https://github.com/TUD-STKS/VocalTractLabBackend-dev ``` + ### Build using CMake (Windows, Linux, macOS) - Get the latet release of [CMake for your platform](https://cmake.org/) - Create a folder ``out`` inside the cloned repository folder @@ -40,6 +41,14 @@ or cmake --build . --config Release --target VocalTractLabBackend ``` +### Run tests using shell/command prompt +- Open a shell/command prompt +- Navigate to cloned repository folder (not the ``out`` folder from the build process) +- run the tests by executing ``VtlApiTests`` in the ``lib`` folder created by the build process: +``` +./lib/VtlApiTests +``` + ### Build using Visual Studio 2019 (Windows) - Open ``VocalTractLabApi.sln`` in the folder `build/msw` - Build the project ``VocalTractLabApi`` or ``VocalTractLabBackend`` @@ -48,13 +57,11 @@ cmake --build . --config Release --target VocalTractLabBackend To include the VocalTractLab backend into your own projects, add the folder `include` from this repository to your project's include directories and link against the API or static backend library in the folder `lib`. You can then include the API functions like so: - ```cpp #include "VocalTractLabApi/VocalTractLabApi.h" ``` C++-Objects can be included from the static backend library through their respective header: - ```cpp #include "VocalTractLabBackend/Speaker.h" // or substitute your desired header here ``` From 8af19899a477124f5457922358020dad7dc8582d Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Wed, 5 Jan 2022 14:53:34 +0100 Subject: [PATCH 2/5] Adds line to clarify where to find the shared object / dll file after building the procjet to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0ba4328..bd457ad 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ or ``` cmake --build . --config Release --target VocalTractLabBackend ``` +The final dll/so-files and executables are copied to ``../lib/`` so you don't +find them within the ``out`` folder. ### Run tests using shell/command prompt - Open a shell/command prompt From 54f9313f89addaa128e4f5e98f688a91a27acb85 Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Wed, 5 Jan 2022 16:34:10 +0100 Subject: [PATCH 3/5] improves wording thanks to Simon Stone (@nullpunktTUD) --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index bd457ad..2d8903e 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,7 @@ or ``` cmake --build . --config Release --target VocalTractLabBackend ``` -The final dll/so-files and executables are copied to ``../lib/`` so you don't -find them within the ``out`` folder. +The final binary files are placed into the subdirectory ``lib`` (of the repository root). Do not look for them in the ``out`` directory, which is only used as a temporary folder for the build process and can be safely deleted once the binaries are built. ### Run tests using shell/command prompt - Open a shell/command prompt From a4d167e99a9bb9614723c16119c282d48c48f959 Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Fri, 31 Mar 2023 20:23:09 +0200 Subject: [PATCH 4/5] bumps github actions to higher version to not depend on nodejs12 anymore --- .github/workflows/cmake.yml | 2 +- .github/workflows/matlab_examples.yml | 2 +- .github/workflows/msbuild.yml | 2 +- .github/workflows/python_examples.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d1c33ee..bed401d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. diff --git a/.github/workflows/matlab_examples.yml b/.github/workflows/matlab_examples.yml index 2b48aa5..d808e9b 100644 --- a/.github/workflows/matlab_examples.yml +++ b/.github/workflows/matlab_examples.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set path to correct runtime lib so MATLAB does not use an outdated one run: echo 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6' >> $GITHUB_ENV diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 65a1f8e..ab7c337 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -16,7 +16,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.0.2 diff --git a/.github/workflows/python_examples.yml b/.github/workflows/python_examples.yml index 41749c4..cf76a11 100644 --- a/.github/workflows/python_examples.yml +++ b/.github/workflows/python_examples.yml @@ -14,9 +14,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.10" # We need blender to run example 6 From 6e6d4cb058ad3b48793e59e37dbeb467bc66d2f6 Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Fri, 31 Mar 2023 21:44:58 +0200 Subject: [PATCH 5/5] adds frameSamplingRate argument to vtlTractSequenceToEmaAndMesh in order to get the correct time stamps in the exported ema file for non 200Hz frame freqeuencies --- include/VocalTractLabApi/VocalTractLabApi.h | 4 +++- src/VocalTractLabApi/VocalTractLabApi.cpp | 15 ++++++++++++--- test/VtlApiTests.cpp | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/VocalTractLabApi/VocalTractLabApi.h b/include/VocalTractLabApi/VocalTractLabApi.h index 0dd2e92..970252d 100644 --- a/include/VocalTractLabApi/VocalTractLabApi.h +++ b/include/VocalTractLabApi/VocalTractLabApi.h @@ -654,6 +654,7 @@ C_EXPORT int vtlGesturalScoreToEma(const char *gestureFileName, const char *emaF // Lower Cover (JAW) = 148) // o filePath: path leading to the directory where EMA and mesh files shall be stored. // o fileName: name of all exported datasets +// o frameSamplingRate: sampling rate of the frames, i. e. how many frames are in one second // // The return value is 0 if successful, and otherwise an error code >= 1. // Error codes: @@ -668,9 +669,10 @@ C_EXPORT int vtlGesturalScoreToEma(const char *gestureFileName, const char *emaF // 8: EMA file already exists: prevents overwriting // 9: EMA file could not be opened // 10: API has not been initialized +// 11: frameSamplingRate <= 0.0 // **************************************************************************** -C_EXPORT int vtlTractSequenceToEmaAndMesh(double *tractParams, double *glottisParams, int numTractParams, int numGlottisParams, int numFrames, int numEmaPoints, int *surf, int *vert, const char *filePath, const char *fileName); +C_EXPORT int vtlTractSequenceToEmaAndMesh(double *tractParams, double *glottisParams, int numTractParams, int numGlottisParams, int numFrames, int numEmaPoints, int *surf, int *vert, const char *filePath, const char *fileName, double frameSamplingRate); // **************************************************************************** diff --git a/src/VocalTractLabApi/VocalTractLabApi.cpp b/src/VocalTractLabApi/VocalTractLabApi.cpp index 70b907b..59776ca 100644 --- a/src/VocalTractLabApi/VocalTractLabApi.cpp +++ b/src/VocalTractLabApi/VocalTractLabApi.cpp @@ -1919,6 +1919,7 @@ int vtlGesturalScoreToEma(const char *gestureFileName, const char *emaFileName) // Lower Cover (JAW) = 148) // o filePath: path leading to the directory where EMA and mesh files shall be stored. // o fileName: name of all exported datasets +// o frameSamplingRate: sampling rate of the frames, i. e. how many frames are in one second // // The return value is 0 if successful, and otherwise an error code >= 1. // Error codes: @@ -1933,9 +1934,10 @@ int vtlGesturalScoreToEma(const char *gestureFileName, const char *emaFileName) // 8: EMA file already exists: prevents overwriting // 9: EMA file could not be opened // 10: API has not been initialized +// 11: frameSamplingRate <= 0.0 // **************************************************************************** -int vtlTractSequenceToEmaAndMesh(double *tractParams, double *glottisParams, int numTractParams, int numGlottisParams, int numFrames, int numEmaPoints, int *surf, int *vert, const char *filePath, const char *fileName) +int vtlTractSequenceToEmaAndMesh(double *tractParams, double *glottisParams, int numTractParams, int numGlottisParams, int numFrames, int numEmaPoints, int *surf, int *vert, const char *filePath, const char *fileName, double frameSamplingRate) { // Return if no EMA point is selected if (numEmaPoints <= 0) @@ -1944,6 +1946,13 @@ int vtlTractSequenceToEmaAndMesh(double *tractParams, double *glottisParams, int return 1; } + if (frameSamplingRate <= 0.0) + { + printf("Error in vtlTractSequenceToEmaAndMesh(): frameSamplingRate <= 0"); + return 11; + } + + if (surf == NULL) { printf("Error in vtlTractSequenceToEmaAndMesh(): surf == NULL"); @@ -2100,7 +2109,7 @@ int vtlTractSequenceToEmaAndMesh(double *tractParams, double *glottisParams, int for (int f = 0; f < numFrames; f++) { fs::path objFileName = objFilePath.string() + to_string(f) + ".obj" ; // name of current .obj file - emaFile << f*0.005 << " "; // Write current time (frame*0.005 currently) into file + emaFile << f * (1/frameSamplingRate) << " "; // time of the time step in seconds // Set the properties of the target tube. for (i = 0; i < numTractParams; i++) @@ -2246,7 +2255,7 @@ int vtlGesturalScoreToEmaAndMesh(const char *gestureFileName, const char *filePa int vertex[] = {115,225,335}; // Vertex Index of selected EMA point // Call of vtlTractSequenceToEmaAndMesh could also be done from outside! - return vtlTractSequenceToEmaAndMesh(tractParams.data(), glottisParams.data(), numTractParams, numGlottisParams, numFrames, 3, surf, vertex, filePath, fileName); + return vtlTractSequenceToEmaAndMesh(tractParams.data(), glottisParams.data(), numTractParams, numGlottisParams, numFrames, 3, surf, vertex, filePath, fileName, EMA_SAMPLING_RATE_HZ); } // **************************************************************************** diff --git a/test/VtlApiTests.cpp b/test/VtlApiTests.cpp index 756ba65..da2a17a 100644 --- a/test/VtlApiTests.cpp +++ b/test/VtlApiTests.cpp @@ -352,7 +352,7 @@ TEST(ApiTest, TractToEmaAndMesh) ret = vtlTractSequenceToEmaAndMesh(tractSeq.data(), glottisSeq.data(), numVocalTractParams, numGlottisParams, numFrames, numEmaPoints, surf, vert, - exportedMeshPath, exportMeshBaseName); + exportedMeshPath, exportMeshBaseName, 200.0); EXPECT_EQ(ret, 0);