Playing recorded sounds of configurable piano keys on another screen

I have been trying to create a customizable piano app in which the sound keys are configured in a separate Config screen.
I have been unable to successfully call the recorded sounds on the keys screen.

Any help is very appreciated!
Here are the blocks on the PIANO screen:


Here are the blocks on the CONFIGURATION screen:

And here is the .aia of the test project:
Teste_PassarArquivodesomPorTelas.aia (947.7 KB)

Make that 2nd Screen a Virtual Screen instead.

When we define virtual screens, we use one 'real' App Inventor Screen (most often Screen1). Screen-sized Vertical Arrangements on it are displayed/hidden as required - they are the Virtual Screens. This is generally a better approach for multi-screen Apps, they share data without having to "pass" it between screens and it also reduces code duplication, making the App more efficient and the code easier to follow if you have to return to it at a later date.

So, instead of separate "houses", virtual screens are "rooms" of the same "house".

Thanks for the suggestion, I'll get right to it!
I've just imported the "real" screen to the Virtual screen and it already changes smoothly. Now I'll see if there's any quirks with the data storing

476F6420626C65737320796F75210D0A0D0A486572652773206120676F6F6420776F726420666F7220796F7520696E20746869732064617920666F722068656C70696E67206D653A20546865792061726520616C776179732067656E65726F757320616E64206C656E6420667265656C793B207468656972206368696C6472656E2077696C6C206265206120626C657373696E672E20285073616C6D732033373A3336204E495629

So I tested it out and it works for the purpose of "sending data across screens" since it doesn't do that (technically) anymore.

I'm only having trouble storing different data now (for example, recording in a specific button gets overwritten by another button recording)

Here is the non-test edition .aia of my project. Screen [piano] is the one we're working on (It is in brazilian portuguese, but I think it won't be a problem)

Musica_AgoraVai.aia (109.9 KB)

image

I suggest using the Companion, and applying Do It to the get global lista block.

That will show all the sound file names in your key dictionary.

Thanks for the response and suggestion!

Sorry, I don't think I understand. What is the "Do It"? Is that the same as the [do/result] block?
I also didn't understand the logic there: [Get value for key] Dr [in dictionary] [do x result in get global lista]?

Or do you mean moving the call TaifunPlayerPiano.Start to inside the [do/result] block?

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


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

Ah, I see.
It's the Companion app for the PC. Thought it was the mobile one.

Edit:
Using the Companion for the mobile, there is an option that appears when right-clicking on blocks, "Do It".
Right-click over a block, and the option "Do It" appears! It executes that block's command.

"Do It" returned nothing of value to me, at my level of understanding.
So I didn't do it, gave up on the Dictionary route and used the, less sofisticated, one-variable-per-each route. It works!

However, the sound player stops whenever a piano key is played.
I believe it's probably because the same sound player is being called by the other keys.

Correct.

You can use multiple Player components simultaneously for rondos.

1 Like

We're almost done with the project.
We just need a way of setting up a list of sounds (piano keys) that are referenced anytime there is no data stored by an user, like an standard soundbase or an original set