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 4c7e7921e7e80ebc7fe162d7f6ef981c0e195918 Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Thu, 22 Dec 2022 15:09:20 +0100 Subject: [PATCH 4/5] adds python code to plot the area function --- examples/example1.py | 47 +++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/examples/example1.py b/examples/example1.py index 06945b8..c181cdc 100644 --- a/examples/example1.py +++ b/examples/example1.py @@ -207,6 +207,42 @@ _wav.extend(list(wave)) +# export tube sections +tube_length_cm = (ctypes.c_double * 40)() +tube_area_cm2 = (ctypes.c_double * 40)() +tube_articulator = (ctypes.c_int * 40)() +incisor_pos_cm = ctypes.c_double(0) +tongue_tip_side_elevation = ctypes.c_double(0) +velum_opening_cm2 = ctypes.c_double(0) + +VTL.vtlTractToTube(ctypes.byref(params_a), + ctypes.byref(tube_length_cm), + ctypes.byref(tube_area_cm2), + ctypes.byref(tube_articulator), + ctypes.byref(incisor_pos_cm), + ctypes.byref(tongue_tip_side_elevation), + ctypes.byref(velum_opening_cm2)) + +# from Tube.h +ARTICULATOR = {0: 'vocal folds', + 1: 'tongue', + 2: 'lower incisors', + 3: 'lower lip', + 4: 'other articulator', + 5: 'num articulators', + } + +arti = [ARTICULATOR[sec] for sec in list(tube_articulator)] + +if plt is not None and np is not None: + plt.plot(np.cumsum(tube_length_cm), tube_area_cm2, ds='steps') + plt.xlabel('tube section [cm]') + plt.ylabel('tube area [cm^2]') + for ii, x_pos in enumerate(np.cumsum(tube_length_cm)): + plt.text(x_pos, 1 + 0.3 * (ii % 2), arti[ii], rotation='vertical', fontsize='small') + plt.show() + + # destroy current state of VTL and free memory VTL.vtlClose() @@ -237,14 +273,3 @@ print('scipy not available') print('skip writing out wav file') -# Plot the area function of the first and the last frame. -# TODO -# Matlab code: -#figure; -#plot(1:1:numTubeSections, tubeAreas(1:numTubeSections), ... -# 1:1:numTubeSections, -# tubeAreas(1+(numFrames-1)*numTubeSections:(numFrames-1)*numTubeSections + -# numTubeSections)); -#xlabel('Position in cm'); -#ylabel('Tube section index'); - From d0255b80b54dc3b3d5867533c993b45380889382 Mon Sep 17 00:00:00 2001 From: "Konstantin (Tino) Sering" Date: Tue, 26 Apr 2022 14:03:36 +0200 Subject: [PATCH 5/5] resovles conflict --- examples/example6.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/example6.py b/examples/example6.py index 8f540eb..d5f819a 100644 --- a/examples/example6.py +++ b/examples/example6.py @@ -96,7 +96,9 @@ # change the `convert_directory.py` to your liking and then execute it on the # Terminal with blender if sys.platform.startswith('win32'): - os.system(r'"D:\Program Files\Blender Foundation\Blender 3.0\blender.exe" --background --python Meshes/convert_directory.py') + command = r'"D:\Program Files\Blender Foundation\Blender 3.0\blender.exe" --background --python Meshes/convert_directory.py' + print(f"check that the following command points to the right Blender installation (if not change the line in example6.py):\n\n{command}") + os.system(command) else: os.system('blender --background --python Meshes/convert_directory.py 1> /dev/null')