Mouse tracking with lip sync - initial commit
[mouse-tracker-for-cubism.git] / README.md
CommitLineData
126d8fa4 1# Mouse Tracker for Cubism
830d0ba4 2
126d8fa4
AIL
3A library that tracks mouse cursor location and microphone input and
4converts them into Live2D® Cubism SDK parameters.
5
6This is a spin-off project from [Facial Landmarks for Cubism](https://github.com/adrianiainlam/facial-landmarks-for-cubism).
7The objective is to provide similar functionality, but requiring much
8less CPU load, which can be critical if the processor does not support
9AVX instructions. It also does not require the use of a dataset which
10restricts commercial use, and it does not require a webcam.
830d0ba4
AIL
11
12*Disclaimer: This library is designed for use with the Live2D® Cubism SDK.
13It is not part of the SDK itself, and is not affiliated in any way with Live2D
14Inc. The Live2D® Cubism SDK belongs solely to Live2D Inc. You will need to
15agree to Live2D Inc.'s license agreements to use the Live2D® Cubism SDK.*
16
126d8fa4 17<!-- TODO maybe make a demo video? -->
830d0ba4
AIL
18
19## Supporting environments
20
126d8fa4
AIL
21This library is designed for Linux (or other *nix systems) with X11 and
22PulseAudio.
23
24I have made use of one C++17 library (`<filesystem>`)
830d0ba4
AIL
25in the example program, but it should be straightforward to change this
26if you don't have C++17 support.
27
830d0ba4
AIL
28## Build instructions
29
301. Install dependencies.
31
32 You will require a recent C/C++ compiler, `make`, `patch`, CMake >= 3.16,
126d8fa4 33 libxdo, and PulseAudio. To compile the example
830d0ba4
AIL
34 program you will also require the OpenGL library (and its dev headers)
35 among other libraries required for the example program. The libraries I
36 had to install (this list may not be exhaustive) are:
37
126d8fa4 38 libxdo-dev libpulse-dev libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libglu1-mesa-dev
830d0ba4
AIL
39
402. Clone this repository including its submodule (dlib)
41
126d8fa4 42 git clone https://github.com/adrianiainlam/mouse-tracker-for-cubism.git
830d0ba4 43
2b1f0c7c
AIL
443. To build the library only: (Skip this step if you want to build the example
45 program. It will be done automatically.)
830d0ba4
AIL
46
47 cd <path of the git repo>
48 ./build.sh
49
830d0ba4
AIL
50To build the example program:
51
126d8fa4 524. Download "Cubism 4 SDK for Native R1" from the Live2D website:
830d0ba4
AIL
53 <https://www.live2d.com/en/download/cubism-sdk/download-native/>.
54
55 Extract the archive -- put the "CubismSdkForNative-4-r.1" folder under
56 the "example" folder of this repo.
57
58 Note: The Cubism SDK is the property of Live2D and is not part of this
59 project. You must agree to Live2D's license agreements to use it.
60
126d8fa4 615. Go into the
830d0ba4
AIL
62 "example/CubismSdkForNative-4-r.1/Samples/OpenGL/thirdParty/scripts"
63 directory and run
64
65 ./setup_glew_glfw
66
126d8fa4 676. Go back to the "example" directory and run
830d0ba4
AIL
68
69 ./build.sh
70
126d8fa4 717. Now try running the example program. From the "example" directory:
830d0ba4
AIL
72
73 cd ./demo_build/build/make_gcc/bin/Demo/
74 ./Demo
75
76
77## Command-line arguments for the example program
78
79Most command-line arguments are to control the Cubism side of the program.
80Only one argument (`--config`) is used to specify the configuration file
81for the Facial Landmarks for Cubism library.
82
83 * `--window-width`, `-W`: Specify the window width
84 * `--window-height`, `-H`: Specify the window height
85 * `--window-title`, `-t`: Specify the window title
86 * `--root-dir`, `-d`: The directory at which the "Resources" folder will
87 be found. This is where the model data will be located.
88 * `--scale-factor`, `-f`: How the model should be scaled
89 * `--translate-x`, `-x`: Horizontal translation of the model within the
90 window
91 * `--translate-y`, `-y`: Vertical translation of the model within the window
92 * `--model`, `-m`: Name of the model to be used. This must be located inside
93 the "Resources" folder.
126d8fa4 94 * `--config`, `-c`: Path to the configuration file for the Mouse Tracker
830d0ba4
AIL
95 for Cubism library. See below for more details.
96
830d0ba4
AIL
97## Configuration file
98
126d8fa4
AIL
99There are fewer tweakable parameters compared to the Facial Landmarks
100library, but I have still kept the configuration file to allow some
101customization. The file
830d0ba4
AIL
102"config.txt" lists and documents all parameters and their default values.
103You can change the values there and pass it to the example program using
2b1f0c7c 104the `-c` argument. If using the library directly, the path to this file
830d0ba4
AIL
105should be passed to the constructor (or pass an empty string to use
106default values).
107
108## License
109
110The library itself is provided under the MIT license. By "the library itself"
111I refer to the following files that I have provided under this repo:
112
126d8fa4
AIL
113 * src/mouse_cursor_tracker.cpp
114 * include/mouse_cursor_tracker.cpp
830d0ba4 115 * and if you decide to build the binary for the library, the resulting
126d8fa4 116 binary file (typically build/libMouseTrackerForCubism.a)
830d0ba4
AIL
117
118The license text can be found in LICENSE-MIT.txt, and also at the top of
119the .cpp and .h files.
120
830d0ba4
AIL
121The example program is a patched version of the sample program provided
122by Live2D (because there's really no point in reinventing the wheel),
123and as such, as per the licensing restrictions by Live2D, is still the
124property of Live2D.
125
126The patch file (example/demo.patch) contains lines showing additions by
127me, as well as deleted lines and unchanged lines for context. The deleted
128and unchanged lines are obviously still owned by Live2D. For my additions,
129where substantial enough for me to claim ownership, I release them under
130the Do What the Fuck You Want to Public License, version 2. The full license
131text can be found in LICENSE-WTFPL.txt.
132
133All other files not mentioned above that I have provided in this repo
134(i.e. not downloaded and placed here by you), *excluding* the two license
135documents and files generated by Git, are also released under the Do What
136the Fuck You Want to Public License, version 2, whose full license text
137can be found in LICENSE-WTFPL.txt.
138
139In order to use example program, or in any other way use this library
140with the Live2D® Cubism SDK, you must agree to the license by Live2D Inc.
141Their licenses can be found here:
142<https://www.live2d.com/en/download/cubism-sdk/download-native/>.
143
830d0ba4
AIL
144This is not a license requirement, but if you find my library useful,
145I'd love to hear from you! Send me an email at spam(at)adrianiainlam.tk --
146replacing "spam" with the name of this repo :).
147
148## Contributions
149
150Contributions welcome! This is only a hobby weekend project so I don't
126d8fa4 151really have many environments to test it on. Feel free to submit
830d0ba4
AIL
152issues or pull requests on GitHub, or send questions or patches to me
153(see my email address above) if you prefer email. Thanks :)
154