Automatic assembly of music loops

Hello, I am currently a student at SAE Brisbane.

I have an opportunity to collaborate with game students, and this will be the first time doing so in my audio career.

I am interested, in creating a basic music automation tool, that randomly selects loops of music, and I have not utilized FMOD previously.

The game idea will play similarly to LSD Dream Emulator: However every time the character is transported to a new dream layer, I wish to automatically generate a “Soundtrack” based on 16-32 bar loops that have been engineered to be compatible with randomly playing with each other.

If someone has created something similar to this or knows of a good tutorial to achieve this, I would love to get into contact with someone to talk shop or to be pointed in the right direction. Cheers.