sentence to follow song words at same time

Get help using Construct 2

Post » Mon Jan 27, 2014 1:44 pm

Hi All,
Sorry to bother you guys, Ive been trying to figure this out and can't find a solution, maybe there isnt one.

I hope what I am wanting is possible with C2 and if it is I hope someone can show me how to accomplish it.

I would like to play a song and for the words to follow along.

I can do this manually with drag/drop of course
but
what I really want is the sprite to scroll automatically as the song plays, stopping at the correct sentences ... and then quickly scrolling to the next sentence, pausing and so on...

I have attached a sample pic of was hoping to achieve.


Basically, as the song plays the sprite with words just scrolls upward and stops in the correct location and then moves to
the next sentence and so on.
similar to a music progress bar but not exactly as there needs to be pauses in the motion for long periods with no words and longer sentences etc.
Also,
If the player wants to backtrack mid-stream via drag/drop,
I would like the music to stop and restart at the nearest sentence to the outline blue rectangle thing.

Is this even possible with C2?

Oh,

As for the audio track I have inputted sentence markers for the first 4 sentences within the audio track itself. The marker names are just 1, 2 , 3 , 4 . So maybe that can be used as a reference somehow?

See sample capx below link ...of what I have so far latest C2 build ( as of today) and no plugins.
...........click here for capx ......

also
I saw this forum post but really couldn't make heads or tails of it..
maybe it will help someone smarter than me.

similar topic thread ..kind of ....
.
.
.
.

...........click here for capx ......producermark112014-01-27 14:08:09
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Mon Jan 27, 2014 2:05 pm

Hi,

Not being an expert on audio decoding, I will start by saying that you need a timestamp for every sentence in the audio track, like the "markers" you have for now.

I couldn't look at the capx as you didn't link it (it's a link to the running app you used).

Now, let's say you have an array with every item being the timestamp of the corresponding sentence in the song. (first item is for the first sentence, ...). I then see your project like this :
- start of layout/song : set a variable "song_position" to 0
- every tick, add dt to song_position (so you keep a record of where you are in the song), then search in the array the index of the last timestamp that is inferior to song_position : this is the current sentence. Use this index to position your blue marker over this sentence in your layout.
- onclick on a sentence, look in the array for the timestamp of the corresponding index (use a variable on each sentence on screen to know what sentence it is/where it is in the array), and use it in the "seekTo" function from the Audio object to play at the right time. Update "song_position" to the timestamp you've got.

Hope this helps !
B
17
S
8
G
4
Posts: 461
Reputation: 6,127

Post » Mon Jan 27, 2014 2:09 pm

@Guizmus
I fixed the capx link ... by the way, yea I linked a demo... duh !
and thanks for the Array advice.
any chance you could look at what I have ?
I haven't yet tried Arrays.
producermark112014-01-27 14:12:18
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Mon Jan 27, 2014 2:44 pm

@producermark11

Ok, so I implemented what I said, but not the click on a lyric part.
https://www.dropbox.com/s/urqpxou3knaye0j/songfollow.capx

You'll have to adjust the 2 constants I added (one is for the height of a sentence, the over is an offset to position your reader right). I only configured the time (approximately) for the first 4 lyrics. You can add more by completing the array. If there is an implementation question, just ask :) (PS it may still be uploading, as the song is quite heavy)
B
17
S
8
G
4
Posts: 461
Reputation: 6,127

Post » Mon Jan 27, 2014 7:13 pm

Hi Mark! I was curious about what you were trying to do, so I took the file that Guizmus made and expanded on it...

first, I added a pause resume feature, and show the song's current playbacktime. That makes it easier to get the exact time for the start of each line.

Guizmus was keeping a manual timer, which worked fine until I added the pause. I changed the song_position variable to be the current line being played (rather than the position in seconds).

I also added a picture, and made the lyrics scroll - rather than the line marker.

when you drag and drop the lyrics it now calculates what line you set it to, and starts playing from there.

I thought about making it change the picture at certain points too...

There is a bug in my code - when the lyrics scroll up under the Pause/Resume button it thinks you are trying to drag and drop the lyrics if you try to click on the button. I am not sure if you can block the drag and drop behavior on certain parts of the screen or not...

you can get my version at: www.rieperts.com/games/forum/songfollow.capx
B
94
S
33
G
20
Posts: 438
Reputation: 17,605

Post » Mon Jan 27, 2014 7:38 pm

@AllanR Nice ! I spent a lot more time than I thought on this one (lots of little bugs I couldn't see at first ^^) and it's nice to see it expended so much and so fast ! I don't know what Mark was aiming for, but your additions are niiiiice !
B
17
S
8
G
4
Posts: 461
Reputation: 6,127

Post » Mon Jan 27, 2014 7:59 pm

@Guizmus - Thanks! :) I spent more time on this than I should have too. It was nice having a good starting point to jump into!

If Mark makes money on this I think he owes us some royalties :)

@producermark11 - obviously, you would have to come up with your own artwork - this is just the first image I found on google...
B
94
S
33
G
20
Posts: 438
Reputation: 17,605

Post » Mon Jan 27, 2014 8:45 pm

@AllanR and @Guizmus

Thank you, Thank you, Thanks so much for the help. That is exactly what I was looking for.

What I have been doing is manually scrolling while I listen to Japanese pop songs. oh, which by the way, has been the answer to break free from the plateau I was stuck on for so long now. If anyone out there is struggling to learn a new language, something like this may help you.

I will now add multiple versions of the word sprite for the player (me) to select from. One sprite will have, for example, have the shorter words written in Japanese Kana, another sprite will include English translations under the Japanese etc etc.( full Kana, Kanji, translations, no translations )

oh, and if I ever do make some $$ from this, I believe in Karma.

I will also attempt to add slowdown and speedup buttons as well.

Again thanks. producermark112014-01-27 20:53:21
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Post » Mon Jan 27, 2014 8:49 pm

Only problem that I see to develop this to the end is content. You'll need the rights for the songs/videos you want to subtitle like this, and you'll need to time a LOT of sentences...
B
17
S
8
G
4
Posts: 461
Reputation: 6,127

Post » Mon Jan 27, 2014 8:59 pm

@Guizmus

RE: copyrights , for now this is only for me

and you'll need to time a LOT of sentences...
yes that is very time consuming isn't it.
I just noted the number of sentences I need in
the song I want and it comes to 50,
so not as bad as I was expecting actually.
but then again.. times that by how many songs I want ...
whew....:-)producermark112014-01-28 00:11:01
B
35
S
10
G
4
Posts: 250
Reputation: 7,908

Next

Return to How do I....?

Who is online

Users browsing this forum: luck1210, RedBlackSpade and 5 guests