Skip to content

Commit

Permalink
Merge pull request #5 from jason-kane/sqlalchemy
Browse files Browse the repository at this point in the history
Sqlalchemy
  • Loading branch information
jason-kane authored Apr 25, 2024
2 parents bfca274 + b4197c8 commit 5d25e70
Show file tree
Hide file tree
Showing 34 changed files with 22,593 additions and 1,060 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
clip_library/
clip_library_saved/
raw_data/

eleven_labs.key

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ Open Settings, choose Time & Language
Choose Speech on the left side
Choose "Add voices" under Manage voices

It won't list everything you install and I don't know why. If you figure out how to get them all recognized let me know.
By itselt that will probably only give you one or two more voices, even if you install a dozen. There is a powershell script 'enable_all_win10_voices.ps' that copies voices from the "only use for windows transcribe" part of the registry out to the "use for anything" part.

You probably have to logout/login before the extra voices are available.

# Running it

Expand Down Expand Up @@ -89,6 +91,18 @@ The python source is in src/coh_npc_voices. I've only made minimal efforts to m

But it does work, and it is fun.

# Building the Windows Installer

First run fresh.bat

fresh.bat

That will clean-slate the venv directory and apply some path detection tweaks. Next run innosetup, load this projects .iss file then -> Build -> Compile. Build -> Open Output folder will give you the dir with the sidekick_setup.exe.

The way this works is a little bit awesome. sidekick_setup.exe will install our files and a barebones python venv, then it will run win_install, which is a compiled version of win_install.ps1. It installs (w/pip) all our dependencies. End result? A small (5MB) setup executable that installs all the crap we need (I'm looking at you numpy. Try eating a salad). Running it again? No problem. If you use the same destination directory it won't even need to re-download the packages. The best part from my POV is the actual running code is sitting there for the user to poke at with no obfuscation.

I'm currently pleased as punch with the installer. Kind of hell to get it all figured out but the results are quite nice.

# Preloaded Data

This is a tricky one. I've only really been gathering processed audio for a little while. I doubt the 161 characters I have represent more than a 5% of the game dialog and I'm at 61MB. Each phrase is cached as a 100KB-ish mp3. You can edit/delete them however you want. If a cachefile exists it will be played instead of generating new audio. I do like the idea of sharing the database with all the characters audio configs, especially if users can easily choose to share what they create. I'm just not sure how best to go about it. TBD. I'll at least share my database as the default setup but tweaked to use free voices when it has enough customization to be worthwhile.
Expand All @@ -111,3 +125,5 @@ https://github.com/DeepHorizons/tts
https://github.com/spotify/pedalboard

Big thanks and shoutout for the creators of these packages.

Raw entity data from https://cod.uberguy.net/html/index.html
1 change: 1 addition & 0 deletions Sidekick.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv\Scripts\python.exe src\coh_npc_voices\sidekick.py
116 changes: 116 additions & 0 deletions alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = migrations

# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s

# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory.
prepend_sys_path = .

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =

# max length of characters to apply to the
# "slug" field
# truncate_slug_length = 40

# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false

# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false

# version location specification; This defaults
# to migrations/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "version_path_separator" below.
# version_locations = %(here)s/bar:%(here)s/bat:migrations/versions

# version path separator; As mentioned above, this is the character used to split
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
# Valid values for version_path_separator are:
#
# version_path_separator = :
# version_path_separator = ;
# version_path_separator = space
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.

# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false

# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8

sqlalchemy.url = sqlite:///voices.db


[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples

# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME

# lint with attempts to fix using "ruff" - use the exec runner, execute a binary
# hooks = ruff
# ruff.type = exec
# ruff.executable = %(here)s/.venv/bin/ruff
# ruff.options = --fix REVISION_SCRIPT_FILENAME

# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
26 changes: 26 additions & 0 deletions aliases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"PsychicClockwork": "Clockwork",
"ArachnosEndgame": "Arachnos",
"TsooEndgame": "Random Any",
"CircleOfThorns": "Circle of Thorns",
"DecayingEidolons": "Vahzilok",
"Outcasts": "Random Any",
"Warriors": "Random Any",
"TheDestroyers": "Random Any",
"Freakshow": "Random Any",
"Tsoo": "Random Any",
"Council": "Random Any",
"The Lost": "Random Any",
"Civilian": "Random Any",
"5thColumn": "Random Any",
"Hellions": "Random Any",
"5thColumnEndgame": "Random Any",
"Council Member": "Random Any",
"TheFamily": "Random Any",
"Nemesis": "Random Any",
"BanishedPantheon": "Random Any",
"ParagonPolice": "Random Any",
"Prisoners": "Random Any",
"Behavioral Adjustees": "Random Any",
"Crey": "Random Any"
}
Loading

0 comments on commit 5d25e70

Please sign in to comment.