How do I

Get help using Construct 2

Post » Tue Jun 09, 2015 4:26 pm

How do I achieve the following scenario in Construct2?

I have an activity with 13 different pages. All the pages have different audio and text of the audio. The text of the audio is displayed on the page.

While playing the audio, the word which is played in the audio should be highlighted in the text displayed on the page. All the 13 pages have different audio and different text of that audio. The positioning of the text on the page is dynamic.
B
2
Posts: 1
Reputation: 152

Post » Tue Jun 09, 2015 4:43 pm

Are the audio-files seperated by word or is it one long file?

if they are seperated by word you could just set the text to a different colour depending on audio name..

If it is one large file I guess you will have to define at what time in the audio file a word is spoken and adjust the text-object at that time
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jun 09, 2015 10:49 pm

You mean like a speaking book for children ?

It can be done ; the hard bit is synchronising the text and audio.

It should be possible (difficult in C2 realistically) to analyse the audio to find the pause points, especially if you are speaking slowly, and then marry this up with your spoken text split on spaces, to produce a JSON structure which contains the word, the start point and length of the equivalent audio. This would be easiest if the sound is in some sort of absolute raw audio format, e.g. a sequence of byte, word or long values sampled at a constant rate which if you plotted them would show the waveform of the sound - easier than decoding WAV etc. yourself, you can then look for periods of silence in the audio. I don't think this is a C2 thing - possibly python has a library that handles sound ? Java maybe ? sox could probably do the format conversion for you ? Not sure.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Wed Jun 10, 2015 4:51 am

I wouldn't try any kind of automated speech recognition. If you were capable of that, you wouldn't be asking us. If you are going to do that though, find a javascript library and implement it as a plugin. I would definitely look for a javascript library over a python one, as I'm not aware of any bridge between C2 and python. (as partial as I am to python <3)

My solution would be to listen to the audio, possibly slowed down, and manually pick out the word boundaries. I would try and markup the text with timestamps, Alternately put each word of the text in a 2d array, with one column being a single word, and the next column being the start time of that word. However you get to this point, you can now check the audio time, and use it to determine where in the text you are.

Have you played with the Text object? Is it dynamic enough for your purposes? I don't think it supports any kind of markup, so I think the highlighted word needs to be a separate text object. Have a look through the completed plugin list though, as there may be a more featureful addon text object, and using some kind of markup would be much easier than separate text objects.
B
14
S
5
G
1
Posts: 189
Reputation: 1,536


Return to How do I....?

Who is online

Users browsing this forum: Clark Thy Lord, timoteomorelli and 1 guest