Skip to content

Conversation

@samsonsin
Copy link

Hello!

I have been using the app for a while, and wanted more flexibility with my multi voice rules. As such, i choose to rewrite the default speech rules to support some more advanced features like regex matching. This allows for some complex behaviours that would take time to implement programatically, and are problems of the type that are quite prone to bugs.

I have never contributed to a project such as this, so please let me know if you'd like me to modify or otherwise extend this code.

Some possible improvments i can think of right now would be using a more extensive Regex engine which supports some useful functions like variable lookbehinds or the \K control character. I am unsure as to how exactly one would do this on an android app, but please let me know if there are some resources i can make use of to make this improvement.

Another improvement would be the addition of some sort of UI element that could allow a user to add and remove regex rules without entering the code editor. Again, same problem for me as with above.

Either way, thank you for the amazing app!

@samsonsin samsonsin mentioned this pull request Aug 28, 2025
and supports 3 deep nesting as well as multiple
brackets in a row.
Copy link
Author

@samsonsin samsonsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bracket batching regex is longer and more convoluted because it matches up to 3 sub bracket groups at the top level, and up to 3 deep in each. It can be extended to match more widely as a regex if needed, but what's already there is likely more than enough. As a matter of fact, if deemed necessary, trimming it down to the most simple form, quite like the curly bracket regex, may be warranted.

Sadly, recursion is not easily handled using regex. If recursive rules such as this is desired, then a more programmatic approach may be more prudent. An extendable framework could be nice, or perhaps some control bits that enable recursive behavior in the regex matching loop could also be possible. For now though, I believe these are extreme edge cases, so this is likely to be massive overkill.

@grapegiraffe
Copy link

Hi @samsonsin is this for the bad handshake fix?

@samsonsin
Copy link
Author

Hi @samsonsin is this for the bad handshake fix?

No, it's simply an updated version of the default mutli voice rule file. The original version programatically separated narration from dialogue, and extending functionality using that file would require more extensive work, especially for advanced matches. Hence, this update instead allows you to configure a cascading set of regex - tag pairs. Provided you know basic regex, you can match complex patterns as different voices using it, as well as have cascading rulesets. It could potentially be augmented with a Gui interface and a regex generator for the simplest types of matches, but I'm unsure if such is warranted.

@grapegiraffe
Copy link

Thank you for your explanation and fast reply you're a G.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants