I get a runtime error but I can not find the problem. (It does not work on IOS even while it works on my chromebook)



I am surprised this works on a Chromebook.

Your use of a delay procedure is anathema to mobile devices.

Try a fast (30 ms) Clock Timer and a sheet music table for each song, with columns
note, remaining duration in ms
with current note playing in slot 1, updating item 1 each Timer cycle until it is ready to be removed and the next item pops down into slot 1.

Sample apps, none exactly matching your app but built on same ideas:

and also see