How do I

0 favourites
  • 4 posts
  • 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.

  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)