├── src ├── Graph.h ├── Application.cpp ├── Application.h ├── SilentMessageBox.h ├── TimeAxisPicture.h ├── SilentMessageBox.cpp ├── CrossSectionPicture.h ├── ColorScale.h ├── TdsSpatialSignalPicture.h ├── TdsTimeSignalPicture.h ├── BasicPicture.h ├── SpectrogramPlot.h ├── SoundLib.h ├── LfPulsePicture.h ├── SpectrumOptionsDialog.h ├── TdsTubePicture.h ├── TimeAxisPicture.cpp ├── GlottisDialog.h ├── PoleZeroPlot.h ├── SpectrogramPicture.h ├── SimpleSpectrumPicture.h ├── AnnotationDialog.h ├── PhoneticParamsDialog.h ├── AnalysisResultsDialog.h ├── SynthesisThread.h ├── AreaFunctionPicture.h ├── EmaConfigDialog.h ├── PoleZeroDialog.h ├── GlottisPanel.h ├── LfPulsePicture.cpp ├── GlottisPicture.h ├── LfPulseDialog.h ├── FormantOptimizationDialog.h ├── TdsOptionsDialog.h ├── FdsOptionsDialog.h ├── SignalPicture.h ├── VocalTractShapesDialog.h ├── AnatomyParamsDialog.h ├── SignalPage.h ├── TransitionDialog.h ├── GesturalScorePicture.h ├── BasicPicture.cpp ├── VocalTractDialog.h ├── SpectrumPicture.h ├── TdsPage.h ├── AnalysisSettingsDialog.h ├── SignalComparisonPicture.h ├── GesturalScorePage.h ├── ColorScale.cpp ├── VocalTractPage.h └── SpectrumOptionsDialog.cpp ├── resources ├── VocalTractLab2.ico └── examples │ ├── example01-orig.wav │ ├── example01-synth.wav │ ├── example02-orig.wav │ ├── example02-synth.wav │ ├── example03-orig.wav │ ├── example03-synth.wav │ ├── example04-orig.wav │ ├── example04-synth.wav │ ├── example05-orig.wav │ ├── example05-synth.wav │ ├── example06-orig.wav │ ├── example06-synth.wav │ ├── apfelsine.seg │ ├── example05.seg │ ├── example04.seg │ ├── example06.seg │ ├── example02.seg │ ├── example03.seg │ ├── example01.seg │ └── example05.ges ├── .gitmodules ├── CODEOWNERS ├── CMakeSettings.json ├── .github └── workflows │ ├── msbuild.yml │ ├── cmake_osx.yml │ ├── cmake_windows.yml │ └── cmake_linux.yml ├── .gitattributes ├── CMakeLists.txt └── README.md /src/Graph.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/src/Graph.h -------------------------------------------------------------------------------- /src/Application.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/src/Application.cpp -------------------------------------------------------------------------------- /resources/VocalTractLab2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/VocalTractLab2.ico -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | 2 | [submodule "Backend"] 3 | path = Backend 4 | url = https://github.com/TUD-STKS/VocalTractLabBackend-dev 5 | -------------------------------------------------------------------------------- /resources/examples/example01-orig.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example01-orig.wav -------------------------------------------------------------------------------- /resources/examples/example01-synth.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example01-synth.wav -------------------------------------------------------------------------------- /resources/examples/example02-orig.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example02-orig.wav -------------------------------------------------------------------------------- /resources/examples/example02-synth.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example02-synth.wav -------------------------------------------------------------------------------- /resources/examples/example03-orig.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example03-orig.wav -------------------------------------------------------------------------------- /resources/examples/example03-synth.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example03-synth.wav -------------------------------------------------------------------------------- /resources/examples/example04-orig.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example04-orig.wav -------------------------------------------------------------------------------- /resources/examples/example04-synth.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example04-synth.wav -------------------------------------------------------------------------------- /resources/examples/example05-orig.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example05-orig.wav -------------------------------------------------------------------------------- /resources/examples/example05-synth.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example05-synth.wav -------------------------------------------------------------------------------- /resources/examples/example06-orig.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example06-orig.wav -------------------------------------------------------------------------------- /resources/examples/example06-synth.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUD-STKS/VocalTractLab-dev/HEAD/resources/examples/example06-synth.wav -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners are maintainers of a repository. This repo will only allow pull requests to be merged after a code owner has approved the request. 2 | * @nullpunktTUD @PaKr1234 3 | -------------------------------------------------------------------------------- /resources/examples/apfelsine.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.073054; 2 | name = a; duration_s = 0.086734; 3 | name = p; duration_s = 0.086361; 4 | name = f; duration_s = 0.099067; 5 | name = l; duration_s = 0.126301; 6 | name = z; duration_s = 0.090998; 7 | name = i; duration_s = 0.138091; 8 | name = n; duration_s = 0.087999; 9 | name = @; duration_s = 0.136060; 10 | -------------------------------------------------------------------------------- /resources/examples/example05.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.202818; 2 | name = z; duration_s = 0.092860; 3 | name = i:; duration_s = 0.074834; 4 | name = l; duration_s = 0.082854; 5 | name = OY; duration_s = 0.188682; 6 | name = f; duration_s = 0.101044; 7 | name = t; duration_s = 0.067873; 8 | name = S; duration_s = 0.107531; 9 | name = n; duration_s = 0.061686; 10 | name = E; duration_s = 0.066742; 11 | name = l; duration_s = 0.058017; 12 | name = h; duration_s = 0.088495; 13 | name = I; duration_s = 0.074509; 14 | name = n; duration_s = 0.182120; 15 | -------------------------------------------------------------------------------- /resources/examples/example04.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.160778; 2 | name = ?; duration_s = 0.068599; 3 | name = a; duration_s = 0.055916; 4 | name = b; duration_s = 0.044813; 5 | name = 6; duration_s = 0.086833; 6 | name = z; duration_s = 0.107612; 7 | name = e:; duration_s = 0.095935; 8 | name = @; duration_s = 0.064789; 9 | name = n; duration_s = 0.074703; 10 | name = v; duration_s = 0.067841; 11 | name = I; duration_s = 0.065991; 12 | name = l; duration_s = 0.046945; 13 | name = z; duration_s = 0.089312; 14 | name = i:; duration_s = 0.093705; 15 | name = ?; duration_s = 0.028786; 16 | name = i:; duration_s = 0.036469; 17 | name = n; duration_s = 0.066424; 18 | name = d; duration_s = 0.057864; 19 | name = O; duration_s = 0.135402; 20 | name = x; duration_s = 0.193871; 21 | -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "", 12 | "ctestCommandArgs": "" 13 | }, 14 | { 15 | "name": "x64-Release", 16 | "generator": "Visual Studio 16 2019 Win64", 17 | "configurationType": "Release", 18 | "buildRoot": "${projectDir}\\out\\build\\${name}", 19 | "installRoot": "${projectDir}\\out\\install\\${name}", 20 | "cmakeCommandArgs": "", 21 | "buildCommandArgs": "", 22 | "ctestCommandArgs": "", 23 | "inheritEnvironments": [ "msvc_x64_x64" ] 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /resources/examples/example06.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.176946; 2 | name = ?; duration_s = 0.056587; 3 | name = aI; duration_s = 0.149102; 4 | name = T; duration_s = 0.172455; 5 | name = I; duration_s = 0.094311; 6 | name = N; duration_s = 0.062874; 7 | name = k; duration_s = 0.068263; 8 | name = ?; duration_s = 0.026048; 9 | name = aI; duration_s = 0.089521; 10 | name = h; duration_s = 0.052994; 11 | name = E; duration_s = 0.101497; 12 | name = f; duration_s = 0.061976; 13 | name = ?; duration_s = 0.010778; 14 | name = @; duration_s = 0.041317; 15 | name = dZ; duration_s = 0.138024; 16 | name = 96; duration_s = 0.126647; 17 | name = m; duration_s = 0.072754; 18 | name = I; duration_s = 0.033234; 19 | name = n; duration_s = 0.046707; 20 | name = ?; duration_s = 0.061078; 21 | name = E; duration_s = 0.094311; 22 | name = k; duration_s = 0.074251; 23 | name = s; duration_s = 0.108683; 24 | name = E; duration_s = 0.066467; 25 | name = n; duration_s = 0.063772; 26 | name = t; duration_s = 0.157186; 27 | -------------------------------------------------------------------------------- /resources/examples/example02.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.263959; 2 | name = ?; duration_s = 0.029014; 3 | name = e:6; duration_s = 0.093031; 4 | name = S; duration_s = 0.138435; 5 | name = Y; duration_s = 0.044504; 6 | name = t; duration_s = 0.063992; 7 | name = s; duration_s = 0.070817; 8 | name = t; duration_s = 0.065742; 9 | name = f; duration_s = 0.079103; 10 | name = O6; duration_s = 0.081388; 11 | name = k; duration_s = 0.144374; 12 | name = E; duration_s = 0.099864; 13 | name = l; duration_s = 0.093657; 14 | name = t; duration_s = 0.081077; 15 | name = @; duration_s = 0.277148; 16 | name = v; duration_s = 0.095159; 17 | name = I; duration_s = 0.097667; 18 | name = n; duration_s = 0.089379; 19 | name = t; duration_s = 0.078888; 20 | name = ?; duration_s = 0.021010; 21 | name = U; duration_s = 0.080477; 22 | name = n; duration_s = 0.031760; 23 | name = t; duration_s = 0.047375; 24 | name = n; duration_s = 0.028983; 25 | name = i:; duration_s = 0.077053; 26 | name = d; duration_s = 0.033860; 27 | name = 6; duration_s = 0.093930; 28 | name = S; duration_s = 0.130300; 29 | name = l; duration_s = 0.050830; 30 | name = e:; duration_s = 0.150791; 31 | name = g; duration_s = 0.062684; 32 | name = N; duration_s = 0.162163; 33 | -------------------------------------------------------------------------------- /src/Application.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include 23 | #include "MainWindow.h" 24 | 25 | // **************************************************************************** 26 | // **************************************************************************** 27 | 28 | class Application : public wxApp 29 | { 30 | public: 31 | virtual bool OnInit(); 32 | #ifdef __linux__ 33 | virtual int OnExit(); 34 | #endif 35 | 36 | void createConsole(); 37 | 38 | }; 39 | 40 | DECLARE_APP(Application) 41 | 42 | -------------------------------------------------------------------------------- /resources/examples/example03.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.201777; 2 | name = k; duration_s = 0.136502; 3 | name = O; duration_s = 0.068281; 4 | name = n; duration_s = 0.053742; 5 | name = i:; duration_s = 0.081427; 6 | name = g; duration_s = 0.096063; 7 | name = l; duration_s = 0.048770; 8 | name = aU; duration_s = 0.124392; 9 | name = b; duration_s = 0.079278; 10 | name = t; duration_s = 0.026157; 11 | name = ?; duration_s = 0.029800; 12 | name = aI; duration_s = 0.167330; 13 | name = g; duration_s = 0.043718; 14 | name = n; duration_s = 0.053419; 15 | name = t; duration_s = 0.091157; 16 | name = l; duration_s = 0.029939; 17 | name = I; duration_s = 0.039045; 18 | name = C; duration_s = 0.038000; 19 | name = n; duration_s = 0.051091; 20 | name = I; duration_s = 0.079496; 21 | name = C; duration_s = 0.052308; 22 | name = t; duration_s = 0.086506; 23 | name = m; duration_s = 0.040606; 24 | name = e:6; duration_s = 0.068580; 25 | name = ?; duration_s = 0.032664; 26 | name = a; duration_s = 0.053514; 27 | name = n; duration_s = 0.052955; 28 | name = d; duration_s = 0.031218; 29 | name = e:; duration_s = 0.071325; 30 | name = n; duration_s = 0.039269; 31 | name = ?; duration_s = 0.032735; 32 | name = o:; duration_s = 0.117764; 33 | name = s; duration_s = 0.101591; 34 | name = t; duration_s = 0.030834; 35 | name = 6; duration_s = 0.083783; 36 | name = h; duration_s = 0.086366; 37 | name = a:; duration_s = 0.155239; 38 | name = z; duration_s = 0.086014; 39 | name = n; duration_s = 0.198758; 40 | -------------------------------------------------------------------------------- /resources/examples/example01.seg: -------------------------------------------------------------------------------- 1 | name = ; duration_s = 0.157573; 2 | name = ?; duration_s = 0.032311; 3 | name = E; duration_s = 0.056973; 4 | name = s; duration_s = 0.086442; 5 | name = k; duration_s = 0.102374; 6 | name = a; duration_s = 0.073007; 7 | name = n; duration_s = 0.043829; 8 | name = h; duration_s = 0.077127; 9 | name = I; duration_s = 0.045877; 10 | name = l; duration_s = 0.066408; 11 | name = f; duration_s = 0.107215; 12 | name = R; duration_s = 0.066136; 13 | name = aI; duration_s = 0.156738; 14 | name = C; duration_s = 0.063610; 15 | name = z; duration_s = 0.082966; 16 | name = aI; duration_s = 0.230612; 17 | name = n; duration_s = 0.124231; 18 | name = v; duration_s = 0.053200; 19 | name = E; duration_s = 0.049495; 20 | name = n; duration_s = 0.034342; 21 | name = m; duration_s = 0.037373; 22 | name = a; duration_s = 0.060102; 23 | name = n; duration_s = 0.079801; 24 | name = v; duration_s = 0.063513; 25 | name = aI; duration_s = 0.279681; 26 | name = s; duration_s = 0.179362; 27 | name = v; duration_s = 0.060292; 28 | name = i:; duration_s = 0.080591; 29 | name = ?; duration_s = 0.029192; 30 | name = aI; duration_s = 0.094086; 31 | name = n; duration_s = 0.065344; 32 | name = ?; duration_s = 0.032229; 33 | name = U; duration_s = 0.081168; 34 | name = n; duration_s = 0.056591; 35 | name = t; duration_s = 0.066186; 36 | name = 6; duration_s = 0.044691; 37 | name = S; duration_s = 0.086280; 38 | name = t; duration_s = 0.064556; 39 | name = a; duration_s = 0.061135; 40 | name = n; duration_s = 0.064506; 41 | name = t; duration_s = 0.059556; 42 | name = g; duration_s = 0.059901; 43 | name = E; duration_s = 0.033798; 44 | name = b; duration_s = 0.088358; 45 | name = aU; duration_s = 0.202452; 46 | name = t; duration_s = 0.061473; 47 | name = v; duration_s = 0.081959; 48 | name = I6; duration_s = 0.183965; 49 | name = t; duration_s = 0.127938; 50 | -------------------------------------------------------------------------------- /src/SilentMessageBox.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SILENT_MESSAGE_BOX__ 23 | #define __SILENT_MESSAGE_BOX__ 24 | 25 | #include 26 | #include 27 | 28 | // **************************************************************************** 29 | /// This dialog displays a message box dialog analogue to ::wxMessageBox(...), 30 | /// but WITHOUT playing a sound when it pops up. 31 | // **************************************************************************** 32 | 33 | class SilentMessageBox : public wxDialog 34 | { 35 | // ************************************************************************** 36 | // Public functions. 37 | // ************************************************************************** 38 | 39 | public: 40 | SilentMessageBox(const wxString& message, const wxString& caption = "Message", 41 | wxWindow *parent = NULL); 42 | }; 43 | 44 | #endif 45 | 46 | // **************************************************************************** 47 | -------------------------------------------------------------------------------- /src/TimeAxisPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __TIME_AXIS_PICTURE_H__ 23 | #define __TIME_AXIS_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | 28 | // **************************************************************************** 29 | /// Draws the time axis on the gestural score page. 30 | // **************************************************************************** 31 | 32 | class TimeAxisPicture : public BasicPicture 33 | { 34 | // ************************************************************************** 35 | // Public functions. 36 | // ************************************************************************** 37 | 38 | public: 39 | TimeAxisPicture(wxWindow *parent); 40 | virtual void draw(wxDC &dc); 41 | 42 | // Returns the minimum height so that the axis with labels fits 43 | int getMinHeight(); 44 | private: 45 | Graph *graph; 46 | }; 47 | 48 | #endif 49 | 50 | // **************************************************************************** 51 | -------------------------------------------------------------------------------- /src/SilentMessageBox.cpp: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include "SilentMessageBox.h" 23 | 24 | // **************************************************************************** 25 | /// Constructor. 26 | // **************************************************************************** 27 | 28 | SilentMessageBox::SilentMessageBox(const wxString& message, 29 | const wxString& caption, wxWindow *parent) : wxDialog(parent, wxID_ANY, 30 | caption, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE & ~wxCLOSE_BOX) 31 | { 32 | // Init the widgets. 33 | wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 34 | 35 | wxStaticText *labText = new wxStaticText(this, wxID_ANY, message); 36 | sizer->Add(labText, 0, wxALL, 10); 37 | 38 | wxButton *btnOk = new wxButton(this, wxID_OK, "OK"); 39 | sizer->Add(btnOk, 0, wxALL | wxALIGN_CENTER, 10); 40 | 41 | this->SetSizer(sizer); 42 | sizer->Fit(this); 43 | sizer->SetSizeHints(this); 44 | } 45 | 46 | // **************************************************************************** 47 | -------------------------------------------------------------------------------- /src/CrossSectionPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __CROSS_SECTION_PICTURE_H__ 23 | #define __CROSS_SECTION_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "VocalTractPicture.h" 27 | 28 | // **************************************************************************** 29 | // **************************************************************************** 30 | 31 | class CrossSectionPicture : public BasicPicture 32 | { 33 | // ************************************************************************** 34 | // Public functions. 35 | // ************************************************************************** 36 | 37 | public: 38 | CrossSectionPicture(wxWindow *parent, VocalTractPicture *picVocalTract); 39 | virtual void draw(wxDC &dc); 40 | 41 | // ************************************************************************** 42 | // Private data. 43 | // ************************************************************************** 44 | 45 | private: 46 | VocalTractPicture *picVocalTract; 47 | int lineWidth{ this->FromDIP(1) }; 48 | }; 49 | 50 | #endif 51 | 52 | // **************************************************************************** 53 | -------------------------------------------------------------------------------- /src/ColorScale.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __COLOR_SCALE__ 23 | #define __COLOR_SCALE__ 24 | 25 | #include 26 | 27 | // **************************************************************************** 28 | /// This class contains functions to create perceptually-based color scales. 29 | // **************************************************************************** 30 | 31 | class ColorScale 32 | { 33 | // **************************************************************** 34 | // Public functions. 35 | // **************************************************************** 36 | 37 | public: 38 | static void rgbToHsv(const double r, const double g, const double b, double &h, double &s, double &v); 39 | static void hsvToRgb(const double h, const double s, const double v, double &r, double &g, double &b); 40 | static void getYellowBlueScale(int numColors, wxColor scale[]); 41 | 42 | static void test(); 43 | 44 | // **************************************************************** 45 | // Private functions. 46 | // **************************************************************** 47 | 48 | static double maximum(double a, double b, double c); 49 | static double minimum(double a, double b, double c); 50 | }; 51 | 52 | 53 | #endif -------------------------------------------------------------------------------- /.github/workflows/msbuild.yml: -------------------------------------------------------------------------------- 1 | name: MSBuild 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | # Path to the solution file relative to the root of the project. 7 | SOLUTION_FILE_PATH: build\msw 8 | 9 | # Configuration type to build. 10 | # You can convert this to a build matrix if you need coverage of multiple configuration types. 11 | # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 12 | BUILD_CONFIGURATION: Release 13 | 14 | jobs: 15 | build: 16 | runs-on: windows-2019 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | - name: Checkout submodules # checkout backend repo as a submodule 21 | shell: bash 22 | run: | 23 | auth_header="$(git config --local --get http.https://github.com/.extraheader)" 24 | git submodule sync --recursive 25 | git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 26 | - name: Cache wxWidgets 27 | id: cache-wx 28 | uses: actions/cache@v2 29 | with: 30 | path: wxWidgets-3.1.3 31 | key: ${{ runner.os }}-wx 32 | 33 | - name: Add MSBuild to PATH (Visual Studio 2019) 34 | uses: microsoft/setup-msbuild@v1.1 35 | with: 36 | vs-version: '[16.0,17.0)' 37 | 38 | - name: Build wxWidgets 39 | if: steps.cache-wx.outputs.cache-hit != 'true' 40 | run: | 41 | Invoke-WebRequest https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.zip -outfile wxWidgets-3.1.3.zip 42 | Expand-Archive wxWidgets-3.1.3.zip 43 | cd wxWidgets-3.1.3 44 | cd build/msw 45 | msbuild wx_vc16.sln --% /m /p:Configuration=${{env.BUILD_CONFIGURATION}};Platform=x64 46 | 47 | - name: Install wxWidgets 48 | working-directory: ${{env.GITHUB_WORKSPACE}} 49 | run: xcopy wxWidgets-3.1.3\* C:\wxwidgets-3.1.3\ /s /h /e 50 | 51 | 52 | - name: Build VocalTractLab 53 | working-directory: ${{env.GITHUB_WORKSPACE}} 54 | # Add additional options to the MSBuild command line here (like platform or verbosity level). 55 | # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference 56 | run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} /ignore:.vcxproj /t:VocalTractLab2 -------------------------------------------------------------------------------- /src/TdsSpatialSignalPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __TDS_SPATIAL_SIGNAL_PICTURE_H__ 23 | #define __TDS_SPATIAL_SIGNAL_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | 28 | // **************************************************************************** 29 | // **************************************************************************** 30 | 31 | class TdsSpatialSignalPicture : public BasicPicture 32 | { 33 | // ************************************************************************** 34 | // Public data. 35 | // ************************************************************************** 36 | 37 | public: 38 | Graph flowGraph; 39 | Graph pressureGraph; 40 | Graph areaGraph; 41 | Graph velocityGraph; 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | TdsSpatialSignalPicture(wxWindow *parent); 49 | virtual void draw(wxDC &dc); 50 | 51 | // ************************************************************************** 52 | // Private data. 53 | // ************************************************************************** 54 | 55 | private: 56 | int lineWidth{ this->FromDIP(1) }; 57 | }; 58 | 59 | #endif 60 | 61 | // **************************************************************************** 62 | -------------------------------------------------------------------------------- /src/TdsTimeSignalPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __TDS_TIME_SIGNAL_PICTURE_H__ 23 | #define __TDS_TIME_SIGNAL_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | #include "Data.h" 28 | 29 | // **************************************************************************** 30 | // **************************************************************************** 31 | 32 | class TdsTimeSignalPicture : public BasicPicture 33 | { 34 | // ************************************************************************** 35 | // Public data. 36 | // ************************************************************************** 37 | 38 | public: 39 | Graph flowGraph; 40 | Graph pressureGraph; 41 | Graph areaGraph; 42 | Graph velocityGraph; 43 | 44 | // ************************************************************************** 45 | // Public functions. 46 | // ************************************************************************** 47 | 48 | public: 49 | TdsTimeSignalPicture(wxWindow *parent); 50 | virtual void draw(wxDC &dc); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | int lineWidth{ this->FromDIP(1) }; 58 | }; 59 | 60 | #endif 61 | 62 | // **************************************************************************** 63 | -------------------------------------------------------------------------------- /.github/workflows/cmake_osx.yml: -------------------------------------------------------------------------------- 1 | name: CMake_OSX 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 7 | BUILD_TYPE: Release 8 | 9 | jobs: 10 | build: 11 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 12 | # You can convert this to a matrix build if you need cross-platform coverage. 13 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 14 | runs-on: macos-10.15 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Checkout submodules # checkout backend repo as a submodule 19 | shell: bash 20 | run: | 21 | auth_header="$(git config --local --get http.https://github.com/.extraheader)" 22 | git submodule sync --recursive 23 | git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 24 | - name: Cache wxWidgets 25 | id: cache-wx 26 | uses: actions/cache@v2 27 | with: 28 | path: wxWidgets-3.1.3 29 | key: ${{ runner.os }}-wx 30 | 31 | 32 | - name: Build wxWidgets 33 | if: steps.cache-wx.outputs.cache-hit != 'true' 34 | working-directory: ${{env.GITHUB_WORKSPACE}} 35 | run: | 36 | curl https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2 -O -L 37 | tar -xf wxWidgets-3.1.3.tar.bz2 38 | cd wxWidgets-3.1.3 39 | mkdir buildosx 40 | cd buildosx 41 | ../configure --with-opengl 42 | make 43 | - name: Install wxWidgets 44 | working-directory: wxWidgets-3.1.3/buildosx 45 | run: | 46 | sudo make install 47 | 48 | - name: Configure CMake 49 | working-directory: ${{env.GITHUB_WORKSPACE}} 50 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. 51 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 52 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} 53 | 54 | - name: Build 55 | working-directory: ${{env.GITHUB_WORKSPACE}} 56 | # Build your program with the given configuration 57 | run: cmake --build ${{github.workspace}}/build --target VocalTractLab 58 | 59 | -------------------------------------------------------------------------------- /.github/workflows/cmake_windows.yml: -------------------------------------------------------------------------------- 1 | name: CMake_Windows 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 7 | BUILD_TYPE: Release 8 | 9 | jobs: 10 | build: 11 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 12 | # You can convert this to a matrix build if you need cross-platform coverage. 13 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 14 | runs-on: windows-2019 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Checkout submodules # checkout backend repo as a submodule 19 | shell: bash 20 | run: | 21 | auth_header="$(git config --local --get http.https://github.com/.extraheader)" 22 | git submodule sync --recursive 23 | git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 24 | - name: Cache wxWidgets 25 | id: cache-wx 26 | uses: actions/cache@v2 27 | with: 28 | path: wxWidgets-3.1.3 29 | key: ${{ runner.os }}-wx 30 | 31 | 32 | - name: Build wxWidgets 33 | if: steps.cache-wx.outputs.cache-hit != 'true' 34 | run: | 35 | Invoke-WebRequest https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.zip -outfile wxWidgets-3.1.3.zip 36 | Expand-Archive wxWidgets-3.1.3.zip 37 | cd wxWidgets-3.1.3 38 | mkdir buildmsw 39 | cd buildmsw 40 | cmake .. -DwxBUILD_SHARED=OFF 41 | cmake --build . --config Release 42 | xcopy lib\* ..\lib\ 43 | 44 | - name: Install wxWidgets 45 | working-directory: ${{env.GITHUB_WORKSPACE}} 46 | run: xcopy wxWidgets-3.1.3\* C:\wxwidgets-3.1.3\ /s /h /e 47 | 48 | - name: Configure CMake 49 | working-directory: ${{env.GITHUB_WORKSPACE}} 50 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. 51 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 52 | run: cmake -B ${{github.workspace}}/build 53 | 54 | - name: Build 55 | working-directory: ${{env.GITHUB_WORKSPACE}} 56 | # Build your program with the given configuration 57 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target VocalTractLab 58 | 59 | -------------------------------------------------------------------------------- /src/BasicPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __BASIC_PICTURE_H__ 23 | #define __BASIC_PICTURE_H__ 24 | 25 | #include 26 | #include 27 | 28 | // **************************************************************************** 29 | // **************************************************************************** 30 | 31 | class BasicPicture : public wxPanel 32 | { 33 | // ************************************************************************** 34 | // Public functions. 35 | // ************************************************************************** 36 | 37 | public: 38 | BasicPicture(wxWindow *parent); 39 | virtual void draw(wxDC &dc); 40 | wxBitmap *getBitmap(); 41 | 42 | // ************************************************************************** 43 | // Private data. 44 | // ************************************************************************** 45 | 46 | private: 47 | /// Background bitmap of the picture for double-buffered painting 48 | wxBitmap *bitmap; 49 | 50 | // ************************************************************************** 51 | // Private functions. 52 | // ************************************************************************** 53 | 54 | private: 55 | void OnPaint(wxPaintEvent &event); 56 | void OnEraseBackground(wxEraseEvent &event); 57 | 58 | // **************************************************************************** 59 | // Declare the event table right at the end 60 | // **************************************************************************** 61 | 62 | DECLARE_EVENT_TABLE() 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/SpectrogramPlot.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SPECTROGRAM_PLOT_H__ 23 | #define __SPECTROGRAM_PLOT_H__ 24 | 25 | #include 26 | #include "VocalTractLabBackend/Dsp.h" 27 | #include 28 | 29 | using namespace std; 30 | 31 | // **************************************************************************** 32 | /// The window shape is always a gaussian. 33 | // **************************************************************************** 34 | 35 | class SpectrogramPlot 36 | { 37 | // ************************************************************************** 38 | // Public data. 39 | // ************************************************************************** 40 | 41 | public: 42 | int windowLength_pt; 43 | int frameLengthExponent; 44 | double viewRange_Hz; 45 | double dynamicRange_dB; 46 | 47 | // ************************************************************************** 48 | // Public functions. 49 | // ************************************************************************** 50 | 51 | public: 52 | SpectrogramPlot(); 53 | 54 | void drawSpectrogram(wxDC &dc, int areaX, int areaY, int areaWidth, int areaHeight, 55 | Signal16 *s, int firstSample, int numSamples); 56 | 57 | int getFrameLengthExponent(int windowLength_pt); 58 | void getGaussWindow(Signal &window, int windowLength_pt); 59 | 60 | void drawCurve( 61 | wxDC &dc, int areaX, int areaY, int areaWidth, int areaHeight, 62 | vector &samples, double timeStep_s, double startTime_s, double duration_s, 63 | double minValue, double maxValue, wxColor color, bool dashed = false); 64 | 65 | }; 66 | 67 | 68 | #endif -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/SoundLib.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SOUND_LIB__ 23 | #define __SOUND_LIB__ 24 | 25 | #include 26 | #include "VocalTractLabBackend/Signal.h" 27 | #include "VocalTractLabBackend/Dsp.h" 28 | 29 | // **************************************************************************** 30 | 31 | class SoundInterface 32 | { 33 | public: 34 | virtual ~SoundInterface() {} 35 | virtual bool init(int samplingRate) = 0; 36 | virtual bool startPlayingWave(signed short *data, int numSamples, bool loop = false) = 0; 37 | virtual bool stopPlaying() = 0; 38 | virtual bool startRecordingWave(signed short *data, int numSamples) = 0; 39 | virtual bool stopRecording() = 0; 40 | static SoundInterface *getInstance(); 41 | }; 42 | 43 | 44 | // **************************************************************************** 45 | // deprecated interface (for backward compatibility reasons) 46 | // **************************************************************************** 47 | 48 | inline bool initSound(int samplingRate) 49 | { 50 | return SoundInterface::getInstance()->init(samplingRate); 51 | } 52 | 53 | inline bool waveStartPlaying(signed short *data, int numSamples, bool loop) 54 | { 55 | return SoundInterface::getInstance()->startPlayingWave(data, numSamples, loop); 56 | } 57 | 58 | inline bool waveStopPlaying() 59 | { 60 | return SoundInterface::getInstance()->stopPlaying(); 61 | } 62 | 63 | inline bool waveStartRecording(signed short *data, int numSamples) 64 | { 65 | return SoundInterface::getInstance()->startRecordingWave(data, numSamples); 66 | } 67 | 68 | inline bool waveStopRecording() 69 | { 70 | return SoundInterface::getInstance()->stopRecording(); 71 | } 72 | 73 | // **************************************************************************** 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /.github/workflows/cmake_linux.yml: -------------------------------------------------------------------------------- 1 | name: CMake_Linux 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 7 | BUILD_TYPE: Release 8 | 9 | jobs: 10 | build: 11 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 12 | # You can convert this to a matrix build if you need cross-platform coverage. 13 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Checkout submodules # checkout backend repo as a submodule 19 | shell: bash 20 | run: | 21 | auth_header="$(git config --local --get http.https://github.com/.extraheader)" 22 | git submodule sync --recursive 23 | git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 24 | - name: Cache wxWidgets 25 | id: cache-wx 26 | uses: actions/cache@v2 27 | with: 28 | path: wxWidgets-3.1.3 29 | key: ${{ runner.os }}-wx 30 | 31 | - name: Get GTK3 libs 32 | run: sudo apt-get update && sudo apt-get install libgtk-3-dev 33 | 34 | - name: Get OpenAL 35 | run: sudo apt-get install libopenal-dev 36 | 37 | - name: Get OpenGL 38 | run: sudo apt-get install mesa-utils 39 | 40 | - name: Get GLUT 41 | run: sudo apt-get install freeglut3-dev 42 | 43 | - name: Build wxWidgets 44 | if: steps.cache-wx.outputs.cache-hit != 'true' 45 | working-directory: ${{env.GITHUB_WORKSPACE}} 46 | run: | 47 | wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2 48 | tar -xf wxWidgets-3.1.3.tar.bz2 49 | cd wxWidgets-3.1.3 50 | mkdir buildgtk 51 | cd buildgtk 52 | ../configure --with-gtk --with-opengl 53 | make 54 | - name: Install wxWidgets 55 | working-directory: wxWidgets-3.1.3/buildgtk 56 | run: | 57 | sudo make install 58 | sudo ldconfig 59 | 60 | - name: Configure CMake 61 | working-directory: ${{env.GITHUB_WORKSPACE}} 62 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. 63 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 64 | run: cmake -B ${{github.workspace}}/build 65 | 66 | - name: Build 67 | working-directory: ${{env.GITHUB_WORKSPACE}} 68 | # Build your program with the given configuration 69 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target VocalTractLab 70 | 71 | -------------------------------------------------------------------------------- /src/LfPulsePicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __LF_PULSE_PICTURE_H__ 23 | #define __LF_PULSE_PICTURE_H__ 24 | 25 | #include "Data.h" 26 | #include "BasicPicture.h" 27 | #include "VocalTractLabBackend/LfPulse.h" 28 | 29 | // **************************************************************************** 30 | /// This class represents a picture showing an LF glottal flow pulse. 31 | // **************************************************************************** 32 | 33 | class LfPulsePicture : public BasicPicture 34 | { 35 | // ************************************************************************** 36 | // Public data. 37 | // ************************************************************************** 38 | 39 | public: 40 | // Options for the rendering of the LF-pulse 41 | bool showDerivative; 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | LfPulsePicture(wxWindow *parent); 49 | virtual void draw(wxDC &dc); 50 | 51 | // ************************************************************************** 52 | // Private data. 53 | // ************************************************************************** 54 | 55 | private: 56 | LfPulse *lfPulse; 57 | 58 | // ************************************************************************** 59 | // Private functions. 60 | // ************************************************************************** 61 | 62 | private: 63 | void OnMouseClick(wxMouseEvent &event); 64 | int lineWidth{ this->FromDIP(1) }; 65 | 66 | // ************************************************************************** 67 | // Declare the event table right at the end 68 | // ************************************************************************** 69 | 70 | DECLARE_EVENT_TABLE() 71 | }; 72 | 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/SpectrumOptionsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SPECTRUM_OPTIONS_DIALOG_H__ 23 | #define __SPECTRUM_OPTIONS_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "SpectrumPicture.h" 29 | #include "Data.h" 30 | 31 | // **************************************************************************** 32 | /// This dialog lets the user adjust the options for the spectrum picture. 33 | // **************************************************************************** 34 | 35 | class SpectrumOptionsDialog : public wxDialog 36 | { 37 | // ************************************************************************** 38 | // Public functions. 39 | // ************************************************************************** 40 | 41 | public: 42 | static SpectrumOptionsDialog *getInstance(SpectrumPicture *spectrumPicture); 43 | 44 | // ************************************************************************** 45 | // Private data. 46 | // ************************************************************************** 47 | 48 | private: 49 | // The single instance of this Singleton 50 | static SpectrumOptionsDialog *instance; 51 | static SpectrumPicture *spectrumPicture; 52 | Data *data; 53 | 54 | wxRadioBox *radSpectrumType; 55 | wxCheckBox *chkShowHarmonics; 56 | 57 | // ************************************************************************** 58 | // Private functions. 59 | // ************************************************************************** 60 | 61 | private: 62 | SpectrumOptionsDialog(wxWindow *parent); 63 | void initWidgets(); 64 | void updateWidgets(); 65 | 66 | void OnSpectrumType(wxCommandEvent &event); 67 | void OnShowHarmonics(wxCommandEvent &event); 68 | 69 | // ************************************************************************** 70 | // Declare the event table. 71 | // ************************************************************************** 72 | 73 | DECLARE_EVENT_TABLE() 74 | }; 75 | 76 | 77 | #endif -------------------------------------------------------------------------------- /src/TdsTubePicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __TDS_AREA_FUNCTION_PICTURE_H__ 23 | #define __TDS_AREA_FUNCTION_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | #include "VocalTractLabBackend/Tube.h" 28 | 29 | // **************************************************************************** 30 | // **************************************************************************** 31 | 32 | class TdsTubePicture : public BasicPicture 33 | { 34 | // ************************************************************************** 35 | // Public data. 36 | // ************************************************************************** 37 | 38 | public: 39 | static const wxBrush ARTICULATOR_BRUSH[Tube::NUM_ARTICULATORS]; 40 | 41 | Graph graph; 42 | bool showArticulators; 43 | 44 | // ************************************************************************** 45 | // Public functions. 46 | // ************************************************************************** 47 | 48 | public: 49 | TdsTubePicture(wxWindow *parent, wxWindow *updateEventReceiver); 50 | virtual void draw(wxDC &dc); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | wxWindow *updateEventReceiver; 58 | int lineWidth{ this->FromDIP(1) }; 59 | 60 | // ************************************************************************** 61 | // Event handlers. 62 | // ************************************************************************** 63 | 64 | private: 65 | void OnMouseEvent(wxMouseEvent &event); 66 | 67 | // ************************************************************************** 68 | // Declare the event table right at the end 69 | // ************************************************************************** 70 | 71 | DECLARE_EVENT_TABLE() 72 | }; 73 | 74 | #endif 75 | 76 | // **************************************************************************** 77 | -------------------------------------------------------------------------------- /src/TimeAxisPicture.cpp: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include "TimeAxisPicture.h" 23 | #include "Data.h" 24 | 25 | 26 | // **************************************************************************** 27 | /// Construcor. Passes the parent parameter. 28 | // **************************************************************************** 29 | 30 | TimeAxisPicture::TimeAxisPicture(wxWindow *parent) : BasicPicture(parent) 31 | { 32 | // **************************************************************** 33 | // Init the time axis graph. 34 | // **************************************************************** 35 | 36 | graph = Data::getInstance()->gsTimeAxisGraph; 37 | const int labelHeight = graph->getFont().GetPixelSize().GetHeight(); 38 | graph->init(this, Data::getInstance()->LEFT_SCORE_MARGIN, 0, 2 * labelHeight , 0.5*labelHeight); 39 | graph->abscissaAtBottom = false; 40 | graph->initAbscissa(PQ_TIME, 0.0, 0.001, 41 | 0.0, 0.0, 0.0, 0.1, 10.0, 1.2, 42 | 16, 2, false, false, false); 43 | } 44 | 45 | 46 | // **************************************************************************** 47 | /// Draws the picture. 48 | // **************************************************************************** 49 | 50 | void TimeAxisPicture::draw(wxDC &dc) 51 | { 52 | // Re-init graph because the margin may have changed 53 | const int labelHeight = graph->getFont().GetPixelSize().GetHeight(); 54 | graph->init(this, Data::getInstance()->LEFT_SCORE_MARGIN, 0, 2 * labelHeight, 0.5 * labelHeight); 55 | 56 | // **************************************************************** 57 | // Fill the background and draw the graph. 58 | // **************************************************************** 59 | 60 | dc.SetBackground(*wxWHITE_BRUSH); 61 | dc.Clear(); 62 | graph->paintAbscissa(dc); 63 | } 64 | 65 | int TimeAxisPicture::getMinHeight() 66 | { 67 | int _, top, bottom; 68 | graph->getMargins(_, _, top, bottom); 69 | return top + bottom; 70 | } 71 | 72 | // **************************************************************************** 73 | -------------------------------------------------------------------------------- /src/GlottisDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __GLOTTIS_DIALOG_H__ 23 | #define __GLOTTIS_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "GlottisPanel.h" 30 | 31 | 32 | // **************************************************************************** 33 | /// This dialog lets the user adjust the parameters for the different 34 | /// implemented glottis models. 35 | // **************************************************************************** 36 | 37 | class GlottisDialog : public wxDialog 38 | { 39 | // ************************************************************************** 40 | // Public functions. 41 | // ************************************************************************** 42 | 43 | public: 44 | static GlottisDialog *getInstance(); 45 | void updateWidgets(); 46 | 47 | // ************************************************************************** 48 | // Private data. 49 | // ************************************************************************** 50 | 51 | private: 52 | // The single instance of this Singleton 53 | static GlottisDialog *instance; 54 | Data *data; 55 | 56 | wxNotebook *notebook; 57 | GlottisPanel *page[Data::NUM_GLOTTIS_MODELS]; 58 | wxCheckBox *chkSaveData; 59 | 60 | // ************************************************************************** 61 | // Private functions. 62 | // ************************************************************************** 63 | 64 | private: 65 | GlottisDialog(wxWindow *parent); 66 | void initWidgets(); 67 | 68 | void OnUseThisModel(wxCommandEvent &event); 69 | void OnSaveDataChanged(wxCommandEvent &event); 70 | void OnFileName(wxCommandEvent &event); 71 | void OnePageChanged(wxNotebookEvent &event); 72 | void OnShow(wxShowEvent &event); 73 | 74 | // ************************************************************************** 75 | // Declare the event table. 76 | // ************************************************************************** 77 | 78 | DECLARE_EVENT_TABLE() 79 | }; 80 | 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/PoleZeroPlot.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __POLE_ZERO_PLOT_H__ 23 | #define __POLE_ZERO_PLOT_H__ 24 | 25 | #include "Data.h" 26 | #include "BasicPicture.h" 27 | #include "Graph.h" 28 | 29 | // **************************************************************************** 30 | /// This class represents a picture showing a pole-zero plot. 31 | // **************************************************************************** 32 | 33 | class PoleZeroPlot : public BasicPicture 34 | { 35 | // ************************************************************************** 36 | // Public functions. 37 | // ************************************************************************** 38 | 39 | public: 40 | PoleZeroPlot(wxWindow *parent); 41 | virtual void draw(wxDC &dc); 42 | 43 | // ************************************************************************** 44 | // Private data. 45 | // ************************************************************************** 46 | 47 | private: 48 | Graph graph; 49 | wxMenu *contextMenu; 50 | PoleZeroPlan *plan; 51 | 52 | int menuX; 53 | int menuY; 54 | int lastMx; 55 | int lastMy; 56 | 57 | // ************************************************************************** 58 | // Private functions. 59 | // ************************************************************************** 60 | 61 | private: 62 | void updateParent(); 63 | int getNearPole(int x, int y); 64 | int getNearZero(int x, int y); 65 | void OnMouseEvent(wxMouseEvent &event); 66 | 67 | void OnInsertPole(wxCommandEvent &event); 68 | void OnInsertZero(wxCommandEvent &event); 69 | void OnDeletePole(wxCommandEvent &event); 70 | void OnDeleteZero(wxCommandEvent &event); 71 | void OnDeleteAllPoles(wxCommandEvent &event); 72 | void OnDeleteAllZeros(wxCommandEvent &event); 73 | 74 | // ************************************************************************** 75 | // Declare the event table right at the end 76 | // ************************************************************************** 77 | 78 | DECLARE_EVENT_TABLE() 79 | }; 80 | 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/SpectrogramPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SPECTROGRAM_PICTURE_H__ 23 | #define __SPECTROGRAM_PICTURE_H__ 24 | 25 | #include "Data.h" 26 | #include "BasicPicture.h" 27 | #include "Graph.h" 28 | #include "SpectrogramPlot.h" 29 | 30 | // **************************************************************************** 31 | /// This is the class for the main spectrogram picture on the signal page. 32 | // **************************************************************************** 33 | 34 | class SpectrogramPicture : public BasicPicture 35 | { 36 | // ************************************************************************** 37 | // Public data. 38 | // ************************************************************************** 39 | 40 | public: 41 | SpectrogramPlot *spectrogramPlot; 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | SpectrogramPicture(wxWindow *parent, wxWindow *updateEventReceiver); 49 | virtual void draw(wxDC &dc); 50 | void paintSpectrogram(wxDC &dc); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | Graph graph; 58 | Data *data; 59 | wxWindow *updateEventReceiver; 60 | 61 | // ************************************************************************** 62 | // Private functions. 63 | // ************************************************************************** 64 | 65 | private: 66 | void OnMouseEvent(wxMouseEvent &event); 67 | 68 | // **************************************************************************** 69 | // Declare the event table right at the end 70 | // **************************************************************************** 71 | 72 | DECLARE_EVENT_TABLE() 73 | }; 74 | 75 | #endif 76 | 77 | // **************************************************************************** 78 | -------------------------------------------------------------------------------- /src/SimpleSpectrumPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SIMPLE_SPECTRUM_PICTURE_H__ 23 | #define __SIMPLE_SPECTRUM_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | #include "SpectrogramPlot.h" 28 | #include "Data.h" 29 | 30 | // **************************************************************************** 31 | // **************************************************************************** 32 | 33 | class SimpleSpectrumPicture : public BasicPicture 34 | { 35 | // ************************************************************************** 36 | // Public data. 37 | // ************************************************************************** 38 | 39 | public: 40 | 41 | // ************************************************************************** 42 | // Public functions. 43 | // ************************************************************************** 44 | 45 | public: 46 | SimpleSpectrumPicture(wxWindow *parent); 47 | virtual void draw(wxDC &dc); 48 | 49 | // ************************************************************************** 50 | // Private data. 51 | // ************************************************************************** 52 | 53 | private: 54 | Data *data; 55 | Graph timeSignalGraph; 56 | Graph spectrumGraph; 57 | Graph *graph; // One of the two graphs above 58 | int lineWidth{ this->FromDIP(1) }; 59 | 60 | // ************************************************************************** 61 | // Private functions. 62 | // ************************************************************************** 63 | 64 | private: 65 | void drawFunction(wxDC &dc); 66 | // void drawYinDifferenceFunction(wxDC &dc); 67 | void OnMouseEvent(wxMouseEvent &event); 68 | 69 | // **************************************************************************** 70 | // Declare the event table right at the end 71 | // **************************************************************************** 72 | 73 | DECLARE_EVENT_TABLE() 74 | }; 75 | 76 | #endif 77 | 78 | // **************************************************************************** 79 | -------------------------------------------------------------------------------- /src/AnnotationDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __ANNOTATION_DIALOG_H__ 23 | #define __ANNOTATION_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "Data.h" 31 | #include "VocalTractLabBackend/SegmentSequence.h" 32 | 33 | using namespace std; 34 | 35 | 36 | // **************************************************************************** 37 | /// This allows to annotate phonetic segments. 38 | // **************************************************************************** 39 | 40 | class AnnotationDialog : public wxDialog 41 | { 42 | // ************************************************************************** 43 | // Public data. 44 | // ************************************************************************** 45 | 46 | public: 47 | wxGrid* grid; 48 | 49 | // ************************************************************************** 50 | // Public functions. 51 | // ************************************************************************** 52 | 53 | public: 54 | static AnnotationDialog *getInstance(wxWindow *updateEventReceiver); 55 | void updateWidgets(); 56 | 57 | // ************************************************************************** 58 | // Private data. 59 | // ************************************************************************** 60 | 61 | private: 62 | // The single instance of this Singleton 63 | static AnnotationDialog *instance; 64 | Data *data; 65 | wxWindow *updateEventReceiver; 66 | 67 | // ************************************************************************** 68 | // Private functions. 69 | // ************************************************************************** 70 | 71 | private: 72 | AnnotationDialog(wxWindow *parent); 73 | void initWidgets(); 74 | 75 | void OnCellChanged(wxGridEvent &event); 76 | void OnShow(wxShowEvent &event); 77 | void OnKillFocus(wxFocusEvent &event); 78 | 79 | // ************************************************************************** 80 | // Declare the event table. 81 | // ************************************************************************** 82 | 83 | DECLARE_EVENT_TABLE() 84 | }; 85 | 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/PhoneticParamsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __PHONETIC_PARAMS_DIALOG__ 23 | #define __PHONETIC_PARAMS_DIALOG__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | 30 | // **************************************************************************** 31 | /// This dialog lets the user vary phonetic parameters and see the changes in 32 | /// the vocal tract shape and the transfer function (on the parent page). 33 | // **************************************************************************** 34 | 35 | class PhoneticParamsDialog : public wxDialog 36 | { 37 | // ************************************************************************** 38 | // Public data. 39 | // ************************************************************************** 40 | 41 | public: 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | static PhoneticParamsDialog *getInstance(wxWindow *parent = NULL); 49 | void updateWidgets(); 50 | void setUpdateRequestReceiver(wxWindow *receiver); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | static PhoneticParamsDialog *instance; 58 | 59 | Data *data; 60 | wxWindow *updateRequestReceiver; 61 | wxScrollBar *scrValue[Data::NUM_PHONETIC_PARAMS]; 62 | wxStaticText *labValue[Data::NUM_PHONETIC_PARAMS]; 63 | 64 | // ************************************************************************** 65 | // Private functions. 66 | // ************************************************************************** 67 | 68 | private: 69 | PhoneticParamsDialog(wxWindow *parent); 70 | void initWidgets(); 71 | void updateVocalTract(); 72 | 73 | void OnScrollbarChanged(wxScrollEvent &event); 74 | 75 | // ************************************************************************** 76 | // Declare the event table. 77 | // ************************************************************************** 78 | 79 | DECLARE_EVENT_TABLE() 80 | }; 81 | 82 | #endif -------------------------------------------------------------------------------- /src/AnalysisResultsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __ANALYSIS_RESULTS_DIALOG_H__ 23 | #define __ANALYSIS_RESULTS_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "Data.h" 31 | 32 | using namespace std; 33 | 34 | 35 | // **************************************************************************** 36 | /// This dialog presents the estimation results for F0, F1, F2, F3, and voice 37 | /// quality in a table for all audio tracks. 38 | // **************************************************************************** 39 | 40 | class AnalysisResultsDialog : public wxDialog 41 | { 42 | // ************************************************************************** 43 | // Public data. 44 | // ************************************************************************** 45 | 46 | public: 47 | 48 | // ************************************************************************** 49 | // Public functions. 50 | // ************************************************************************** 51 | 52 | public: 53 | static AnalysisResultsDialog *getInstance(); 54 | void updateWidgets(); 55 | 56 | // ************************************************************************** 57 | // Private data. 58 | // ************************************************************************** 59 | 60 | private: 61 | // The single instance of this Singleton 62 | static AnalysisResultsDialog *instance; 63 | wxGrid *grid; 64 | Data *data; 65 | wxMenu *contextMenu; 66 | 67 | // ************************************************************************** 68 | // Private functions. 69 | // ************************************************************************** 70 | 71 | private: 72 | AnalysisResultsDialog(wxWindow *parent); 73 | void initWidgets(); 74 | double getInterpolatedValue(vector signal, double timeStep_s, double pos_s); 75 | void copyToClipboard(); 76 | 77 | void OnCellRightClicked(wxGridEvent &event); 78 | void OnKeyDown(wxKeyEvent &event); 79 | void OnCopyToClipboard(wxCommandEvent &event); 80 | void OnShow(wxShowEvent &event); 81 | 82 | // ************************************************************************** 83 | // Declare the event table. 84 | // ************************************************************************** 85 | 86 | DECLARE_EVENT_TABLE() 87 | }; 88 | 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /src/SynthesisThread.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SYNTHESIS_THREAD_H__ 23 | #define __SYNTHESIS_THREAD_H__ 24 | 25 | #include 26 | #include 27 | #include "VocalTractLabBackend/TubeSequence.h" 28 | #include "VocalTractLabBackend/TdsModel.h" 29 | #include "Data.h" 30 | 31 | // Define the IDs for events that are sent to the GUI treat. 32 | static const int SYNTHESIS_THREAD_EVENT = 54321; 33 | 34 | // **************************************************************************** 35 | /// This class encapsulates the thread that performs the background calculation 36 | /// of time-domain simulations of the vocal system. 37 | /// The actual computation is done in void Entry(), which is executed when 38 | /// wxThread::Run() is called from an other thread. 39 | /// To terminate the thread before it finishes by itself, call 40 | /// cancelNow(). 41 | /// During execution, the thread continually posts events 42 | /// (SYNTHESIS_THREAD_EVENT) to the GUI thread, which contains the progress of 43 | /// the thread in percent (0..100). When the thread finished its task it sends 44 | /// the value -1. When the GUI thread updated the GUI in response to such an 45 | /// event, it must call signalGuiUpdateFinished() to tell the thread to 46 | /// continue its operation. 47 | // **************************************************************************** 48 | 49 | class SynthesisThread : public wxThread 50 | { 51 | // ************************************************************************** 52 | // ************************************************************************** 53 | 54 | public: 55 | SynthesisThread(wxWindow *window, TubeSequence *tubeSequence); 56 | inline void cancelNow() { canceled = true; } 57 | inline bool wasCanceled() { return canceled; } 58 | inline void signalGuiUpdateFinished() { guiUpdateFinished = true; } 59 | 60 | // Thread execution starts here 61 | virtual void *Entry(); 62 | 63 | // Called when the thread exits (normally or with Delete()), but not when it is killed 64 | virtual void OnExit(); 65 | 66 | // ************************************************************************** 67 | // ************************************************************************** 68 | 69 | private: 70 | wxWindow *window; 71 | TubeSequence *tubeSequence; 72 | bool canceled; 73 | bool guiUpdateFinished; 74 | }; 75 | 76 | // **************************************************************************** 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/AreaFunctionPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __AREA_FUNCTION_PICTURE_H__ 23 | #define __AREA_FUNCTION_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "VocalTractPicture.h" 27 | #include "Graph.h" 28 | #include "VocalTractLabBackend/Tube.h" 29 | 30 | // **************************************************************************** 31 | // **************************************************************************** 32 | 33 | class AreaFunctionPicture : public BasicPicture 34 | { 35 | // ************************************************************************** 36 | // Public data. 37 | // ************************************************************************** 38 | 39 | public: 40 | static const wxBrush ARTICULATOR_BRUSH[Tube::NUM_ARTICULATORS]; 41 | 42 | // Options for the rendering of the area function 43 | bool discreteAreaFunction; 44 | bool showAreas; 45 | bool showSideBranches; 46 | bool showText; 47 | bool showArticulators; 48 | 49 | // ************************************************************************** 50 | // Public functions. 51 | // ************************************************************************** 52 | 53 | public: 54 | AreaFunctionPicture(wxWindow *parent, VocalTractPicture *picVocalTract, wxWindow *updateEventReceiver); 55 | virtual void draw(wxDC &dc); 56 | 57 | // ************************************************************************** 58 | // Private data. 59 | // ************************************************************************** 60 | 61 | private: 62 | VocalTractPicture *picVocalTract; 63 | wxWindow *updateEventReceiver; 64 | Graph circGraph; 65 | Graph areaGraph; 66 | bool moveCutPos; 67 | int lastMx; 68 | int lastMy; 69 | 70 | // ************************************************************************** 71 | // Private functions. 72 | // ************************************************************************** 73 | 74 | private: 75 | void OnMouseEvent(wxMouseEvent &event); 76 | 77 | 78 | private: 79 | // Line width of the pen used for drawing 80 | int lineWidth{ this->FromDIP(1) }; 81 | 82 | // **************************************************************************** 83 | // Declare the event table right at the end 84 | // **************************************************************************** 85 | 86 | DECLARE_EVENT_TABLE() 87 | }; 88 | 89 | #endif 90 | 91 | // **************************************************************************** 92 | -------------------------------------------------------------------------------- /src/EmaConfigDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __EMA_CONFIG_DIALOG_H__ 23 | #define __EMA_CONFIG_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "Data.h" 30 | #include "VocalTractLabBackend/VocalTract.h" 31 | #include "VocalTractPicture.h" 32 | 33 | // **************************************************************************** 34 | /// This dialog lets the user configure the virtual EMA points. 35 | // **************************************************************************** 36 | 37 | class EmaConfigDialog : public wxDialog 38 | { 39 | // ************************************************************************** 40 | // Public functions. 41 | // ************************************************************************** 42 | 43 | public: 44 | static EmaConfigDialog *getInstance(wxWindow *parent, wxWindow *updateEventReceiver); 45 | 46 | // ************************************************************************** 47 | // Private data. 48 | // ************************************************************************** 49 | 50 | private: 51 | static EmaConfigDialog *instance; 52 | Data *data; 53 | VocalTract *tract; 54 | wxWindow *updateEventReceiver; 55 | 56 | wxComboBox *lstSurfaces; 57 | wxSpinCtrl *spinVertex; 58 | wxListBox *lstEmaPoints; 59 | 60 | // ************************************************************************** 61 | // Private functions. 62 | // ************************************************************************** 63 | 64 | private: 65 | EmaConfigDialog(wxWindow *parent, wxWindow *updateEventReceiver); 66 | 67 | void initWidgets(); 68 | void updateWidgets(); 69 | 70 | void fillEmaPointList(); 71 | int getSelectedEmaPoint(); 72 | 73 | void OnEmaPointSelected(wxCommandEvent &event); 74 | void OnSurfaceSelected(wxCommandEvent &event); 75 | void OnSpinCtrlChanged(wxSpinEvent &event); 76 | void OnItemUp(wxCommandEvent &event); 77 | void OnItemDown(wxCommandEvent &event); 78 | void OnAddItem(wxCommandEvent &event); 79 | void OnRemoveItem(wxCommandEvent &event); 80 | void OnRenameItem(wxCommandEvent &event); 81 | void OnSetDefaultValues(wxCommandEvent &event); 82 | 83 | // ************************************************************************** 84 | // Declare the event table. 85 | // ************************************************************************** 86 | 87 | DECLARE_EVENT_TABLE() 88 | }; 89 | 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /src/PoleZeroDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __POLE_ZERO_DIALOG__ 23 | #define __POLE_ZERO_DIALOG__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | #include "PoleZeroPlot.h" 30 | #include "VocalTractLabBackend/PoleZeroPlan.h" 31 | 32 | 33 | // **************************************************************************** 34 | /// This dialog lets the user edit a pole-zero plan. 35 | // **************************************************************************** 36 | 37 | class PoleZeroDialog : public wxDialog 38 | { 39 | // ************************************************************************** 40 | // Public data. 41 | // ************************************************************************** 42 | 43 | public: 44 | 45 | // ************************************************************************** 46 | // Public functions. 47 | // ************************************************************************** 48 | 49 | public: 50 | static PoleZeroDialog *getInstance(); 51 | void updateWidgets(); 52 | void setSpectrumPicture(wxPanel *spectrumPicture); 53 | 54 | // ************************************************************************** 55 | // Private data. 56 | // ************************************************************************** 57 | 58 | private: 59 | static PoleZeroDialog *instance; 60 | 61 | Data *data; 62 | PoleZeroPlan *plan; 63 | wxPanel *spectrumPicture; 64 | 65 | // Widgets. 66 | PoleZeroPlot *poleZeroPlot; 67 | wxStaticText *labPoleLocations; 68 | wxStaticText *labZeroLocations; 69 | wxCheckBox *chkHigherPoleCorrection; 70 | 71 | // ************************************************************************** 72 | // Private functions. 73 | // ************************************************************************** 74 | 75 | private: 76 | PoleZeroDialog(wxWindow *parent); 77 | void initWidgets(); 78 | void OnUpdateRequest(wxCommandEvent &event); 79 | 80 | void OnHigherPoleCorrection(wxCommandEvent &event); 81 | void OnEnterPoles(wxCommandEvent &event); 82 | void OnEnterZeros(wxCommandEvent &event); 83 | void OnPlayShortVowel(wxCommandEvent &event); 84 | void OnPlayLongVowel(wxCommandEvent &event); 85 | 86 | // ************************************************************************** 87 | // Declare the event table. 88 | // ************************************************************************** 89 | 90 | DECLARE_EVENT_TABLE() 91 | }; 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /src/GlottisPanel.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __GLOTTIS_PANEL_H__ 23 | #define __GLOTTIS_PANEL_H__ 24 | 25 | #include 26 | 27 | #include "Data.h" 28 | #include "GlottisPicture.h" 29 | #include "VocalTractLabBackend/Glottis.h" 30 | 31 | // **************************************************************************** 32 | // **************************************************************************** 33 | 34 | class GlottisPanel : public wxScrolledWindow //wxPanel 35 | { 36 | // ************************************************************************** 37 | // Public data. 38 | // ************************************************************************** 39 | 40 | public: 41 | static const int MAX_PARAMS = 32; 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | GlottisPanel(wxWindow *parent, int index); 49 | void updateWidgets(); 50 | void updateShapeList(); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | int modelIndex; 58 | Glottis *glottis; 59 | 60 | GlottisPicture *picGlottis; 61 | wxScrollBar *scrControlParam[MAX_PARAMS]; 62 | wxStaticText *labControlParam[MAX_PARAMS]; 63 | wxComboBox *lstShape; 64 | wxTextCtrl *txtStaticParam[MAX_PARAMS]; 65 | wxStaticText *labDerivedParam[MAX_PARAMS]; 66 | 67 | // ************************************************************************** 68 | // Private functions. 69 | // ************************************************************************** 70 | 71 | private: 72 | void initWidgets(); 73 | int getSelectedShapeIndex(); 74 | 75 | void OnListItemSelected(wxCommandEvent &event); 76 | void OnSaveAsSelected(wxCommandEvent &event); 77 | void OnSaveAsExisting(wxCommandEvent &event); 78 | void OnSaveAsNew(wxCommandEvent &event); 79 | void OnRemove(wxCommandEvent &event); 80 | void OnScrollEvent(wxScrollEvent &event); 81 | 82 | void OnStaticParamChanged(wxFocusEvent &event); 83 | void OnStaticParamEntered(wxCommandEvent &event); 84 | 85 | // ************************************************************************** 86 | // Declare the event table. 87 | // ************************************************************************** 88 | 89 | DECLARE_EVENT_TABLE() 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /src/LfPulsePicture.cpp: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include "LfPulsePicture.h" 23 | #include "VocalTractLabBackend/Signal.h" 24 | 25 | // **************************************************************************** 26 | // The event table. 27 | // **************************************************************************** 28 | 29 | BEGIN_EVENT_TABLE(LfPulsePicture, BasicPicture) 30 | EVT_LEFT_DOWN(LfPulsePicture::OnMouseClick) 31 | END_EVENT_TABLE() 32 | 33 | 34 | // **************************************************************************** 35 | /// Constructor. Init the variables. 36 | // **************************************************************************** 37 | 38 | LfPulsePicture::LfPulsePicture(wxWindow *parent) : BasicPicture(parent) 39 | { 40 | showDerivative = false; 41 | lfPulse = &Data::getInstance()->lfPulse; 42 | } 43 | 44 | // **************************************************************************** 45 | /// Draws the picture. 46 | // **************************************************************************** 47 | 48 | void LfPulsePicture::draw(wxDC &dc) 49 | { 50 | Signal s; 51 | double min, max; 52 | int i; 53 | 54 | // **************************************************************** 55 | // Fill the background. 56 | // **************************************************************** 57 | 58 | dc.SetBackground(*wxWHITE_BRUSH); 59 | dc.Clear(); 60 | 61 | int width, height; 62 | this->GetSize(&width, &height); 63 | lfPulse->getPulse(s, width, showDerivative); 64 | s.getMinMax(min, max); 65 | 66 | // Paint the pulse ************************************************ 67 | 68 | double factor = max - min; 69 | if (factor < 0.0001) { factor = 0.0001; } 70 | factor = (height-20) / factor; 71 | int y; 72 | int lastY; 73 | 74 | dc.SetPen(wxPen(*wxBLACK, lineWidth)); 75 | 76 | for (i=0; i < width; i++) 77 | { 78 | y = height - 10 - (int)((s.getValue(i) - min)*factor); 79 | if (i > 0) 80 | { 81 | dc.DrawLine(i-1, lastY, i, y); 82 | } 83 | lastY = y; 84 | } 85 | } 86 | 87 | // **************************************************************************** 88 | /// A mouse click toggels between the normal pulse and the time-derivative of 89 | /// the pulse. 90 | // **************************************************************************** 91 | 92 | void LfPulsePicture::OnMouseClick(wxMouseEvent &event) 93 | { 94 | showDerivative = !showDerivative; 95 | this->Refresh(); 96 | } 97 | 98 | // **************************************************************************** 99 | -------------------------------------------------------------------------------- /src/GlottisPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __GLOTTIS_PICTURE_H__ 23 | #define __GLOTTIS_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | #include "VocalTractLabBackend/Glottis.h" 28 | #include "VocalTractLabBackend/GeometricGlottis.h" 29 | #include "VocalTractLabBackend/TwoMassModel.h" 30 | #include "VocalTractLabBackend/TriangularGlottis.h" 31 | 32 | // **************************************************************************** 33 | // **************************************************************************** 34 | 35 | class GlottisPicture : public BasicPicture 36 | { 37 | // ************************************************************************** 38 | // Public functions. 39 | // ************************************************************************** 40 | 41 | public: 42 | GlottisPicture(wxWindow *parent, Glottis *glottis); 43 | virtual void draw(wxDC &dc); 44 | 45 | // ************************************************************************** 46 | // Private data. 47 | // ************************************************************************** 48 | 49 | private: 50 | struct Point3d 51 | { 52 | double x, y, z; 53 | Point3d() {} 54 | Point3d(double x, double y, double z) 55 | { 56 | this->x = x; 57 | this->y = y; 58 | this->z = z; 59 | } 60 | }; 61 | 62 | Glottis *glottis; 63 | 64 | int originU; 65 | int originV; 66 | double viewFactor; 67 | int lineWidth{ this->FromDIP(1) }; 68 | 69 | // ************************************************************************** 70 | // Private functions. 71 | // ************************************************************************** 72 | 73 | private: 74 | void drawGeometricGlottis(wxDC &dc); 75 | void drawTwoMassModel(wxDC &dc); 76 | void drawTriangularGlottis(wxDC &dc); 77 | 78 | void initView(const double minX, const double maxX, double const minY, 79 | double const maxY, const double minZ, const double maxZ); 80 | void transformCoord(const double x, const double y, const double z, int &u, int &v); 81 | void drawLine(wxDC &dc, const double x0, const double y0, const double z0, 82 | const double x1, const double y1, const double z1); 83 | void drawLines(wxDC &dc, int n, Point3d p3d[], double offsetX = 0.0, double offsetY = 0.0, double offsetZ = 0.0); 84 | void drawPolygon(wxDC &dc, int n, Point3d p3d[], double offsetX = 0.0, double offsetY = 0.0, double offsetZ = 0.0); 85 | }; 86 | 87 | #endif 88 | 89 | // **************************************************************************** 90 | -------------------------------------------------------------------------------- /src/LfPulseDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __LF_PULSE_DIALOG_H__ 23 | #define __LF_PULSE_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | #include "LfPulsePicture.h" 30 | #include "VocalTractLabBackend/LfPulse.h" 31 | 32 | // **************************************************************************** 33 | /// This dialog lets the user adjust the LF-pulse parameters and shows a 34 | /// picture of the pulse waveform. 35 | // **************************************************************************** 36 | 37 | class LfPulseDialog : public wxDialog 38 | { 39 | // ************************************************************************** 40 | // Public data. 41 | // ************************************************************************** 42 | 43 | public: 44 | 45 | // ************************************************************************** 46 | // Public functions. 47 | // ************************************************************************** 48 | 49 | public: 50 | static LfPulseDialog *getInstance(); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | enum Params 58 | { 59 | OPEN_QUOTIENT, 60 | SHAPE_QUOTIENT, 61 | SPECTRAL_TILT, 62 | FUNDAMENTAL_FREQUENCY, 63 | SIGNAL_TO_NOISE_RATIO, 64 | NUM_PARAMS 65 | }; 66 | 67 | static const double PARAM_MIN[NUM_PARAMS]; 68 | static const double PARAM_MAX[NUM_PARAMS]; 69 | 70 | // The single instance of this Singleton 71 | static LfPulseDialog *instance; 72 | 73 | Data *data; 74 | LfPulse *lfPulse; 75 | 76 | LfPulsePicture *lfPulsePicture; 77 | wxScrollBar *scrParam[NUM_PARAMS]; 78 | wxStaticText *labParam[NUM_PARAMS]; 79 | 80 | // ************************************************************************** 81 | // Private functions. 82 | // ************************************************************************** 83 | 84 | private: 85 | LfPulseDialog(wxWindow *parent); 86 | void initWidgets(); 87 | void updateWidgets(); 88 | 89 | void OnScrollEvent(wxScrollEvent &event); 90 | 91 | // ************************************************************************** 92 | // Declare the event table. 93 | // ************************************************************************** 94 | 95 | DECLARE_EVENT_TABLE() 96 | }; 97 | 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /src/FormantOptimizationDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __FORMANT_OPTIMIZATION_DIALOG_H__ 23 | #define __FORMANT_OPTIMIZATION_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "VocalTractLabBackend/VocalTract.h" 29 | 30 | 31 | // **************************************************************************** 32 | /// This dialog lets the user adjust the parameters for the formant 33 | /// optimization. 34 | // **************************************************************************** 35 | 36 | class FormantOptimizationDialog : public wxDialog 37 | { 38 | // ************************************************************************** 39 | // Public data. 40 | // ************************************************************************** 41 | 42 | public: 43 | double F1, F2, F3; 44 | bool paramFixed[VocalTract::NUM_PARAMS]; 45 | double minArea_mm2; 46 | double releaseArea_mm2; 47 | double maxDisplacement_mm; 48 | wxString contextVowel; // Only for optimization of consonants 49 | bool optimizeVowel; 50 | 51 | // ************************************************************************** 52 | // Public functions. 53 | // ************************************************************************** 54 | 55 | public: 56 | FormantOptimizationDialog(wxWindow *parent, VocalTract *vocalTract); 57 | 58 | // ************************************************************************** 59 | // Private data. 60 | // ************************************************************************** 61 | 62 | private: 63 | VocalTract *vocalTract; 64 | wxTextCtrl *txtFormants; 65 | wxCheckBox *chkParamFixed[VocalTract::NUM_PARAMS]; 66 | wxTextCtrl *txtMinArea; 67 | wxTextCtrl *txtReleaseArea; 68 | wxTextCtrl *txtMaxDisplacement; 69 | wxTextCtrl *txtContextVowel; 70 | 71 | // ************************************************************************** 72 | // Private functions. 73 | // ************************************************************************** 74 | 75 | private: 76 | void initWidgets(); 77 | void updateWidgets(); 78 | void resetValues(); 79 | bool setParamsFromControls(); 80 | 81 | // Event handlers. 82 | 83 | void OnSetDefaultValues(wxCommandEvent &event); 84 | void OnOptimizeVowel(wxCommandEvent &event); 85 | void OnOptimizeConsonant(wxCommandEvent &event); 86 | void OnShow(wxShowEvent &event); 87 | 88 | // ************************************************************************** 89 | // Declare the event table. 90 | // ************************************************************************** 91 | 92 | DECLARE_EVENT_TABLE() 93 | }; 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/TdsOptionsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __TDS_OPTIONS_DIALOG_H__ 23 | #define __TDS_OPTIONS_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | 30 | // **************************************************************************** 31 | /// This dialog lets the user adjust the options for the time-domain synthesis. 32 | // **************************************************************************** 33 | 34 | class TdsOptionsDialog : public wxDialog 35 | { 36 | // ************************************************************************** 37 | // Public data. 38 | // ************************************************************************** 39 | 40 | public: 41 | 42 | // ************************************************************************** 43 | // Public functions. 44 | // ************************************************************************** 45 | 46 | public: 47 | static TdsOptionsDialog *getInstance(); 48 | 49 | // ************************************************************************** 50 | // Private data. 51 | // ************************************************************************** 52 | 53 | private: 54 | // The single instance of this Singleton 55 | static TdsOptionsDialog *instance; 56 | TdsModel *model; 57 | 58 | wxCheckBox *chkTurbulenceLosses; 59 | wxCheckBox *chkSoftWalls; 60 | wxCheckBox *chkNoiseSources; 61 | wxCheckBox *chkRadiationFromSkin; 62 | wxCheckBox *chkPiriformFossa; 63 | wxCheckBox *chkInnerLengthCorrections; 64 | wxCheckBox *chkTransvelarCoupling; 65 | wxRadioBox *radSolverOptions; 66 | 67 | wxButton *btnAdaptFromFds; 68 | 69 | // ************************************************************************** 70 | // Private functions. 71 | // ************************************************************************** 72 | 73 | private: 74 | TdsOptionsDialog(wxWindow *parent); 75 | void initWidgets(); 76 | void updateWidgets(); 77 | 78 | void OnTurbulenceLosses(wxCommandEvent &event); 79 | void OnSoftWalls(wxCommandEvent &event); 80 | void OnNoiseSources(wxCommandEvent &event); 81 | void OnRadiationFromSkin(wxCommandEvent &event); 82 | void OnPiriformFossa(wxCommandEvent &event); 83 | void OnInnerLengthCorrections(wxCommandEvent &event); 84 | void OnTransvelarCoupling(wxCommandEvent &event); 85 | void OnSolverOptions(wxCommandEvent &event); 86 | void OnAdaptFromFds(wxCommandEvent &event); 87 | 88 | // ************************************************************************** 89 | // Declare the event table. 90 | // ************************************************************************** 91 | 92 | DECLARE_EVENT_TABLE() 93 | }; 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/FdsOptionsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __FDS_OPTIONS_DIALOG_H__ 23 | #define __FDS_OPTIONS_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | 30 | // **************************************************************************** 31 | /// This dialog lets the user adjust the options for the frequence-domain 32 | /// synthesis. 33 | // **************************************************************************** 34 | 35 | class FdsOptionsDialog : public wxDialog 36 | { 37 | // ************************************************************************** 38 | // Public functions. 39 | // ************************************************************************** 40 | 41 | public: 42 | static FdsOptionsDialog *getInstance(); 43 | 44 | // ************************************************************************** 45 | // Private data. 46 | // ************************************************************************** 47 | 48 | private: 49 | // The single instance of this Singleton 50 | static FdsOptionsDialog *instance; 51 | TlModel *model; 52 | 53 | wxRadioBox *radRadiationOptions; 54 | 55 | wxCheckBox *chkBoundaryLayer; 56 | wxCheckBox *chkHeatConduction; 57 | wxCheckBox *chkSoftWalls; 58 | wxCheckBox *chkHagenResistance; 59 | 60 | wxCheckBox *chkParanasalSinuses; 61 | wxCheckBox *chkPiriformFossa; 62 | wxCheckBox *chkStaticPressureDrops; 63 | wxCheckBox *chkLumpedElements; 64 | wxCheckBox *chkInnerLengthCorrections; 65 | 66 | wxButton *btnConstants; 67 | 68 | // ************************************************************************** 69 | // Private functions. 70 | // ************************************************************************** 71 | 72 | private: 73 | FdsOptionsDialog(wxWindow *parent); 74 | void initWidgets(); 75 | void updateWidgets(bool updateParent = true); 76 | 77 | void OnRadiationOptions(wxCommandEvent &event); 78 | void OnBoundaryLayer(wxCommandEvent &event); 79 | void OnHeatConduction(wxCommandEvent &event); 80 | void OnSoftWalls(wxCommandEvent &event); 81 | void OnHagenResistance(wxCommandEvent &event); 82 | void OnParanasalSinuses(wxCommandEvent &event); 83 | void OnPiriformFossa(wxCommandEvent &event); 84 | void OnStaticPressureDrops(wxCommandEvent &event); 85 | void OnLumpedElements(wxCommandEvent &event); 86 | void OnInnerLengthCorrections(wxCommandEvent &event); 87 | void OnConstants(wxCommandEvent &event); 88 | 89 | // ************************************************************************** 90 | // Declare the event table. 91 | // ************************************************************************** 92 | 93 | DECLARE_EVENT_TABLE() 94 | }; 95 | 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/SignalPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SIGNAL_PICTURE_H__ 23 | #define __SIGNAL_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Graph.h" 27 | #include "Data.h" 28 | 29 | // **************************************************************************** 30 | // **************************************************************************** 31 | 32 | class SignalPicture : public BasicPicture 33 | { 34 | // ************************************************************************** 35 | // Public data. 36 | // ************************************************************************** 37 | 38 | public: 39 | 40 | // ************************************************************************** 41 | // Public functions. 42 | // ************************************************************************** 43 | 44 | public: 45 | SignalPicture(wxWindow *parent, wxWindow *updateParent); 46 | virtual void draw(wxDC &dc); 47 | 48 | // ************************************************************************** 49 | // Private data. 50 | // ************************************************************************** 51 | 52 | private: 53 | Data *data; 54 | wxMenu *contextMenu; 55 | int menuX, menuY; 56 | int lastMx, lastMy; 57 | bool moveLeftBorder; 58 | bool moveRightBorder; 59 | wxWindow *updateParent; 60 | int lineWidth{ this->FromDIP(1) }; 61 | const wxPen trackPen[Data::NUM_TRACKS] = { 62 | wxPen(*wxBLACK, lineWidth), 63 | wxPen(wxColor(0, 190, 0), lineWidth), 64 | wxPen(*wxBLACK, lineWidth), 65 | }; 66 | 67 | // ************************************************************************** 68 | // Private functions. 69 | // ************************************************************************** 70 | 71 | private: 72 | int getSampleIndex(int x, int y, bool constrain); 73 | int getXPos(int sampleIndex, bool atUpperOscillogram); 74 | void drawSelectionMark(wxDC &dc, int x, int y1, int y2, bool isLeftMark); 75 | void paintUpperOscillogram(wxDC &dc, int w, int h); 76 | void paintLowerOscillogram(wxDC &dc, int yOffset, int w, int h); 77 | int getUpperPictureHeight(); 78 | 79 | void OnMouseEvent(wxMouseEvent &event); 80 | void OnClearSelection(wxCommandEvent &event); 81 | void OnSetSelectionStart(wxCommandEvent &event); 82 | void OnSetSelectionEnd(wxCommandEvent &event); 83 | void OnSelectAll(wxCommandEvent &event); 84 | 85 | // **************************************************************************** 86 | // Declare the event table right at the end 87 | // **************************************************************************** 88 | 89 | DECLARE_EVENT_TABLE() 90 | }; 91 | 92 | #endif 93 | 94 | // **************************************************************************** 95 | -------------------------------------------------------------------------------- /src/VocalTractShapesDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __VOCAL_TRACT_SHAPES_DIALOG__ 23 | #define __VOCAL_TRACT_SHAPES_DIALOG__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | 30 | // **************************************************************************** 31 | /// This dialog lets the user select, edit and add vocal tract configurations 32 | /// to the list of shapes. 33 | // **************************************************************************** 34 | 35 | class VocalTractShapesDialog : public wxDialog 36 | { 37 | // ************************************************************************** 38 | // Public data. 39 | // ************************************************************************** 40 | 41 | public: 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | static VocalTractShapesDialog *getInstance(wxWindow *parent = NULL); 49 | void updateWidgets(); 50 | void fillShapeList(); 51 | void setUpdateRequestReceiver(wxWindow *receiver); 52 | 53 | // ************************************************************************** 54 | // Private data. 55 | // ************************************************************************** 56 | 57 | private: 58 | static VocalTractShapesDialog *instance; 59 | 60 | Data *data; 61 | VocalTract *tract; 62 | wxWindow *updateRequestReceiver; 63 | 64 | wxListBox *lstShapes; 65 | wxTextCtrl *txtValue[VocalTract::NUM_PARAMS]; 66 | 67 | // ************************************************************************** 68 | // Private functions. 69 | // ************************************************************************** 70 | 71 | private: 72 | VocalTractShapesDialog(wxWindow *parent); 73 | void initWidgets(); 74 | 75 | void outputShapeVars(int selection); 76 | void selectShape(int index); 77 | int getSelectedShape(); 78 | 79 | void updateVocalTract(); 80 | 81 | void OnAdd(wxCommandEvent &event); 82 | void OnReplace(wxCommandEvent &event); 83 | void OnDelete(wxCommandEvent &event); 84 | void OnRename(wxCommandEvent &event); 85 | void OnSelect(wxCommandEvent &event); 86 | void OnMoveItemUp(wxCommandEvent &event); 87 | void OnMoveItemDown(wxCommandEvent &event); 88 | void OnValueLostFocus(wxFocusEvent &event); 89 | 90 | void OnItemSelected(wxCommandEvent &event); 91 | void OnItemActivated(wxCommandEvent &event); 92 | void OnListKeyDown(wxKeyEvent &event); 93 | 94 | void OnClose(wxCloseEvent &event); 95 | 96 | // ************************************************************************** 97 | // Declare the event table. 98 | // ************************************************************************** 99 | 100 | DECLARE_EVENT_TABLE() 101 | }; 102 | 103 | #endif -------------------------------------------------------------------------------- /src/AnatomyParamsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __ANATOMY_PARAMS_DIALOG__ 23 | #define __ANATOMY_PARAMS_DIALOG__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | #include "VocalTractLabBackend/AnatomyParams.h" 30 | 31 | // **************************************************************************** 32 | /// This dialog lets the user adjust some high-level anatomy parameters 33 | /// to simulate vocal tract growth, for example. 34 | // **************************************************************************** 35 | 36 | class AnatomyParamsDialog : public wxDialog 37 | { 38 | // ************************************************************************** 39 | // Public data. 40 | // ************************************************************************** 41 | 42 | public: 43 | 44 | // ************************************************************************** 45 | // Public functions. 46 | // ************************************************************************** 47 | 48 | public: 49 | static AnatomyParamsDialog *getInstance(wxWindow *parent = NULL); 50 | void setUpdateRequestReceiver(wxWindow *receiver); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | // The single instance of this Singleton 58 | static AnatomyParamsDialog *instance; 59 | bool isMale; 60 | int age_month; 61 | wxString referenceSpeakerFileName; 62 | 63 | Data *data; 64 | AnatomyParams *params; 65 | wxWindow *updateRequestReceiver; 66 | 67 | wxStaticText *labFileName; 68 | wxStaticText *labAge; 69 | wxScrollBar *scrAge; 70 | wxRadioButton *radMale; 71 | wxRadioButton *radFemale; 72 | 73 | wxScrollBar *scrParam[AnatomyParams::NUM_ANATOMY_PARAMS]; 74 | wxStaticText *labParam[AnatomyParams::NUM_ANATOMY_PARAMS]; 75 | 76 | // ************************************************************************** 77 | // Private functions. 78 | // ************************************************************************** 79 | 80 | private: 81 | AnatomyParamsDialog(wxWindow *parent); 82 | void initWidgets(); 83 | void updateWidgets(); 84 | void updateVocalTract(); 85 | 86 | void OnLoadReferenceSpeaker(wxCommandEvent &event); 87 | void OnGetParamsFromVocalTract(wxCommandEvent &event); 88 | void OnSetParamsForVocalTract(wxCommandEvent &event); 89 | void OnSelectMale(wxCommandEvent &event); 90 | void OnSelectFemale(wxCommandEvent &event); 91 | void OnScrollEvent(wxScrollEvent &event); 92 | 93 | // ************************************************************************** 94 | // Declare the event table. 95 | // ************************************************************************** 96 | 97 | DECLARE_EVENT_TABLE() 98 | }; 99 | 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /src/SignalPage.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef _SIGNAL_PAGE_H_ 23 | #define _SIGNAL_PAGE_H_ 24 | 25 | #include 26 | #include 27 | #include "Data.h" 28 | #include "SignalPicture.h" 29 | #include "SpectrogramPicture.h" 30 | #include "SimpleSpectrumPicture.h" 31 | #include "AnalysisSettingsDialog.h" 32 | #include "AnalysisResultsDialog.h" 33 | 34 | 35 | // **************************************************************************** 36 | // **************************************************************************** 37 | 38 | class SignalPage : wxPanel 39 | { 40 | // **************************************************************** 41 | // Public data. 42 | // **************************************************************** 43 | 44 | public: 45 | 46 | 47 | // **************************************************************** 48 | // Public functions. 49 | // **************************************************************** 50 | 51 | public: 52 | SignalPage(wxWindow *parent); 53 | void updateWidgets(); 54 | void scrollLeft(); 55 | void scrollRight(); 56 | 57 | // **************************************************************** 58 | // Private data. 59 | // **************************************************************** 60 | 61 | private: 62 | Data *data; 63 | 64 | SignalPicture *picSignal; 65 | SpectrogramPicture *picSpectrogram; 66 | SimpleSpectrumPicture *picSimpleSpectrum; 67 | wxScrollBar *scrTime; 68 | 69 | wxCheckBox *chkShowMainTrack; 70 | wxCheckBox *chkShowEggTrack; 71 | wxCheckBox *chkShowExtraTrack; 72 | wxStaticText *labHorzZoom; 73 | wxStaticText *labVertZoom; 74 | 75 | wxRadioBox *radSpectrogramChoice; 76 | wxCheckBox *chkShowSpectrogramText; 77 | 78 | 79 | // **************************************************************** 80 | // Private functions. 81 | // **************************************************************** 82 | 83 | private: 84 | void initVars(); 85 | void initWidgets(); 86 | 87 | void OnUpdateRequest(wxCommandEvent &event); 88 | 89 | void OnScrollEvent(wxScrollEvent &event); 90 | void OnShowMainTrackClicked(wxCommandEvent &event); 91 | void OnShowEggTrackClicked(wxCommandEvent &event); 92 | void OnShowExtraTrackClicked(wxCommandEvent &event); 93 | void OnOsziHorzZoomPlusClicked(wxCommandEvent &event); 94 | void OnOsziHorzZoomMinusClicked(wxCommandEvent &event); 95 | void OnOsziVertZoomPlusClicked(wxCommandEvent &event); 96 | void OnOsziVertZoomMinusClicked(wxCommandEvent &event); 97 | void OnExchangeMainEggClicked(wxCommandEvent &event); 98 | void OnExchangeMainExtraClicked(wxCommandEvent &event); 99 | 100 | void OnSpectrogramChoice(wxCommandEvent &event); 101 | void OnShowSpectrogramText(wxCommandEvent &event); 102 | 103 | void OnAnalysisSettings(wxCommandEvent &event); 104 | void OnAnalysisResults(wxCommandEvent &event); 105 | void OnCalcF0(wxCommandEvent &event); 106 | void OnCalcVoiceQuality(wxCommandEvent &event); 107 | 108 | // **************************************************************************** 109 | // Declare the event table right at the end 110 | // **************************************************************************** 111 | 112 | DECLARE_EVENT_TABLE() 113 | }; 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /src/TransitionDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __TRANSITION_DIALOG__ 23 | #define __TRANSITION_DIALOG__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | 30 | // **************************************************************************** 31 | /// This dialog lets the analyze a consonant-vowel transition with the new 32 | /// coarticulation model. 33 | // **************************************************************************** 34 | 35 | class TransitionDialog : public wxDialog 36 | { 37 | // ************************************************************************** 38 | // Public data. 39 | // ************************************************************************** 40 | 41 | public: 42 | 43 | // ************************************************************************** 44 | // Public functions. 45 | // ************************************************************************** 46 | 47 | public: 48 | static TransitionDialog *getInstance(wxWindow *parent = NULL); 49 | void updateWidgets(); 50 | void setUpdateRequestReceiver(wxWindow *receiver); 51 | 52 | // ************************************************************************** 53 | // Private data. 54 | // ************************************************************************** 55 | 56 | private: 57 | static TransitionDialog *instance; 58 | 59 | // Variables of the controls 60 | wxString consonant; 61 | wxString vowel; 62 | double alphaTongue, betaTongue; 63 | double transitionPos; // 0 <= x <= 1 64 | double minArea_mm2; 65 | bool useFixedVowel; 66 | 67 | Data *data; 68 | wxWindow *updateRequestReceiver; 69 | 70 | wxComboBox *lstConsonant; 71 | wxRadioButton *radFixedVowel; 72 | wxComboBox *lstVowel; 73 | wxStaticText *labVowelParams; 74 | wxRadioButton *radInterpolatedVowel; 75 | wxScrollBar *scrAlpha; 76 | wxScrollBar *scrBeta; 77 | wxStaticText *labAlpha; 78 | wxStaticText *labBeta; 79 | 80 | wxScrollBar *scrTransitionPos; 81 | wxStaticText *labTransitionPos; 82 | wxTextCtrl *txtMinArea; 83 | 84 | // ************************************************************************** 85 | // Private functions. 86 | // ************************************************************************** 87 | 88 | private: 89 | TransitionDialog(wxWindow *parent); 90 | void initWidgets(); 91 | 92 | bool getConsonantAndVowelShape(double *consonantParams, double *vowelParams, 93 | double &aTongue, double &bTongue, double &aLips, double &bLips); 94 | 95 | void calcVocalTract(); 96 | void updateVocalTract(); 97 | void fillShapeLists(); 98 | void get2dVowelParams(const wxString &vowel, double &alphaTongue, double &betaTongue, 99 | double &alphaLips, double &betaLips); 100 | 101 | void OnConsonantSelected(wxCommandEvent &event); 102 | void OnUpdateLists(wxCommandEvent &event); 103 | void OnVowelSelected(wxCommandEvent &event); 104 | void OnUseFixedVowel(wxCommandEvent &event); 105 | void OnUseInterpolatedVowel(wxCommandEvent &event); 106 | void OnScrollbarChanged(wxScrollEvent &event); 107 | void OnFindReleasePosition(wxCommandEvent &event); 108 | void OnMinAreaEnter(wxCommandEvent &event); 109 | 110 | // ************************************************************************** 111 | // Declare the event table. 112 | // ************************************************************************** 113 | 114 | DECLARE_EVENT_TABLE() 115 | }; 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /src/GesturalScorePicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __GESTURAL_SCORE_PICTURE_H__ 23 | #define __GESTURAL_SCORE_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "Data.h" 27 | 28 | 29 | // **************************************************************************** 30 | // **************************************************************************** 31 | 32 | class GesturalScorePicture : public BasicPicture 33 | { 34 | // ************************************************************************** 35 | // Public data. 36 | // ************************************************************************** 37 | 38 | public: 39 | bool showGesturalScore; 40 | 41 | // ************************************************************************** 42 | // Public functions. 43 | // ************************************************************************** 44 | 45 | public: 46 | GesturalScorePicture(wxWindow *parent, wxWindow *updateParent); 47 | virtual void draw(wxDC &dc); 48 | 49 | int getNumControlParams(); 50 | int getVirtualHeight(); 51 | int getWindowHeight(); 52 | void setVertOffset(double offset_percent); 53 | double getVertOffset_percent(); 54 | 55 | // ************************************************************************** 56 | // Private data. 57 | // ************************************************************************** 58 | 59 | private: 60 | static const int MAX_PARAMS = 100; 61 | 62 | Data *data; 63 | GesturalScore *gs; 64 | wxWindow *updateParent; 65 | double verticalOffset_percent; 66 | int gestureRowY[GesturalScore::NUM_GESTURE_TYPES]; 67 | int gestureRowH[GesturalScore::NUM_GESTURE_TYPES]; 68 | int paramRowY[MAX_PARAMS]; 69 | int paramRowH[MAX_PARAMS]; 70 | wxMenu *contextMenu; 71 | 72 | int menuX, menuY; 73 | int lastMx, lastMy; 74 | bool moveBorder; 75 | bool moveTarget; 76 | int lineWidth{ this->FromDIP(1) }; 77 | 78 | // ************************************************************************** 79 | // Private functions. 80 | // ************************************************************************** 81 | 82 | private: 83 | void paintGesturalScore(wxDC &dc); 84 | void paintMotorProgram(wxDC &dc); 85 | void calcGestureRowCoord(); 86 | void calcParamRowCoord(); 87 | void cutString(wxDC &dc, wxString &st, int maxWidth_px); 88 | void getUnderlyingGesture(int localX, int localY, int &gestureType, 89 | int &gestureIndex, bool &isOnBorder, bool &isOnTarget); 90 | void getTargetLineCoord( 91 | int gestureType, int leftBorderX, int rightBorderX, 92 | double t0, double v0, double t1, double v1, 93 | double &x0, double &y0, double &x1, double &y1); 94 | void getParamCurveMinMax(int paramIndex, double &min, double &max); 95 | int getRepresentativeParam(int gestureType); 96 | 97 | void updatePage(int updateParam = UPDATE_PICTURES_AND_CONTROLS); 98 | 99 | void OnMouseEvent(wxMouseEvent &event); 100 | void OnInsertGesture(wxCommandEvent &event); 101 | void OnDeleteGesture(wxCommandEvent &event); 102 | void OnSetInitialScore(wxCommandEvent &event); 103 | void OnScoreFromSegmentSequence(wxCommandEvent &event); 104 | 105 | // **************************************************************************** 106 | // Declare the event table right at the end 107 | // **************************************************************************** 108 | 109 | DECLARE_EVENT_TABLE() 110 | }; 111 | 112 | #endif 113 | 114 | // **************************************************************************** 115 | -------------------------------------------------------------------------------- /src/BasicPicture.cpp: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include "BasicPicture.h" 23 | 24 | 25 | // **************************************************************************** 26 | // The event table. 27 | // **************************************************************************** 28 | 29 | BEGIN_EVENT_TABLE(BasicPicture, wxPanel) 30 | EVT_PAINT (BasicPicture::OnPaint) 31 | EVT_ERASE_BACKGROUND (BasicPicture::OnEraseBackground) 32 | END_EVENT_TABLE() 33 | 34 | 35 | // **************************************************************************** 36 | // **************************************************************************** 37 | 38 | BasicPicture::BasicPicture(wxWindow *parent) : wxPanel(parent, wxID_ANY, 39 | wxDefaultPosition, wxDefaultSize, 40 | wxFULL_REPAINT_ON_RESIZE // Force a complete redraw always when the window is resized 41 | ) 42 | { 43 | // Leave all background painting to the application 44 | SetBackgroundStyle(wxBG_STYLE_CUSTOM); 45 | 46 | // Initialize the background image with a small default size. 47 | bitmap = new wxBitmap(200, 200); 48 | } 49 | 50 | 51 | // **************************************************************************** 52 | /// Reimplement this virtual function in a derived class to do all the painting. 53 | /// This function is automatically called in the paint event handler. 54 | /// As long as this function is not reimplemented, it will draw a test image. 55 | // **************************************************************************** 56 | 57 | void BasicPicture::draw(wxDC &dc) 58 | { 59 | // Clear the background 60 | dc.SetBackground(*wxRED_BRUSH); 61 | dc.Clear(); 62 | 63 | int w, h; 64 | this->GetSize(&w, &h); 65 | 66 | dc.SetPen(*wxBLACK_PEN); 67 | dc.DrawLine(0, 0, w-1, h-1); 68 | 69 | dc.SetPen(*wxWHITE_PEN); 70 | dc.DrawLine(w-1, 0, 0, h-1); 71 | } 72 | 73 | 74 | // **************************************************************************** 75 | /// Returns the bitmap where you can paint on. See the function drawTestImage() 76 | /// for an example. 77 | // **************************************************************************** 78 | 79 | wxBitmap *BasicPicture::getBitmap() 80 | { 81 | // Make sure that we habe a background bitmap that is at least always 82 | // as big as the client area of this window. 83 | 84 | int w, h; 85 | this->GetSize(&w, &h); 86 | if ((bitmap->GetWidth() < w) || (bitmap->GetHeight() < h)) 87 | { 88 | delete bitmap; 89 | bitmap = new wxBitmap(w, h); 90 | } 91 | 92 | // Return the pointer to the bitmap 93 | return bitmap; 94 | } 95 | 96 | 97 | // **************************************************************************** 98 | // **************************************************************************** 99 | 100 | void BasicPicture::OnPaint(wxPaintEvent &event) 101 | { 102 | // ALWAYS create the DC object, wheather it is used or not. 103 | // On destruction of the DC object, the content of bitmap buffer is 104 | // automatically copied into the client area of this window. 105 | 106 | wxBufferedPaintDC dc(this, *getBitmap()); 107 | 108 | // Draw on the device context. 109 | draw(dc); 110 | } 111 | 112 | 113 | // **************************************************************************** 114 | /// Intercept this event to avoid flickering. 115 | // **************************************************************************** 116 | 117 | void BasicPicture::OnEraseBackground(wxEraseEvent &event) 118 | { 119 | // Do nothing here - especially, DO NOT class event.Skip() !! 120 | } 121 | 122 | // **************************************************************************** 123 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeList.txt : CMake project for VocalTractLab, include source and define 2 | # project specific logic here. 3 | # 4 | cmake_minimum_required (VERSION 3.16) 5 | 6 | project ("VocalTractLab") 7 | 8 | set(CMAKE_CXX_STANDARD 11) 9 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) 10 | 11 | add_subdirectory("Backend") 12 | 13 | if (MSVC) 14 | set(wxWidgets_ROOT_DIR C:/wxwidgets-3.1.3) 15 | endif() 16 | # Request the required wxWidgets libs 17 | find_package(wxWidgets 3.1 COMPONENTS core base gl adv REQUIRED) 18 | 19 | # Include the wxWidgets use file to initialize various settings 20 | include(${wxWidgets_USE_FILE}) 21 | 22 | if (MSVC) 23 | add_definitions(-D 24 | _USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D UNICODE -D wxUSE_UNICODE -D _WINDOWS -D __WXMSW__ -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -D NDEBUG) 25 | # Add source to this project's executable. 26 | set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/build/msw/VocalTractLab2.rc") 27 | add_executable (VocalTractLab WIN32 28 | src/AnalysisResultsDialog.cpp 29 | src/AnalysisSettingsDialog.cpp 30 | src/AnatomyParamsDialog.cpp 31 | src/AnnotationDialog.cpp 32 | src/Application.cpp 33 | src/AreaFunctionPicture.cpp 34 | src/BasicPicture.cpp 35 | src/ColorScale.cpp 36 | src/CrossSectionPicture.cpp 37 | src/Data.cpp 38 | src/EmaConfigDialog.cpp 39 | src/FdsOptionsDialog.cpp 40 | src/FormantOptimizationDialog.cpp 41 | src/GesturalScorePage.cpp 42 | src/GesturalScorePicture.cpp 43 | src/GlottisDialog.cpp 44 | src/GlottisPanel.cpp 45 | src/GlottisPicture.cpp 46 | src/Graph.cpp 47 | src/LfPulseDialog.cpp 48 | src/LfPulsePicture.cpp 49 | src/MainWindow.cpp 50 | src/PhoneticParamsDialog.cpp 51 | src/PoleZeroDialog.cpp 52 | src/PoleZeroPlot.cpp 53 | src/SignalComparisonPicture.cpp 54 | src/SignalPage.cpp 55 | src/SignalPicture.cpp 56 | src/SilentMessageBox.cpp 57 | src/SimpleSpectrumPicture.cpp 58 | src/SoundLib.cpp 59 | src/SpectrogramPicture.cpp 60 | src/SpectrogramPlot.cpp 61 | src/SpectrumOptionsDialog.cpp 62 | src/SpectrumPicture.cpp 63 | src/SynthesisThread.cpp 64 | src/TdsOptionsDialog.cpp 65 | src/TdsPage.cpp 66 | src/TdsSpatialSignalPicture.cpp 67 | src/TdsTimeSignalPicture.cpp 68 | src/TdsTubePicture.cpp 69 | src/TimeAxisPicture.cpp 70 | src/TransitionDialog.cpp 71 | src/VocalTractDialog.cpp 72 | src/VocalTractPage.cpp 73 | src/VocalTractPicture.cpp 74 | src/VocalTractShapesDialog.cpp 75 | ${APP_ICON_RESOURCE_WINDOWS} 76 | ) 77 | set_property(TARGET VocalTractLab PROPERTY VS_DPI_AWARE "PerMonitor") 78 | target_include_directories(VocalTractLab PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Backend/include/VocalTractLabBackend) 79 | target_link_libraries(VocalTractLab VocalTractLabBackend ${wxWidgets_LIBRARIES} ) 80 | endif() 81 | 82 | if(UNIX) 83 | add_definitions(-D 84 | _USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D WXUSINGDLL -D UNICODE -D wxUSE_UNICODE -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -D NDEBUG -D HAVE_OPENAL) 85 | find_package(OpenGL REQUIRED) 86 | find_package(GLUT REQUIRED) 87 | find_package(OpenAL REQUIRED) 88 | include_directories( ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIRS}) 89 | # Add source to this project's executable. 90 | add_executable (VocalTractLab 91 | src/AnalysisResultsDialog.cpp 92 | src/AnalysisSettingsDialog.cpp 93 | src/AnatomyParamsDialog.cpp 94 | src/AnnotationDialog.cpp 95 | src/Application.cpp 96 | src/AreaFunctionPicture.cpp 97 | src/BasicPicture.cpp 98 | src/ColorScale.cpp 99 | src/CrossSectionPicture.cpp 100 | src/Data.cpp 101 | src/EmaConfigDialog.cpp 102 | src/FdsOptionsDialog.cpp 103 | src/FormantOptimizationDialog.cpp 104 | src/GesturalScorePage.cpp 105 | src/GesturalScorePicture.cpp 106 | src/GlottisDialog.cpp 107 | src/GlottisPanel.cpp 108 | src/GlottisPicture.cpp 109 | src/Graph.cpp 110 | src/LfPulseDialog.cpp 111 | src/LfPulsePicture.cpp 112 | src/MainWindow.cpp 113 | src/PhoneticParamsDialog.cpp 114 | src/PoleZeroDialog.cpp 115 | src/PoleZeroPlot.cpp 116 | src/SignalComparisonPicture.cpp 117 | src/SignalPage.cpp 118 | src/SignalPicture.cpp 119 | src/SilentMessageBox.cpp 120 | src/SimpleSpectrumPicture.cpp 121 | src/SoundLib.cpp 122 | src/SpectrogramPicture.cpp 123 | src/SpectrogramPlot.cpp 124 | src/SpectrumOptionsDialog.cpp 125 | src/SpectrumPicture.cpp 126 | src/SynthesisThread.cpp 127 | src/TdsOptionsDialog.cpp 128 | src/TdsPage.cpp 129 | src/TdsSpatialSignalPicture.cpp 130 | src/TdsTimeSignalPicture.cpp 131 | src/TdsTubePicture.cpp 132 | src/TimeAxisPicture.cpp 133 | src/TransitionDialog.cpp 134 | src/VocalTractDialog.cpp 135 | src/VocalTractPage.cpp 136 | src/VocalTractPicture.cpp 137 | src/VocalTractShapesDialog.cpp 138 | ) 139 | # We have to turn off PIE, otherwise the executable can only be run from the command line 140 | include(CheckPIESupported) 141 | check_pie_supported() 142 | set_property(TARGET VocalTractLab PROPERTY POSITION_INDEPENDENT_CODE FALSE) 143 | target_include_directories(VocalTractLab PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Backend/include/VocalTractLabBackend) 144 | target_link_libraries(VocalTractLab VocalTractLabBackend ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${OPENAL_LIBRARY} ) 145 | endif() 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/VocalTractDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __VOCAL_TRACT_DIALOG_H__ 23 | #define __VOCAL_TRACT_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "Data.h" 29 | #include "VocalTractPicture.h" 30 | #include "EmaConfigDialog.h" 31 | 32 | // **************************************************************************** 33 | /// This dialog displays the vocal tract picture. 34 | // **************************************************************************** 35 | 36 | class VocalTractDialog : public wxDialog 37 | { 38 | // ************************************************************************** 39 | // Public functions. 40 | // ************************************************************************** 41 | 42 | public: 43 | static VocalTractDialog *getInstance(wxWindow *parent = NULL); 44 | VocalTractPicture *getVocalTractPicture(); 45 | void setUpdateRequestReceiver(wxWindow *updateRequestReceiver); 46 | void updateWidgets(); 47 | 48 | // ************************************************************************** 49 | // Private data. 50 | // ************************************************************************** 51 | 52 | private: 53 | static const int NUM_TONGUE_SIDE_POINTS = 3; 54 | 55 | // The single instance of this Singleton 56 | static VocalTractDialog *instance; 57 | 58 | wxWindow *updateRequestReceiver; 59 | Data *data; 60 | wxSize minSizeWithControls; 61 | wxSize minSizeWithoutControls; 62 | wxBoxSizer *topLevelSizer; 63 | wxBoxSizer *controlSizer; 64 | 65 | VocalTractPicture *picVocalTract; 66 | wxButton *showHideControlsButton; 67 | wxPanel *controlPanel; 68 | 69 | // Vocal tract variables controls 70 | 71 | wxScrollBar *scrTongueSide[NUM_TONGUE_SIDE_POINTS]; 72 | wxStaticText *labTongueSide[NUM_TONGUE_SIDE_POINTS]; 73 | 74 | wxCheckBox *chkAutomaticTongueRootCalc; 75 | 76 | // Vocal tract display options. 77 | 78 | wxRadioButton *radNoTract; 79 | wxRadioButton *rad2dTract; 80 | wxRadioButton *rad3dTract; 81 | wxRadioButton *radWireFrameTract; 82 | wxCheckBox *chkBothSides; 83 | 84 | wxCheckBox *chkShowControlPoints; 85 | wxCheckBox *chkShowCenterLine; 86 | wxCheckBox *chkSmoothCenterLine; 87 | wxCheckBox *chkShowCutVectors; 88 | wxCheckBox *chkShowEmaPoints; 89 | 90 | wxStaticText *labBackgroundImageFileName; 91 | wxCheckBox *chkShowBackgroundImage; 92 | wxCheckBox *chkBackgroundImageEditMode; 93 | 94 | // ************************************************************************** 95 | // Private functions. 96 | // ************************************************************************** 97 | 98 | private: 99 | VocalTractDialog(wxWindow *parent); 100 | void initWidgets(); 101 | void updateVocalTractPage(); 102 | 103 | void OnUpdateRequest(wxCommandEvent &event); 104 | 105 | void OnShowHideControls(wxCommandEvent &event); 106 | 107 | void OnTongueSideElevationChanged(wxScrollEvent &event); 108 | void OnAutomaticTongueRootCalc(wxCommandEvent &event); 109 | 110 | void OnShowNoTract(wxCommandEvent &event); 111 | void OnShow2dTract(wxCommandEvent &event); 112 | void OnShow3dTract(wxCommandEvent &event); 113 | void OnShowWireFrameTract(wxCommandEvent &event); 114 | void OnShowBothSides(wxCommandEvent &event); 115 | 116 | void OnShowControlPoints(wxCommandEvent &event); 117 | void OnShowCenterLine(wxCommandEvent &event); 118 | void OnShowCutVectors(wxCommandEvent &event); 119 | void OnShowSmoothCenterLine(wxCommandEvent &event); 120 | 121 | void OnShowEmaPoints(wxCommandEvent &event); 122 | void OnEditEmaPoints(wxCommandEvent &event); 123 | 124 | void OnLoadBackgroundImage(wxCommandEvent &event); 125 | void OnCurrentImageToBackground(wxCommandEvent& event); 126 | void OnShowBackgroundImage(wxCommandEvent &event); 127 | void OnBackgroundImageEditingMode(wxCommandEvent &event); 128 | 129 | // ************************************************************************** 130 | // Declare the event table. 131 | // ************************************************************************** 132 | 133 | DECLARE_EVENT_TABLE() 134 | }; 135 | 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /src/SpectrumPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SPECTRUM_PICTURE_H__ 23 | #define __SPECTRUM_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "VocalTractPicture.h" 27 | #include "Graph.h" 28 | #include "VocalTractLabBackend/Signal.h" 29 | 30 | // **************************************************************************** 31 | // **************************************************************************** 32 | 33 | class SpectrumPicture : public BasicPicture 34 | { 35 | // ************************************************************************** 36 | // Public data. 37 | // ************************************************************************** 38 | 39 | public: 40 | static const double REFERENCE_SPECTRUM_PRESSURE; 41 | static const double LOWEST_SPECTRUM_PRESSURE; 42 | static const double HIGHEST_SPECTRUM_PRESSURE; 43 | 44 | static const double REFERENCE_SPECTRUM_IMPEDANCE; 45 | static const double LOWEST_SPECTRUM_IMPEDANCE; 46 | static const double HIGHEST_SPECTRUM_IMPEDANCE; 47 | 48 | static const double REFERENCE_SPECTRUM_VOLUMEVELOCITY; 49 | static const double LOWEST_SPECTRUM_VOLUMEVELOCITY; 50 | static const double HIGHEST_SPECTRUM_VOLUMEVELOCITY; 51 | 52 | static const double REFERENCE_SPECTRUM_RATIO; 53 | static const double LOWEST_SPECTRUM_RATIO; 54 | static const double HIGHEST_SPECTRUM_RATIO; 55 | 56 | static const int MIN_SPECTRUM_LEVEL_SHIFT = -50; 57 | static const int MAX_SPECTRUM_LEVEL_SHIFT = -MIN_SPECTRUM_LEVEL_SHIFT; 58 | 59 | // Enumerations 60 | 61 | enum ModelSpectrumType 62 | { 63 | SPECTRUM_UU, 64 | SPECTRUM_PU, 65 | SPECTRUM_NOSE_UU, 66 | SPECTRUM_INPUT_IMPEDANCE, 67 | SPECTRUM_SUBGLOTTAL_INPUT_IMPEDANCE, 68 | SPECTRUM_VOLUME_VELOCITY_IMPEDANCE, 69 | SPECTRUM_SOUND_PRESSURE_VOICE_SOURCE, 70 | SPECTRUM_SOUND_PRESSURE_NOISE_SOURCE, 71 | SPECTRUM_SOUND_PRESSURE_PZ, 72 | SPECTRUM_VOLUME_VELOCITY, 73 | NUM_SPECTRUM_TYPES 74 | }; 75 | 76 | enum UnitType 77 | { 78 | UNIT_NONE, 79 | UNIT_PRESSURE, 80 | UNIT_IMPEDANCE, 81 | UNIT_VOLUME_VELOCITY 82 | }; 83 | 84 | // Variables 85 | Graph graph; 86 | 87 | bool showModelSpectrum; 88 | bool showUserSpectrum; 89 | bool showTdsSpectrum; 90 | bool showVttfHarmonics; 91 | bool showPoleZeroSpectrum; 92 | bool showFormants; 93 | bool showMagnitude; 94 | bool showPhase; 95 | 96 | ModelSpectrumType modelSpectrumType; 97 | 98 | double levelShift; // Level shift of the secondary spectrum 99 | double noiseFilterCutoffFrequency; // Simulated first-order low-pass for noise source 100 | 101 | // ************************************************************************** 102 | // Public functions. 103 | // ************************************************************************** 104 | 105 | public: 106 | SpectrumPicture(wxWindow *parent, VocalTractPicture *picVocalTract); 107 | virtual void draw(wxDC &dc); 108 | void paintContinualSpectrum(wxDC &dc, ComplexSignal *spectrum, double ampFactor, wxColor color); 109 | void paintDiscreteSpectrum(wxDC &dc, ComplexSignal *spectrum, double ampFactor, wxColor color); 110 | 111 | // ************************************************************************** 112 | // Private data. 113 | // ************************************************************************** 114 | 115 | private: 116 | wxString spectrumFileName; 117 | VocalTractPicture *picVocalTract; 118 | int lineWidth{ this->FromDIP(1) }; 119 | 120 | // ************************************************************************** 121 | // Private functions. 122 | // ************************************************************************** 123 | 124 | private: 125 | void OnLeftButtonDown(wxMouseEvent &event); 126 | void OnRightButtonDown(wxMouseEvent &event); 127 | 128 | // ************************************************************************** 129 | // Declare the event table. 130 | // ************************************************************************** 131 | 132 | DECLARE_EVENT_TABLE() 133 | }; 134 | 135 | #endif 136 | 137 | // **************************************************************************** 138 | -------------------------------------------------------------------------------- /src/TdsPage.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef _TDS_PAGE_H_ 23 | #define _TDS_PAGE_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "TdsTimeSignalPicture.h" 31 | #include "TdsSpatialSignalPicture.h" 32 | #include "TdsTubePicture.h" 33 | #include "Data.h" 34 | #include "SynthesisThread.h" 35 | 36 | #include "LfPulseDialog.h" 37 | #include "TdsOptionsDialog.h" 38 | #include "GlottisDialog.h" 39 | 40 | 41 | // **************************************************************************** 42 | // **************************************************************************** 43 | 44 | class TdsPage : wxPanel 45 | { 46 | // **************************************************************** 47 | // Public data. 48 | // **************************************************************** 49 | 50 | public: 51 | Data *data; 52 | 53 | // **************************************************************** 54 | // Public functions. 55 | // **************************************************************** 56 | 57 | public: 58 | TdsPage(wxWindow *parent); 59 | void updateWidgets(); 60 | 61 | // **************************************************************** 62 | // Private data. 63 | // **************************************************************** 64 | 65 | private: 66 | TdsTimeSignalPicture *tdsTimeSignalPicture; 67 | TdsSpatialSignalPicture *tdsSpatialSignalPicture; 68 | TdsTubePicture *tdsTubePicture; 69 | 70 | wxRadioBox *radSignal; 71 | wxCheckBox *chkShowMainPath; 72 | wxCheckBox *chkShowSidePaths; 73 | 74 | wxStaticText *labSynthesisPos; 75 | wxSpinCtrl *ctrlSynthesisSpeed; 76 | wxCheckBox *chkShowAnimation; 77 | wxButton *btnStartSynthesis; 78 | wxRadioBox *radSynthesisType; 79 | wxCheckBox *chkConstantF0; 80 | 81 | wxCheckBox *chkShowAreaFunctionArticulators; 82 | 83 | wxScrollBar *scrTime; 84 | wxStaticText *labTime; 85 | 86 | wxGenericProgressDialog *progressDialog; 87 | SynthesisThread *synthesisThread; 88 | 89 | // **************************************************************** 90 | // Private functions. 91 | // **************************************************************** 92 | 93 | private: 94 | void initVars(); 95 | void initWidgets(); 96 | 97 | void OnUpdateRequest(wxCommandEvent &event); 98 | 99 | // Event from the synthesis thread 100 | void OnSynthesisThreadEvent(wxCommandEvent& event); 101 | 102 | // Left side panel controls 103 | void OnResetSynthesis(wxCommandEvent &event); 104 | void OnStartSynthesis(wxCommandEvent &event); 105 | void OnSynthesisSpeedChanged(wxSpinEvent &event); 106 | void OnShowAnimation(wxCommandEvent &event); 107 | void OnSelectSynthesisType(wxCommandEvent &event); 108 | void OnConstantF0(wxCommandEvent &event); 109 | void OnSetAreaFunction(wxCommandEvent &event); 110 | void OnSetUniformTube(wxCommandEvent &event); 111 | void OnGlottisDialog(wxCommandEvent &event); 112 | void OnLfWaveform(wxCommandEvent &event); 113 | void OnTdsAcoustics(wxCommandEvent &event); 114 | void OnTriangularGlottisF0Params(wxCommandEvent &event); 115 | void OnShowAreaFunctionArticulators(wxCommandEvent &event); 116 | 117 | // Right main panel controls 118 | void OnSelectSignal(wxCommandEvent &event); 119 | void OnShowMainPath(wxCommandEvent &event); 120 | void OnShowSidePaths(wxCommandEvent &event); 121 | void OnSignalUpperLimitPlus(wxCommandEvent &event); 122 | void OnSignalUpperLimitMinus(wxCommandEvent &event); 123 | void OnSignalLowerLimitPlus(wxCommandEvent &event); 124 | void OnSignalLowerLimitMinus(wxCommandEvent &event); 125 | void OnAreaUpperLimitPlus(wxCommandEvent &event); 126 | void OnAreaUpperLimitMinus(wxCommandEvent &event); 127 | void OnAreaLowerLimitPlus(wxCommandEvent &event); 128 | void OnAreaLowerLimitMinus(wxCommandEvent &event); 129 | 130 | void OnTimeScrollbarChanged(wxScrollEvent &event); 131 | 132 | // **************************************************************************** 133 | // Declare the event table right at the end 134 | // **************************************************************************** 135 | 136 | DECLARE_EVENT_TABLE() 137 | }; 138 | 139 | #endif 140 | -------------------------------------------------------------------------------- /resources/examples/example05.ges: -------------------------------------------------------------------------------- 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 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/AnalysisSettingsDialog.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __ANALYSIS_SETTINGS_DIALOG_H__ 23 | #define __ANALYSIS_SETTINGS_DIALOG_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "Data.h" 30 | #include "SpectrogramPlot.h" 31 | #include "VocalTractLabBackend/F0EstimatorYin.h" 32 | #include "VocalTractLabBackend/VoiceQualityEstimator.h" 33 | 34 | 35 | // **************************************************************************** 36 | /// This dialog lets the user adjust the parameters for the different 37 | /// analysis algorithms, e.g., for F0, formants, spectrogram. 38 | // **************************************************************************** 39 | 40 | class AnalysisSettingsDialog : public wxDialog 41 | { 42 | // ************************************************************************** 43 | // Public functions. 44 | // ************************************************************************** 45 | 46 | public: 47 | AnalysisSettingsDialog(wxWindow *parent, wxWindow *updateEventReceiver, SpectrogramPlot *plot); 48 | 49 | // ************************************************************************** 50 | // Private data. 51 | // ************************************************************************** 52 | 53 | private: 54 | 55 | Data *data; 56 | SpectrogramPlot *spectrogramPlot; 57 | wxWindow *updateEventReceiver; 58 | 59 | // The notebook widget and its pages 60 | 61 | wxNotebook *notebook; 62 | wxPanel *spectrumPage; 63 | wxPanel *spectrogramPage; 64 | wxPanel *f0Page; 65 | wxPanel *voiceQualityPage; 66 | 67 | // The spectrum page controls 68 | 69 | wxScrollBar *scrSpectrumWindowLength; 70 | wxStaticText *labSpectrumWindowLength; 71 | wxRadioBox *radSpectrumType; 72 | wxTextCtrl *txtAverageSpectrumTimeStep; 73 | 74 | // The spectrogram page controls 75 | 76 | wxScrollBar *scrSpectrogramWindowLength; 77 | wxStaticText *labSpectrogramWindowLength; 78 | wxScrollBar *scrDynamicRange; 79 | wxStaticText *labDynamicRange; 80 | wxScrollBar *scrViewRange; 81 | wxStaticText *labViewRange; 82 | wxScrollBar *scrFftLength; 83 | wxStaticText *labFftLength; 84 | 85 | // The F0 page controls 86 | 87 | wxCheckBox *chkShowF0; 88 | wxTextCtrl *txtF0Threshold; 89 | wxTextCtrl *txtF0TimeStep; 90 | 91 | // The voice quality page controls 92 | 93 | wxCheckBox *chkShowVoiceQuality; 94 | 95 | 96 | // ************************************************************************** 97 | // Private functions. 98 | // ************************************************************************** 99 | 100 | private: 101 | void initWidgets(); 102 | wxPanel *initSpectrumPage(wxWindow *parent); 103 | wxPanel *initSpectrogramPage(wxWindow *parent); 104 | wxPanel *initF0Page(wxWindow *parent); 105 | wxPanel *initVoiceQualityPage(wxWindow *parent); 106 | 107 | void updateWidgets(); 108 | void updateSpectrumPage(); 109 | void updateSpectrogramPage(); 110 | void updateF0Page(); 111 | void updateVoiceQualityPage(); 112 | 113 | // Event handler for notebook page changed 114 | 115 | void OnePageChanged(wxNotebookEvent &event); 116 | 117 | // Event handler for spectrum settings 118 | 119 | void OnSpectrumWindowLengthChanged(wxScrollEvent &event); 120 | void OnSpectrumTypeChanged(wxCommandEvent &event); 121 | void OnCalcAverageSpectrum(wxCommandEvent &event); 122 | void OnSpectrumTimeStepLostFocus(wxFocusEvent &event); 123 | 124 | // Event handler for spectrogram settings 125 | 126 | void OnSpectrogramWindowLengthChanged(wxScrollEvent &event); 127 | void OnDynamicRangeChanged(wxScrollEvent &event); 128 | void OnViewRangeChanged(wxScrollEvent &event); 129 | void OnFftLengthChanged(wxScrollEvent &event); 130 | void OnSetSpectrogramDefaults(wxCommandEvent &event); 131 | 132 | // Event handler for F0 settings 133 | 134 | void OnShowF0(wxCommandEvent &event); 135 | void OnThresholdLostFocus(wxFocusEvent &event); 136 | void OnF0TimeStepLostFocus(wxFocusEvent &event); 137 | void OnCalcF0(wxCommandEvent &event); 138 | 139 | // Event handler for voice quality settings 140 | 141 | void OnShowVoiceQuality(wxCommandEvent &event); 142 | void OnCalcVoiceQuality(wxCommandEvent &event); 143 | 144 | // ************************************************************************** 145 | // Declare the event table. 146 | // ************************************************************************** 147 | 148 | DECLARE_EVENT_TABLE() 149 | }; 150 | 151 | 152 | #endif 153 | -------------------------------------------------------------------------------- /src/SignalComparisonPicture.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef __SIGNAL_COMPARISON_PICTURE_H__ 23 | #define __SIGNAL_COMPARISON_PICTURE_H__ 24 | 25 | #include "BasicPicture.h" 26 | #include "SpectrogramPlot.h" 27 | #include "Graph.h" 28 | #include "Data.h" 29 | 30 | 31 | // **************************************************************************** 32 | // **************************************************************************** 33 | 34 | class SignalComparisonPicture : public BasicPicture 35 | { 36 | // ************************************************************************** 37 | // Public data. 38 | // ************************************************************************** 39 | 40 | public: 41 | bool showExtraTrack; 42 | bool showSonagrams; 43 | bool showSegmentation; 44 | bool showModelF0Curve; 45 | SpectrogramPlot *spectrogramPlot; 46 | 47 | // ************************************************************************** 48 | // Public functions. 49 | // ************************************************************************** 50 | 51 | public: 52 | SignalComparisonPicture(wxWindow *parent, wxWindow *updateParent); 53 | virtual void draw(wxDC &dc); 54 | 55 | int getVirtualHeight(); 56 | int getWindowHeight(); 57 | void setVertOffset(double offset_percent); 58 | double getVertOffset_percent(); 59 | 60 | // ************************************************************************** 61 | // Private data. 62 | // ************************************************************************** 63 | 64 | private: 65 | static const int PLAY_BUTTON_WIDTH = 20; 66 | static const int PLAY_BUTTON_HEIGHT = 20; 67 | static const int NUM_PLAY_BUTTONS = 2; 68 | 69 | enum Rows 70 | { 71 | SEGMENTATION_ROW_1, 72 | SEGMENTATION_ROW_2, 73 | OSCILLOGRAM_ROW_1, 74 | SPECTROGRAM_ROW_1, 75 | OSCILLOGRAM_ROW_2, 76 | SPECTROGRAM_ROW_2, 77 | NUM_ROWS 78 | }; 79 | 80 | Data *data; 81 | wxWindow *updateParent; 82 | int rowY[NUM_ROWS]; 83 | int rowH[NUM_ROWS]; 84 | double verticalOffset_percent; 85 | int playButtonX[NUM_PLAY_BUTTONS]; 86 | int playButtonY[NUM_PLAY_BUTTONS]; 87 | wxMenu *contextMenu; 88 | wxMenu *contextMenuSpectrogram; 89 | 90 | int menuX, menuY; 91 | int lastMx, lastMy; 92 | bool moveBorder; 93 | int lineWidth{ this->FromDIP(1) }; 94 | 95 | // ************************************************************************** 96 | // Private functions. 97 | // ************************************************************************** 98 | 99 | private: 100 | void paintSignals(wxDC &dc); 101 | void paintOscillogram(wxDC &dc, int areaX, int areaY, int areaWidth, int areaHeight, 102 | Signal16 *s, int firstSample, int numSamples); 103 | void paintPhoneSegmentation(wxDC &dc, int areaX, int areaY, int areaWidth, int areaHeight, 104 | double areaStartTime_s, double areaDuration_s); 105 | void paintWordSegmentation(wxDC &dc, int areaX, int areaY, int areaWidth, int areaHeight, 106 | double areaStartTime_s, double areaDuration_s); 107 | void paintPlayButton(wxDC &dc, int x, int y); 108 | void drawSelectionMark(wxDC &dc, int x, int y1, int y2, bool isLeftMark); 109 | 110 | void calcRowCoord(); 111 | void updatePage(); 112 | void updateAnnotationDialog(); 113 | void getUnderlyingSegment(int mx, int my, int &segmentIndex, bool &isOnBorder); 114 | 115 | void OnMouseEvent(wxMouseEvent &event); 116 | 117 | void OnPlaySegmentMainTrack(wxCommandEvent& event); 118 | void OnPlaySegmentExtraTrack(wxCommandEvent& event); 119 | void OnInsertSegment(wxCommandEvent &event); 120 | void OnDeleteSegment(wxCommandEvent &event); 121 | void OnClearSegmentSelection(wxCommandEvent &event); 122 | void OnSetMinSegmentDuration(wxCommandEvent& event); 123 | 124 | void OnSetReferenceMark(wxCommandEvent &event); 125 | void OnClearReferenceMark(wxCommandEvent &event); 126 | void OnSwapTracks(wxCommandEvent &event); 127 | 128 | void OnClearSelection(wxCommandEvent &event); 129 | void OnSetSelectionStart(wxCommandEvent &event); 130 | void OnSetSelectionEnd(wxCommandEvent &event); 131 | void OnSelectAll(wxCommandEvent &event); 132 | 133 | void OnSpectrogramRange4kHz(wxCommandEvent &event); 134 | void OnSpectrogramRange8kHz(wxCommandEvent &event); 135 | void OnSpectrogramRange12kHz(wxCommandEvent &event); 136 | 137 | // **************************************************************************** 138 | // Declare the event table right at the end 139 | // **************************************************************************** 140 | 141 | DECLARE_EVENT_TABLE() 142 | }; 143 | 144 | #endif 145 | 146 | // **************************************************************************** 147 | -------------------------------------------------------------------------------- /src/GesturalScorePage.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef _GESTURAL_SCORE_PAGE_H_ 23 | #define _GESTURAL_SCORE_PAGE_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "SignalComparisonPicture.h" 32 | #include "GesturalScorePicture.h" 33 | #include "TimeAxisPicture.h" 34 | #include "AnalysisSettingsDialog.h" 35 | #include "GlottisDialog.h" 36 | #include "VocalTractDialog.h" 37 | #include "TdsOptionsDialog.h" 38 | #include "Data.h" 39 | #include "SynthesisThread.h" 40 | 41 | 42 | // **************************************************************************** 43 | // **************************************************************************** 44 | 45 | class GesturalScorePage : public wxPanel 46 | { 47 | // **************************************************************** 48 | // Public data. 49 | // **************************************************************** 50 | 51 | public: 52 | 53 | 54 | // **************************************************************** 55 | // Public functions. 56 | // **************************************************************** 57 | 58 | public: 59 | GesturalScorePage(wxWindow *parent); 60 | void initWidgets(); 61 | void updateWidgets(); 62 | void scrollLeft(); 63 | void scrollRight(); 64 | void selectNextLeftSegment(); 65 | void selectNextRightSegment(); 66 | void togglePicture(); 67 | void lengthenGesturalScore(); 68 | void shortenGesturalScore(); 69 | 70 | // **************************************************************** 71 | // Private data. 72 | // **************************************************************** 73 | 74 | private: 75 | Data *data; 76 | 77 | wxGenericProgressDialog *progressDialog; 78 | SynthesisThread *synthesisThread; 79 | 80 | wxSplitterWindow *splitter; 81 | wxScrollBar *horzScrollBar; 82 | wxScrollBar *scrLowerOffset; 83 | wxScrollBar *scrUpperOffset; 84 | 85 | // Gesture box controls. 86 | wxStaticBox *gestureBox; 87 | wxCheckBox *chkNeutralGesture; 88 | wxStaticText *labValue; 89 | wxComboBox *lstNominalValue; 90 | wxTextCtrl *txtContinualValue; 91 | wxStaticText *labSlope; 92 | wxScrollBar *scrSlope; 93 | wxStaticText *labStartTime; 94 | wxSpinCtrl *txtDuration; 95 | wxStaticText *labTimeConstant; 96 | wxScrollBar *scrTimeConstant; 97 | 98 | // Ungrouped controls 99 | wxStaticText *labMark; 100 | wxRadioBox *radDisplayChoices; 101 | 102 | // Audio signal display options 103 | wxCheckBox *chkShowExtraTrack; 104 | wxCheckBox *chkShowSonagram; 105 | wxCheckBox *chkShowSegmentation; 106 | wxCheckBox *chkShowModelF0Curve; 107 | 108 | wxCheckBox *chkShowAnimation; 109 | wxCheckBox* chkNormalizeAmplitude; 110 | 111 | GesturalScorePicture *gesturalScorePicture; 112 | SignalComparisonPicture *signalComparisonPicture; 113 | TimeAxisPicture *timeAxisPicture; 114 | 115 | // **************************************************************** 116 | // Private functions. 117 | // **************************************************************** 118 | 119 | private: 120 | void fillGestureValueList(bool forced = false); 121 | 122 | void OnUpdateRequest(wxCommandEvent &event); 123 | 124 | void OnHorzScrollBar(wxScrollEvent &event); 125 | void OnLowerOffsetScrollBar(wxScrollEvent &event); 126 | void OnUpperOffsetScrollBar(wxScrollEvent &event); 127 | void OnSplitterPosChanged(wxSplitterEvent &event); 128 | 129 | void OnNominalValueSelected(wxCommandEvent &event); 130 | void OnNominalValueEntered(wxCommandEvent &event); 131 | void OnNeutralGesture(wxCommandEvent &event); 132 | void OnContinualValueChanged(wxFocusEvent &event); 133 | void OnContinualValueEntered(wxCommandEvent &event); 134 | void OnDurationChanged(wxSpinEvent &event); 135 | void OnDurationEntered(wxCommandEvent &event); 136 | void OnTimeConstantChanged(wxScrollEvent &event); 137 | void OnSlopeChanged(wxScrollEvent &event); 138 | 139 | void OnTimeZoomMinus(wxCommandEvent &event); 140 | void OnTimeZoomPlus(wxCommandEvent &event); 141 | void OnDisplayChoice(wxCommandEvent &event); 142 | 143 | void OnShowMainTrack(wxCommandEvent &event); 144 | void OnShowExtraTrack(wxCommandEvent &event); 145 | void OnShowSonagram(wxCommandEvent &event); 146 | void OnShowSegmentation(wxCommandEvent &event); 147 | void OnShowModelF0Curve(wxCommandEvent &event); 148 | 149 | void OnShowAnimation(wxCommandEvent &event); 150 | void OnNormalizeAmplitude(wxCommandEvent& event); 151 | void OnSynthesize(wxCommandEvent &event); 152 | 153 | // Events from the synthesis thread 154 | void OnSynthesisThreadEvent(wxCommandEvent& event); 155 | 156 | void OnAcoustics(wxCommandEvent &event); 157 | void OnShowVocalTract(wxCommandEvent &event); 158 | void OnShowGlottis(wxCommandEvent &event); 159 | void OnAnalysisSettings(wxCommandEvent &event); 160 | void OnCalcF0(wxCommandEvent &event); 161 | void OnCalcVoiceQuality(wxCommandEvent &event); 162 | void OnAnalysisResults(wxCommandEvent &event); 163 | void OnAnnotationDialog(wxCommandEvent &event); 164 | 165 | void OnResize(wxSizeEvent& event); 166 | 167 | // **************************************************************************** 168 | // Declare the event table right at the end 169 | // **************************************************************************** 170 | 171 | DECLARE_EVENT_TABLE() 172 | }; 173 | 174 | #endif 175 | -------------------------------------------------------------------------------- /src/ColorScale.cpp: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include "ColorScale.h" 23 | #include 24 | #include 25 | 26 | // **************************************************************************** 27 | /// RGB, each 0.0 to 1.0, to HSV. 28 | /// H = 0.0 to 360.0 (corresponding to 0..360.0 degrees around hexcone) 29 | /// S = 0.0 (shade of gray) to 1.0 (pure color) 30 | /// V = 0.0 (black) to 1.0 {white) 31 | // **************************************************************************** 32 | 33 | void ColorScale::rgbToHsv(const double r, const double g, const double b, double &h, double &s, double &v) 34 | { 35 | double max = maximum(r, g, b); 36 | double min = minimum(r, g, b); 37 | 38 | v = max; // This is the value (brightness) 39 | 40 | // Next, calculate saturation 41 | s = (max != 0.0) ? ((max-min)/max) : 0.0; 42 | 43 | // Finally, determine hue 44 | 45 | if (s == 0.0) 46 | { 47 | h = 0.0; // actually undefined 48 | } 49 | else 50 | { 51 | double delta = max - min; 52 | if (r == max) 53 | { 54 | h = (g - b) / delta; // between yellow and magenta [degrees] 55 | } 56 | else 57 | if (g == max) 58 | { 59 | h = 2.0 + (b - r) / delta; // between cyan and yellow 60 | } 61 | else 62 | if (b == max) 63 | { 64 | h = 4.0 + (r - g) / delta; // between magenta and cyan 65 | } 66 | 67 | h*= 60.0; // Convert to degrees 68 | if (h < 0.0) 69 | { 70 | h+= 360.0; 71 | } 72 | } 73 | } 74 | 75 | 76 | // **************************************************************************** 77 | /// H = 0.0 to 360.0 (corresponding to 0..360 degrees around hexcone) 78 | /// NaN (undefined) for S = 0 79 | /// S = 0.0 (shade of gray) to 1.0 (pure color) 80 | /// V = 0.0 (black) to 1.0 (white) 81 | /// The RGB values are in [0,1]. 82 | // **************************************************************************** 83 | 84 | void ColorScale::hsvToRgb(const double h, const double s, const double v, double &r, double &g, double &b) 85 | { 86 | // The color is on the black-white centerline 87 | if (s == 0.0) 88 | { 89 | r = v; 90 | g = v; 91 | b = v; 92 | } 93 | else 94 | { 95 | double f, p, q, t; 96 | int i; 97 | 98 | double newH = h; 99 | if (newH == 360.0) 100 | { 101 | newH = 0.0; 102 | } 103 | newH/= 60.0; // h is now in [0,6) 104 | i = (int)floor(newH); 105 | f = newH - i; 106 | p = v*(1.0 - s); 107 | q = v*(1.0 - s*f); 108 | t = v*(1.0 - (s*(1.0 - f))); 109 | 110 | switch (i) 111 | { 112 | case 0: r = v; g = t; b = p; break; 113 | case 1: r = q; g = v; b = p; break; 114 | case 2: r = p; g = v; b = t; break; 115 | case 3: r = p; g = q; b = v; break; 116 | case 4: r = t; g = p; b = v; break; 117 | case 5: r = v; g = p; b = q; break; 118 | } 119 | } 120 | } 121 | 122 | // **************************************************************************** 123 | /// Fills the given array with the colors of a quantitative, perceptually- 124 | /// based color scale between blue and yellow. 125 | // **************************************************************************** 126 | 127 | void ColorScale::getYellowBlueScale(int numColors, wxColor scale[]) 128 | { 129 | int half = numColors / 2; 130 | int i; 131 | double h, s, v; // Hue, saturation, value (brightness) 132 | double r, g, b; 133 | 134 | v = 0.9; // Keep brightness constant 135 | 136 | h = 240.0; // 240 degrees = blue 137 | for (i=0; i < half; i++) 138 | { 139 | s = 1.0 - (double)i / (double)(half-1); 140 | hsvToRgb(h, s, v, r, g, b); 141 | scale[i] = wxColor((int)(r*255.0), (int)(g*255.0), (int)(b*255.0)); 142 | } 143 | 144 | h = 60.0; // 60 degrees = yellow 145 | for (i=half; i < numColors; i++) 146 | { 147 | s = (double)(i-half) / (double)(numColors-half-1); 148 | hsvToRgb(h, s, v, r, g, b); 149 | scale[i] = wxColor((int)(r*255.0), (int)(g*255.0), (int)(b*255.0)); 150 | } 151 | } 152 | 153 | // **************************************************************************** 154 | /// Unit tests. 155 | // **************************************************************************** 156 | 157 | void ColorScale::test() 158 | { 159 | double r, g, b; 160 | 161 | r = 0.2; 162 | g = 0.5; 163 | b = 0.7; 164 | 165 | double h, s, v; 166 | rgbToHsv(r, g, b, h, s, v); 167 | 168 | double r2, g2, b2; 169 | hsvToRgb(h, s, v, r2, g2, b2); 170 | 171 | wxPrintf("=== Color model conversion test ===\n"); 172 | wxPrintf("before: r=%f g=%f b=%f\n", r, g, b); 173 | wxPrintf("after : r=%f g=%f b=%f\n", r2, g2, b2); 174 | } 175 | 176 | // **************************************************************************** 177 | /// Returns the maximum of a, b, and c. 178 | // **************************************************************************** 179 | 180 | double ColorScale::maximum(double a, double b, double c) 181 | { 182 | double v = a; 183 | if (b > v) { v = b; } 184 | if (c > v) { v = c; } 185 | return v; 186 | } 187 | 188 | // **************************************************************************** 189 | /// Returns the minimum of a, b, and c. 190 | // **************************************************************************** 191 | 192 | double ColorScale::minimum(double a, double b, double c) 193 | { 194 | double v = a; 195 | if (b < v) { v = b; } 196 | if (c < v) { v = c; } 197 | return v; 198 | } 199 | 200 | // **************************************************************************** 201 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![CMake Linux](https://github.com/TUD-STKS/VocalTractLab-dev/actions/workflows/cmake_linux.yml/badge.svg) ![CMake Windows](https://github.com/TUD-STKS/VocalTractLab-dev/actions/workflows/cmake_windows.yml/badge.svg) ![CMake OSX](https://github.com/TUD-STKS/VocalTractLab-dev/actions/workflows/cmake_osx.yml/badge.svg) ![MSBuild](https://github.com/TUD-STKS/VocalTractLab-dev/actions/workflows/msbuild.yml/badge.svg) 2 | 3 | # VocalTractLab-dev 4 | 5 | This is the VocalTractLab repository for on-going development work. *This is not the place for official stable releases!* 6 | 7 | You can find the bleeding edge builds here including new and experimental features, some of which may break your old projects. For official stable releases, please check [the VocalTractLab website](https://www.vocaltractlab.de). 8 | 9 | Please feel free to fork this repo and make your own contributions, though! 10 | 11 | The main branch of this repo is reviewed on a semi-regular basis for inclusion into the official release. 12 | 13 | ## Clone the repository 14 | This repository includes the VocalTractLabBackend library as a submodule. You therefore need to clone it slightly differently than what you may be used to: 15 | 16 | ``` 17 | git clone --recurse-submodules https://github.com/TUD-STKS/VocalTractLab-dev.git 18 | ``` 19 | 20 | ## Build instructions 21 | VocalTractLab depends on the following additional libraries: 22 | 23 | - VocalTractLabBackend 24 | - wxWidgets 3.1.3 25 | - OpenGL 26 | - OpenAL (on Windows or Linux) or WinMM (on Windows) 27 | 28 | The VocalTractLabBackend library is included as a submodule in this repo and built as part of the frontend build workflow. 29 | 30 | ### Install dependencies on Linux (tested on Ubuntu) 31 | You can install the dependencies and build VocalTractLab by simply running the script `build/linux/build.sh`. If for whatever reason you want to walk through the steps manually, here is what you need to do. 32 | 33 | First we need to install OpenGL and OpenAL: 34 | 35 | ```bash 36 | sudo apt-get update 37 | sudo apt-get install libgtk-3-dev libopenal-dev mesa-utils freeglut3-dev 38 | ``` 39 | 40 | Now you should be ready to install wxWidgets. Unfortunately, the current wxWidgets binaries in the APT repositories are still version 3.0. So we need to download and build wxWidgets from source like so: 41 | 42 | ```bash 43 | wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2 44 | tar -xf wxWidgets-3.1.3.tar.bz2 45 | cd wxWidgets-3.1.3 46 | mkdir buildgtk 47 | cd buildgtk 48 | ../configure --with-gtk --with-opengl 49 | make 50 | sudo make install 51 | sudo ldconfig 52 | ``` 53 | 54 | That should be it. 55 | 56 | ### Install dependencies on Mac OS X 57 | First of all, you need to have Xcode installed (including the CLI toolkit). An Apple Developer account is mandatory as well as administrative rights on the system you want to run VocalTractLab on. Next, make sure you have git installed. Mac OS X already comes with git installed normally. If you do not have git installed for whatever reason, please do so. In addition, make sure CMake is installed and added to your PATH. Last thing to check is wheter curl is installed on your system. If not, please do so. 58 | You now should be able to install the dependencies and build VocalTractLab by simply running the script `build/osx/build.sh`. If for whatever reason you want to walk through the steps manually, here is what you need to do. 59 | 60 | Mac OS X already ships with OpenGL and OpenAL built-in. You just need to build and install wxWidgets: 61 | 62 | ```bash 63 | curl https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2 -O -L 64 | tar -xf wxWidgets-3.1.3.tar.bz2 65 | cd wxWidgets-3.1.3 66 | mkdir buildosx 67 | cd buildosx 68 | ../configure --with-opengl 69 | make 70 | sudo make install 71 | ``` 72 | 73 | ### Install dependencies on Windows 74 | You can install the dependencies and build VocalTractLab by simply running the script `build/msw/build.ps1`. If for whatever reason you want to walk through the steps manually, here is what you need to do. 75 | On Windows, OpenGL and WinMM are part of the Windows SDK and should already be available on your system. All that is left to do is build wxWidgets. Bring up a Powershell and run the following commands: 76 | 77 | ```pwsh 78 | Invoke-WebRequest https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.zip -outfile wxWidgets-3.1.3.zip 79 | Expand-Archive wxWidgets-3.1.3.zip 80 | ``` 81 | 82 | Now open the solution `wx_vc16.sln` in the folder `wxWidgets-3.1.3\build\msw` using Visual Studio 2019 or above and build all projects. 83 | Once all libraries are built, copy them to the location where the VocalTractLab build files expect them. Bring up a Powershell again and run (from the parent directory of wxWidgets-3.1.3): 84 | 85 | ```pwsh 86 | xcopy wxWidgets-3.1.3\* C:\wxwidgets-3.1.3\ /s /h /e 87 | ``` 88 | 89 | ### Build VocalTractLab using CMake (Linux, Mac OS X, Windows) 90 | You can build VocalTractLab on Linux and Windows using CMake like so (starting from the repository root folder): 91 | 92 | ```bash 93 | mkdir tmp 94 | cd tmp 95 | cmake .. -DCMAKE_BUILD_TYPE=Release 96 | cmake --build . --target VocalTractLab --config Release 97 | ``` 98 | 99 | ### Build VocalTractLab using Visual Studio (Windows) 100 | Alternatively to CMake (see above), you can build VocalTractLab on Windows using the provided Visual Studio solution `VocalTractLab2.sln` in the directory `build/msw`. Simply open it with Visual Studio 2019 or above and build all projects. 101 | 102 | ## Running VocalTractLab 103 | After building the program, the executable file can be found in `bin/Release/`. Before running it, you may want to copy the speaker file `JD3.speaker` from the folder `resources/` to the same folder as the executable. Otherwise you will have to load it at runtime. 104 | 105 | ## Getting started 106 | Check out the official [manual](https://www.vocaltractlab.de/download-vocaltractlab/VTL2.3-manual.pdf) for detailed instructions and examples. Note that the manual is only updated with official releases, so not everything may still apply to the most recent dev release from this repository. 107 | 108 | You can also find some example gestural scores and segment sequence files in the folder `examples/`. 109 | 110 | Please be aware of the fact that VTL does not support theming currently. So if the layout/designs seems to be off for you, please check if you are using the default (light) theme of your system. 111 | 112 | ## Troubleshooting 113 | If you run into any problems in the build process, make sure all the dependencies are correctly installed. If you still run into any trouble, feel free to open an issue. 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/VocalTractPage.h: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #ifndef _VOCALTRACT_PAGE_H_ 23 | #define _VOCALTRACT_PAGE_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "VocalTractPicture.h" 31 | #include "AreaFunctionPicture.h" 32 | #include "CrossSectionPicture.h" 33 | #include "SpectrumPicture.h" 34 | #include "Data.h" 35 | 36 | #include "LfPulseDialog.h" 37 | #include "FdsOptionsDialog.h" 38 | #include "VocalTractShapesDialog.h" 39 | #include "PhoneticParamsDialog.h" 40 | #include "PoleZeroDialog.h" 41 | 42 | 43 | // **************************************************************************** 44 | // **************************************************************************** 45 | 46 | class VocalTractPage : public wxPanel 47 | { 48 | // **************************************************************** 49 | // Public functions. 50 | // **************************************************************** 51 | 52 | public: 53 | VocalTractPage(wxWindow *parent, VocalTractPicture *picVocalTract); 54 | void updateWidgets(); 55 | 56 | // **************************************************************** 57 | // Private data. 58 | // **************************************************************** 59 | 60 | private: 61 | Data *data; 62 | static const int NUM_TONGUE_SIDE_POINTS = 4; 63 | static const int NUM_MIN_AREAS = 3; 64 | 65 | wxSplitterWindow *splitter; 66 | 67 | AreaFunctionPicture *picAreaFunction; 68 | CrossSectionPicture *picCrossSection; 69 | SpectrumPicture *picSpectrum; 70 | 71 | // Left side control 72 | 73 | wxCheckBox *chkShowControlPoints; 74 | wxCheckBox *chkShowCenterLine; 75 | wxRadioButton *radRoughCenterLine; 76 | wxRadioButton *radSmoothCenterLine; 77 | wxCheckBox *chkShowCutVectors; 78 | 79 | wxStaticText *labBackgroundImageFileName; 80 | wxCheckBox *chkShowBackgroundImage; 81 | wxCheckBox *chkBackgroundImageEditMode; 82 | 83 | // Vocal tract variables controls 84 | 85 | wxScrollBar *scrTongueSide[NUM_TONGUE_SIDE_POINTS]; 86 | wxStaticText *labTongueSide[NUM_TONGUE_SIDE_POINTS]; 87 | 88 | wxScrollBar *scrMinArea[NUM_MIN_AREAS]; 89 | wxStaticText *labMinArea[NUM_MIN_AREAS]; 90 | 91 | wxRadioButton *radNoTract; 92 | wxRadioButton *rad2dTract; 93 | wxRadioButton *rad3dTract; 94 | wxRadioButton *radWireFrameTract; 95 | wxCheckBox *chkBothSides; 96 | 97 | wxCheckBox *chkDiscreteAreaFunction; 98 | wxCheckBox *chkAreaCircumference; 99 | wxCheckBox *chkShowBranches; 100 | wxCheckBox *chkShowAreaFunctionText; 101 | wxCheckBox *chkShowAreaFunctionArticulators; 102 | 103 | // Spectrum-related controls 104 | 105 | wxScrollBar *scrSpectrumOffset; 106 | 107 | wxCheckBox *chkShowModelSpectrum; 108 | wxCheckBox *chkShowUserSpectrum; 109 | wxCheckBox *chkShowTdsSpectrum; 110 | wxCheckBox *chkShowPoleZeroSpectrum; 111 | wxCheckBox *chkShowFormants; 112 | wxCheckBox *chkShowMagnitude; 113 | wxCheckBox *chkShowPhase; 114 | 115 | wxStaticText *labFrequencyRange; 116 | wxStaticText *labNoiseFilterCutoff; 117 | 118 | 119 | // **************************************************************** 120 | // Private functions. 121 | // **************************************************************** 122 | 123 | private: 124 | void initVars(); 125 | void initWidgets(VocalTractPicture *picVocalTract); 126 | 127 | void createSpecialVocalTractShapes(); 128 | 129 | void OnUpdateRequest(wxCommandEvent &event); 130 | 131 | // Event handers for controls at the left side 132 | 133 | void OnVocalTractDialog(wxCommandEvent &event); 134 | void OnShapesDialog(wxCommandEvent &event); 135 | void OnPhoneticParamsDialog(wxCommandEvent &event); 136 | void OnLfPulse(wxCommandEvent &event); 137 | void OnFdsAcoustics(wxCommandEvent &event); 138 | void OnImproveFormants(wxCommandEvent &event); 139 | void OnCheckVowelShape(wxCommandEvent &event); 140 | void OnGetFormantError(wxCommandEvent &event); 141 | 142 | void OnEditPoleZeroPlan(wxCommandEvent &event); 143 | void OnTest(wxCommandEvent &event); 144 | void OnMapShape(wxCommandEvent &event); 145 | void OnTransitionDialog(wxCommandEvent &event); 146 | 147 | void OnPlayShortVowelTds(wxCommandEvent& event); 148 | void OnPlayLongVowelTds(wxCommandEvent& event); 149 | void OnPlayFricativeTds(wxCommandEvent& event); 150 | 151 | void OnPlayShortVowelFds(wxCommandEvent &event); 152 | void OnPlayLongVowelFds(wxCommandEvent &event); 153 | 154 | // Event handers for controls at the spectrum side 155 | 156 | void OnFrequencyRangeMinus(wxCommandEvent &event); 157 | void OnFrequencyRangePlus(wxCommandEvent &event); 158 | void OnNoiseFilterCutoffMinus(wxCommandEvent &event); 159 | void OnNoiseFilterCutoffPlus(wxCommandEvent &event); 160 | void OnSynthesizeNoise(wxCommandEvent &event); 161 | void OnUpperSpectrumLimitPlus(wxCommandEvent &event); 162 | void OnUpperSpectrumLimitMinus(wxCommandEvent &event); 163 | void OnLowerSpectrumLimitPlus(wxCommandEvent &event); 164 | void OnLowerSpectrumLimitMinus(wxCommandEvent &event); 165 | 166 | void OnShowModelSpectrum(wxCommandEvent &event); 167 | void OnShowUserSpectrum(wxCommandEvent &event); 168 | void OnShowTdsSpectrum(wxCommandEvent &event); 169 | void OnShowPoleZeroSpectrum(wxCommandEvent &event); 170 | void OnShowFormants(wxCommandEvent &event); 171 | void OnShowMagnitude(wxCommandEvent &event); 172 | void OnShowPhase(wxCommandEvent &event); 173 | void OnSpectrumOffsetChanged(wxScrollEvent &event); 174 | 175 | // Event handers for controls in the main panel 176 | 177 | void OnShowDiscreteAreas(wxCommandEvent &event); 178 | void OnShowAreas(wxCommandEvent &event); 179 | void OnShowBranches(wxCommandEvent &event); 180 | void OnShowText(wxCommandEvent &event); 181 | void OnShowAreaFunctionArticulators(wxCommandEvent &event); 182 | 183 | // **************************************************************************** 184 | // Declare the event table right at the end 185 | // **************************************************************************** 186 | 187 | DECLARE_EVENT_TABLE() 188 | }; 189 | 190 | #endif 191 | -------------------------------------------------------------------------------- /src/SpectrumOptionsDialog.cpp: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // This file is part of VocalTractLab. 3 | // Copyright (C) 2020, Peter Birkholz, Dresden, Germany 4 | // www.vocaltractlab.de 5 | // author: Peter Birkholz 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | // 20 | // **************************************************************************** 21 | 22 | #include "SpectrumOptionsDialog.h" 23 | 24 | // IDs of the controls 25 | 26 | static const int IDR_SPECTRUM_TYPE = 5000; 27 | static const int IDC_SHOW_HARMONICS = 5001; 28 | 29 | // The single instance of this class. 30 | 31 | SpectrumOptionsDialog *SpectrumOptionsDialog::instance = NULL; 32 | SpectrumPicture *SpectrumOptionsDialog::spectrumPicture = NULL; 33 | 34 | // **************************************************************************** 35 | // The event table. 36 | // **************************************************************************** 37 | 38 | BEGIN_EVENT_TABLE(SpectrumOptionsDialog, wxDialog) 39 | EVT_RADIOBOX(IDR_SPECTRUM_TYPE, SpectrumOptionsDialog::OnSpectrumType) 40 | EVT_CHECKBOX(IDC_SHOW_HARMONICS, SpectrumOptionsDialog::OnShowHarmonics) 41 | END_EVENT_TABLE() 42 | 43 | 44 | // **************************************************************************** 45 | /// Returns the single instance of this dialog. 46 | // **************************************************************************** 47 | 48 | SpectrumOptionsDialog *SpectrumOptionsDialog::getInstance(SpectrumPicture *spectrumPicture) 49 | { 50 | if (instance == NULL) 51 | { 52 | instance = new SpectrumOptionsDialog(NULL); 53 | } 54 | 55 | SpectrumOptionsDialog::spectrumPicture = spectrumPicture; 56 | return instance; 57 | } 58 | 59 | 60 | // **************************************************************************** 61 | /// Private constructor. 62 | // **************************************************************************** 63 | 64 | SpectrumOptionsDialog::SpectrumOptionsDialog(wxWindow *parent) : 65 | wxDialog(parent, wxID_ANY, wxString("Options for the primary spectrum"), 66 | wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) 67 | { 68 | // **************************************************************** 69 | // Init the variables first. 70 | // **************************************************************** 71 | 72 | data = Data::getInstance(); 73 | 74 | // **************************************************************** 75 | // Init and update the widgets. 76 | // **************************************************************** 77 | 78 | initWidgets(); 79 | updateWidgets(); 80 | } 81 | 82 | 83 | // **************************************************************************** 84 | /// Init the widgets. 85 | // **************************************************************************** 86 | 87 | void SpectrumOptionsDialog::initWidgets() 88 | { 89 | wxBoxSizer *topLevelSizer = new wxBoxSizer(wxVERTICAL); 90 | wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); 91 | wxStaticBoxSizer *bottomSizer = new wxStaticBoxSizer(wxVERTICAL, this, "Options"); 92 | 93 | 94 | // Create an invisible dummy button with the ID wxID_CANCEL, so that 95 | // the user can close the dialog with ESC. 96 | wxButton *button = new wxButton(this, wxID_CANCEL, "", wxPoint(0,0), wxSize(0,0)); 97 | 98 | 99 | // **************************************************************** 100 | // Radio buttons to select the spectrum type. 101 | // **************************************************************** 102 | 103 | wxString TYPE_STRINGS[SpectrumPicture::NUM_SPECTRUM_TYPES] = 104 | { 105 | "Transfer function U/U", 106 | "Transfer function P/U", 107 | "Nose transfer function U/U", 108 | "Input impedance of the vocal tract", 109 | "Input impedance of the subglottal system", 110 | "Glottal volume velocity * radiation impedance", 111 | "Radiated pressure (glottal voice source)", 112 | "Radiated pressure (supraglottal noise source)", 113 | "Radiated pressure (pole-zero)", 114 | "Glottal volume velocity" 115 | }; 116 | 117 | radSpectrumType = new wxRadioBox(this, IDR_SPECTRUM_TYPE, "Spectrum type", wxDefaultPosition, 118 | wxDefaultSize, SpectrumPicture::NUM_SPECTRUM_TYPES, TYPE_STRINGS, 1); 119 | 120 | topSizer->Add(radSpectrumType, 0, wxALL, 0); 121 | 122 | // **************************************************************** 123 | // Bottom sizer with additional options. 124 | // **************************************************************** 125 | 126 | chkShowHarmonics = new wxCheckBox(this, IDC_SHOW_HARMONICS, "Show transfer function harmonics"); 127 | 128 | bottomSizer->Add(chkShowHarmonics, 0, wxGROW | wxALL, 5); 129 | 130 | // **************************************************************** 131 | // Init the top-level sizer and set it for this dialog 132 | // **************************************************************** 133 | 134 | topLevelSizer->Add(topSizer, 0, wxGROW | wxALL, 5); 135 | topLevelSizer->Add(bottomSizer, 0, wxGROW | wxALL, 5); 136 | 137 | this->SetSizer(topLevelSizer); 138 | topLevelSizer->Fit(this); 139 | topLevelSizer->SetSizeHints(this); 140 | } 141 | 142 | // **************************************************************************** 143 | /// Update the widgets. 144 | // **************************************************************************** 145 | 146 | void SpectrumOptionsDialog::updateWidgets() 147 | { 148 | if (spectrumPicture != NULL) 149 | { 150 | radSpectrumType->SetSelection((int)spectrumPicture->modelSpectrumType); 151 | chkShowHarmonics->SetValue(spectrumPicture->showVttfHarmonics); 152 | } 153 | } 154 | 155 | // **************************************************************************** 156 | // **************************************************************************** 157 | 158 | void SpectrumOptionsDialog::OnSpectrumType(wxCommandEvent &event) 159 | { 160 | if (spectrumPicture != NULL) 161 | { 162 | int i = event.GetInt(); 163 | spectrumPicture->modelSpectrumType = (SpectrumPicture::ModelSpectrumType)i; 164 | 165 | updateWidgets(); 166 | spectrumPicture->Refresh(); 167 | } 168 | } 169 | 170 | // **************************************************************************** 171 | // **************************************************************************** 172 | 173 | void SpectrumOptionsDialog::OnShowHarmonics(wxCommandEvent &event) 174 | { 175 | if (spectrumPicture != NULL) 176 | { 177 | spectrumPicture->showVttfHarmonics = !spectrumPicture->showVttfHarmonics; 178 | 179 | updateWidgets(); 180 | spectrumPicture->Refresh(); 181 | } 182 | } 183 | 184 | // **************************************************************************** 185 | --------------------------------------------------------------------------------