Page 1 of 1

TextMeshPro typewriter audio question

Posted: Tue Aug 28, 2018 10:42 pm
by diviocity
Hi,

I've been using the TextMeshPro Typewriter Effect and noticed the alternate audio sources feature doesn't seem to be working. I added many different audio files but it only acknowledges/plays the one referenced in the Audio Clip field. I recall using this in the past (before TMP) and remember it working fine, randomly playing the clips. Just wondering if I'm forgetting something here.

Thanks!

Re: TextMeshPro typewriter audio question

Posted: Wed Aug 29, 2018 10:26 am
by Tony Li
Hi,

That was an oversight on my part when consolidating code for version 2. You can download a fix here:

TMPTypewriter_2018-08-29.unitypackage

Re: TextMeshPro typewriter audio question

Posted: Wed Aug 29, 2018 11:02 pm
by diviocity
Thank you Tony for the quick work! It now works fantastic, thank you!

I suppose I'll leave a small feature request here as well. While we enjoy the rapidity of the "interrupt audio clip" feature, it results in some pretty harsh clipping when playing new clips. Would it be possible to layer the sounds as they play per character so that they don't harshly interrupt each other?

Thanks again, really appreciate all your help!

Re: TextMeshPro typewriter audio question

Posted: Thu Aug 30, 2018 8:30 am
by Tony Li
Sure, I'll add that in the next release.

Re: TextMeshPro typewriter audio question

Posted: Sat Sep 01, 2018 2:51 am
by diviocity
Awesome! Thank you!! I'll definitely be looking forward to it!

Re: TextMeshPro typewriter audio question

Posted: Thu Apr 04, 2019 9:07 pm
by diviocity
Hi Tony! We managed to solve this problem ourselves with an easy fix. I was wondering if you'd consider implementing it as a new feature. Again, our goal was the following:

1. Play a sound for each character displayed
2. Do not interrupt a playing sound as a new one begins

Our solution involved altering the interruptAudioClip script in AbstractTypewriterEffect, changing from audioSource.Play to audioSource.PlayOneShot.

Code: Select all

if (interruptAudioClip)
            {
                //if (audioSource.isPlaying) audioSource.Stop();
                if (randomClip != null) audioSource.clip = randomClip;
                audioSource.PlayOneShot(audioSource.clip);
            }
            else
            {
                if (!audioSource.isPlaying)
                {
                    if (randomClip != null) audioSource.clip = randomClip;
                    audioSource.PlayOneShot(audioSource.clip);
                }
Doing this allowed each sound to play completely for each character displayed.

I realize our solution isn't exactly an "interrupt", but using the base interrupt feature, as previously mentioned, produces a very harsh crackle between clips, which made it unusable for us. Please consider a PlayOneShot option ("play entire sound per character" or something) within the typewriter component. Right now we're re-implementing this change between versions.

Thank you so much!

Re: TextMeshPro typewriter audio question

Posted: Thu Apr 04, 2019 9:13 pm
by Tony Li
You got it. I'll make that change in version 2.1.5 and add it as a new checkbox that you can tick.