Skip to content

Commit

Permalink
Merge branch 'main' into sqlalchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-kane authored Apr 25, 2024
2 parents 3e91553 + bfca274 commit b4197c8
Showing 1 changed file with 38 additions and 15 deletions.
53 changes: 38 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# What is this?

This program was a fairly simplistic python program that watches the City of Heroes chat log file. When it sees a message from an NPC, it uses the windows text-to-speech capability to read out the message. It also notices when you receive a badge and tells you which badge you got.
![image](https://github.com/jason-kane/coh_npc_voices/assets/1907832/4c9f2372-ce67-43f3-b13a-c822d1b4a952)

It still does that, mostly.
This is kinda two programs joined at the hip. I intend to integrate them a bit better at some point. Right now, it provides an interface for modifying the voices of characters, both NPC and player in City of Heroes. If you provide it with the path to your game chat logs (and enable chat logs) then "Attach to Log", it will learn the names of characters that speak and remember what they say. It will also pass that text to the default Windows TTS voice. You'll "hear" what enemies and team members say. Not only that, but if you choose to, you can change what the characters voices sound like.

When coh_voices.exe starts you get a GUI. It shows every character you've seen and allows you to modify the voice profile for each of them.
There are two kinds of change available right now. The biggest difference comes from changing the TTS source from Windoes TTS to Google TTS (ElevenLabs and Parrot soon). That requires a google cloud account with billing attached. For something like this, it's pennies cheap. Good for some variety for humans, but sometimes you need more.

You can then "Attach to Log" and it will find the newest logfile in your CoH log dir, open it up and watch for additions. When a character on the list says something, it speaks for them using their voice profile. New characters are automatically entered with default values.
So we have audio effects. Currently these filters:
Bandpass Filter
Bandstop Filter
Bitcrush
Chorus
Clipping
Compressor
Glitch
Highpass Filter
Lowpass Filter
Normalize
RingMod
Vocoder

Paid text-to-speech services are supported. Right now that means google text-to-speech. You'll need a valid application default login. https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login I know it is a pain. The quality and flexibility are much better but it takes a moment to generate. Responses are cached to keep costs down to near zero.

The voice used by default is the free Windows TTS API system default voice. You can apply voice effects. They are part of the voice profile.
can be configured and layered with some fun results. For better or worse, the UI for manipulating this is immediate -- Whenever you change something it is automatically saved and if you are in-game you will start to hear the new voice.

Overall I think this companion program makes City of Heroes a little more immersive.

Expand All @@ -26,7 +36,7 @@ Overall I think this companion program makes City of Heroes a little more immers

pip uninstall coh_npc_voices

# Adding Voices (Highly Recommended)
# Adding Voices (Worth a shot)

Making new free voices available is an easy way to increase the variety and flavor of voices you hear in the city.

Expand All @@ -42,35 +52,44 @@ You probably have to logout/login before the extra voices are available.

# Running it

Then open a cmd terminal and run:
Start a cmd terminal and run:

coh_voices.exe

First start City of Heroes, login and pick a character. Then enable chat logging.
Start City of Heroes; any host. login and pick any character. Then enable chat logging.

Per https://homecoming.wiki/wiki/Logchat_(Slash_Command)#:~:text=Slash%20Command%201%20The%20log%20files%20are%20stored,in%20Menu--%3E%20Options--%3E%20Windows%20tab--%3E%20Chat-%3E%20Log%20Chat. you can use this slash command in the chat window:
You can use this slash command in the chat window:

/logchat

You will have to do this once for each character you want to enable.
It is also in the settings UI somewhere.

This is a per-character thing so if you aren't getting voices double check this first.

You'll need to figure out where your logs are stored. It will vary based on the installer.
Next you will need to figure out where your logs are stored. It will vary based on the installer.

<COH Install Directory>/accounts/<Account Name>/logs/
<COH Install Directory>/homecoming/accounts/<Account Name>/Logs/

The right directory will have files with names like "chatlog 2024-03-31.txt". If you are having trouble turn on /logchat for a few minutes in-game, then look for file named after todays date.

Use "Set Log Dir" in the upper right corner to configure it for your log location. You should only need to do this once.

Ocne you are ready You will need to click "Attach to Log" in the upper left corner after you are in-game. The "Attach" button changes to a "Detach". You can attach/detach whenever you want.
![image](https://github.com/jason-kane/coh_npc_voices/assets/1907832/73c1b2de-04ed-4096-bf10-b1baaa19d152)

Once you are ready You will need to click "Attach to Log" in the upper left corner after you are in-game. The "Attach" button changes to a "Detach". You can attach/detach whenever you want.


# Local Development

If you are curious and want to poke around at the source code it is right here. You can download your own copy with "git".

git clone https://github.com/jason-kane/coh_npc_voices.git
cd coh_npc_voices

The python source is in src/coh_npc_voices. I've only made minimal efforts to make it nice. It is tied to tkinter more than I would like. The blend of multiprocess and threads is confusing; and core functionality is replicated for no good reason.

But it works, and it is fun. Hence v1.
But it does work, and it is fun.

# Building the Windows Installer

Expand All @@ -84,6 +103,10 @@ The way this works is a little bit awesome. sidekick_setup.exe will install our

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.

# Problems?

Please leave an issue here in github. I can't promise anything but I'm very likely to read it.
Expand Down

0 comments on commit b4197c8

Please sign in to comment.