sentence to follow song words at same time

0 favourites
  • 11 posts
From the Asset Store
An album made by me on Fl studio. 9 songs in mp3 format
  • Hi All,

    Sorry to bother you guys, I?ve been trying to figure this out and can't find a solution, maybe there isn?t 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.

    <img src="https://dl.dropboxusercontent.com/u/139486255/Image/example_Pic_1.png" border="0">

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

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

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

  • Ok, so I implemented what I said, but not the click on a lyric part.

    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)

  • 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: rieperts.com/games/forum/songfollow.capx

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

  • 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 :)

    - obviously, you would have to come up with your own artwork - this is just the first image I found on google...

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

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

  • Try Construct 3

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

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

  • Hello everybody, I was looking at your .capx from my limited c2 knowledge. Is there a way to break it down even further?

    array 0,1 marry 0,2 had 0,3 a 0,4 little 0,5 lamb

    1,1 little 1,2 lamb.

    or am on the wrong track as to how arrays work?

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