Virtual instrument library?

Anyone know of any free (open source) libraries that can allow my project to dynamically play a bass guitar chord / drum /synth / etc.
Id like to automatically generate music based on the pace of the battle and the combatants in my simple homebrew game. Any ideas on where to even start?

If you are able to program then you could go integrate a software synthesizer. There are free ones, search ‘free software synthesizer’ and look at their licenses and how you could integrate them. Probably a rather complex task.

Or import some samples and play them.

Though Id think whatever route you go it will not be easy.

Really the easiest way to handle this would be to export wav files for each sample you’d want to play, put them into an array and write a little math logic to map “keys” to this array so playing middle c in-game would play middle C from the array or samples. Not insurmountable but definitely tedious!