Mp3 random presentation

He! I did this app, it is a random presentation of mp3. Each mp3 meets a sentence into a label visible in the screen., for example: - 1.mp3 responds to a sentence in label 1; - 2.mp3 responds to a sentence in label 2…. the app runs well, but I would add a new work: I would like that when player plays 1.mp3 the screen puts on top label 1, when player plays 2.mp3 the screen puts on top label 2 ……so that in the screen I see the sentence responding the mp3 the player is playng. I upload aia file to let you see.
How do I have to set bloks editor?
thank you very much
Maurizio

BraniDalDiarioDiSFaustina.aia (152.2 KB)

Maybe one label where you can change the text?

dear Patryk, do I have to use a textBox from User interface where I put all sentences separated from " | " at the biginning? Each sentence must to be numbered like this: "1 Quando andai alla ricreazione....|2 Sarò fedele alla tua volontà..." Could you type an example please?
Thank you
Maurizio

It doesn't matter what the text is between "|". What's between "|" will be displayed in the label when the mp3 file is played. It is important that the order of mp3 files follows the order of the texts. There is no TextBox there

Where do I have to put all sentences?

In my example, instead of "text1 | text2 | text3 | text4 | text5" put your sentences: "sentence 1 | sentence 2 | sentence3 etc.

Do I put all sentences directly in label 12?

No. The sentences are a list, just like you have created a list of mp3 files. Then when playing mp3, label12 only shows one sentence from the list. Build a project with real sentences and mp3 files and test.

Unless you want a different effect, then be more specific about what you want to achieve.

I understand, I put sentences in blocks editor in the string below the one where I put the list of mp3

Yes. I also think you could put sentences also in the txt file in the resources. Every sentence on a new line. Then you read the text file and make a list by breaking the text into "\ n" instead of "|".

thank you very very very much!

You're welcome. Test it and don't forget to go back and confirm the solution so that the topic can be closed.

Patryk excuse me, I did as you suggest me. The app opening says " invalid list operation. Pick random item: Attempt to pick a random element from an empty list".BraniDalDiarioDiSFaustina1label.aia (762.0 KB)

Three mistakes, one on my side, two on yours. A valid initialize block here. Remove your initialize block and move this one.

  • Char "|" it cannot be at the beginning and end. Just between sentences.

now says: list index smaller than 1. select list item. Attemp to get item number 0, of the list, the minimum valid item number is 1

You probably got something wrong with initialize block somewhere. Check again and it's best to move my block to your app.

I put your initialise blok, now the app run but text in the screen do non meet mp3 playng

So you made a mistake somewhere. There must be the same number of mp3 files as sentences separated by "|". It's enough that you made a mistake somewhere and didn't give "|" and will not agree anymore.
Also check that the order of the mp3 files matches the order of the sentences. The order must be the same. The first sentence must be what is contained in 1 mp3 file. E.t.c...

Patrik, at the opening of the app the first sentence always meet the corresponding mp3, next sentences do no meet mp3, then sentences are displayed more than one time
thank you very much for yout patience
Maurizio