How often does the music play?

B

There are 10 sound files.

Pictured above.
It means to execute the following program statement after all ten sound files are played.
Or, it means to execute the following program statement after a sound file is played.

How about saying thank you first instead of coming up with further questions that should have been asked right at the beginning. :frowning_face:

Thank you !

:japanese_ogre:

B

There are 10 sound files.

Pictured above.
It means to execute the following program statement after all ten sound files are played.
Or, it means to execute the following program statement after a sound file is played.

That will be each time a sound file finishes.

How about if you try something yourself? I've already given you a blueprint.

A

The above components.

Play three or more sound files.
How to write a program?

Give an example.

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.


O.aia (60.8 KB)
^
Programming: There are four sound files, all of them are played.

The above procedure is wrong. It only played the first sound file and the fourth sound file.
What is wrong?


P.aia (60.6 KB)
^
The above procedure is correct.

I think I can explain.

The Else Ifs are the key difference here.

They force the switch of sound files to happen at most one time per clock timer cycle.

The sequence of if/then blocks, however, each act independently of each other, so their effect cascades, switching from

  • a to b,
  • b to c,
  • c to d

even before the Player has a chance to finish playing a.
That explains why it jumps from a to d. It happens all in one Clock Timer cycle.

In the first case: in every clock cycle, all conditions are checked, even if one is true. The execution of the first true condition makes the next condition also true, and as a result, all conditions will be executed in one clock cycle. In the second case: the first true condition in one clock cycle is executed. subsequent conditions are not checked anymore, so they are not executed even though they may be true. Therefore, only one condition will be executed per clock cycle.

@or_s This is already your fourth thread on the same topic.

Three of them should be closed or these should be merged.

2 Likes


O.aia (60.8 KB)
^
Programming: There are four sound files, all of them are played.

The above procedure is wrong. It only played the first sound file and the fourth sound file.
What is wrong?


P.aia (60.6 KB)
^
The above procedure is correct.

a

Pictured above.

It means: after a sound file is played. Then execute the following program statement.

Or, a sound file is about to be played (not finished yet). Just execute the following program statement.

http://ai2.appinventor.mit.edu/reference/components/media.html#Player.Completed

1 Like

A

Q.aia (1.9 KB)

Why is the program output garbled?

  1. You do not need to use a clock timer to get the clock1.now instant. Just set the label to clock1.now in your button event.
  2. The output is not garbled, you are getting the content of an instant, all the values, in a list, associated with a date/time instant. Use the date/time formatting blocks to get just the date, time or both.

All your threads seem to concern the same topic.
This would then be the → sixth thread on this. :upside_down_face:

https://community.appinventor.mit.edu/t/what-is-the-difference-between-these-two-programs/22114/4?u=anke

1 Like

6 posts were split to a new topic: Subject or Topic?