I'm adding custom objects + code that basically run lip sync animations and analyses the currently playing audio sample to a project that is built using Naninovel. Currently I've added OnStartedSpeaking and OnFinishedSpeaking callbacks to a LayeredCharacterBehaviour, but what happens in that when a character starts to speak OnFinishedSpeaking is called right away and that's it.
What do I need to do / where to look to make both OnStartedSpeaking and OnFinishedSpeaking to work properly? :)
Problem solved! The reason why OnStartedSpeaking was not called was that the LayeredCharacter wasn't set as author.
This didn't work:
@print "Hello World" wait:false
... but what worked was
@print "Hello World" wait:false author:Eve
There still are two problems in our case:
OnFinishedSpeaking is called first, before any OnStartedSpeaking is called - logic error. We could work around this in our custom code...
Naninovel<Runtime>/AudioController has two AudioSources:
One for the character's speech
One for "text_bleed" sound
As I attach my script that has OnAudioFilterRead() to that AudioController object, we get this error in the Console:
"GameObject has multiple AudioSources and/or AudioListeners attached. While built-in filters like lowpass are instantiated separately, the custom script DSP filter components may only be used by either one AudioSource or AudioListener at a time."
... Still everything works, but it would be nice if "text_bleeb" had its own GameObject...
2) Under the character configuration, there is a field called Voice Source in which you can add an Audio Source object which will be instantiated under the character object during runtime. This object can be accessed via GetConfiguration<CharactersConfiguration>(). More information on accessing configuration objects can be found here: https://naninovel.com/guide/custom-conf ... figuration
I actually have the same problem. I set the animation to start under the finish speaking command, and stop on the start command. Just as a temporary workaround, but hoping to find the source of the issue soon.
The problem is probably to do with the animation, not Naninovel. The callback works correctly. If you are using Animator, be sure to check tutorials as there are state settings you have to be mindful of when setting them up.