In a previous topic you made your code available for download. Is this still the same code or similar enough that it represents your problem?
music_eng.pl (31,1 KB) (SWI-Prolog 64 bit release 8.0.3)
As I do not use SWISH other than for checking out existing work published there I can not help.
Have you considered publishing your work as an SWI-Prolog pack?
Note: SWI-Prolog packs should not be confused with SWI-Prolog packages. Be aware that the wrong word (pack or package) may be used and then the correct word has to be derived from context.