24
2024
Use TikTok-TTS in Unity (with WebRequest)
Was watching some weird physics based game developed at https://www.twitch.tv/clayman_dev and they used node.js+tiktok TTS to play funny text-to-speech sounds!
Then found this library, https://github.com/Steve0929/tiktok-tts
(took a while to get it working as node.js, due to sessionid+server mismatch, but posted solution here https://github.com/Steve0929/tiktok-tts/issues/17 )
Then “converted” it to Unity.. (*not much to convert, it is just a Webrequest (POST) and few header values.. problem is that if you post wrong data, it just says “404”, so you don’t know whats the issue..
Initially tried to get this working https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequestMultimedia.GetAudioClip.html but then checked original node.js sources, where it uses POST request, instead of GET.. so that was the main issue! (and setting cookie to getrequest was probably initially wrong,
Check repo source & instructions for getting tiktok sessionid+server:
https://github.com/unitycoder/tiktok-tts-unity
Sample audio:
https://soundcloud.com/user-689598301/tiktok-tts-sample
making of / struggling video:
*This is not their official API, so it could be closed anytime or the servers might change..
Related Posts
Leave a comment
Recent posts
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)