A real-time music generation engine for an interactive system, wherein the music generation engine and the interactive system are communicatively connected to transmit parameters relating to music generation between them, comprising: - a Musical Rule Set, MRS, unit comprising a predefined composer input, said MRS unit being configured to receive a real-time control signal and combine a selected rule definition with the real-time control signal into a music signal, wherein the rule definition is obtained from the predefined composer input; - a Constructor Automaton, CA, functioning as a layer for structuring a piece of music by using several different building blocks and configured to generate the piece of music based on the music signal from the MRS unit by means of musical handlers comprising the various building blocks for directed autonomous music creation; - a Performance Cluster Unit, PCU, comprising a MIDI block, an audio block and a filter block and configured to convert the piece of music from the CA into a corresponding musical control signal; a Genetic Design Layer, GDL, configured to mutate musical characteristics from the rule definitions based on the real-time control signal; wherein the musical control signal is in MIDI form, or the musical control signal is used for real-time playback by the interactive system, by means of controlling at least one Audio Block operatively connected to said interactive system, wherein the Audio Block is one part of the PCU characterized in that the real-time music generation engine further comprises: - an Audio Analysis Block, AAB, configured to analyze spectral information of any outputted audio being played back by the interactive system; and the PCU is further configured to respond to said spectral information by restricting playing back notes which would sonically interfere with the outputted audio based on their pitch, frequency, or spectrum. - a Musical Rule Set, MRS, unit comprising a predefined composer input, said MRS unit being configured to receive a real-time control signal and combine a selected rule definition with the real-time control signal into a music signal, wherein the rule definition is obtained from the predefined composer input; - a Constructor Automaton, CA, functioning as a layer for structuring a piece of music by using several different building blocks and configured to generate the piece of music based on the music signal from the MRS unit by means of musical handlers comprising the various building blocks for directed autonomous music creation; - a Performance Cluster Unit, PCU, comprising a MIDI block, an audio block and a filter block and configured to convert the piece of music from the CA into a corresponding musical control signal; a Genetic Design Layer, GDL, configured to mutate musical characteristics from the rule definitions based on the real-time control signal; wherein the musical control signal is in MIDI form, or the musical control signal is used for real-time playback by the interactive system, by means of controlling at least one Audio Block operatively connected to said interactive system, wherein the Audio Block is one part of the PCU characterized in that the real-time music generation engine further comprises: a Genetic Design Layer, GDL, configured to mutate musical characteristics from the rule definitions based on the real-time control signal; wherein the musical control signal is in MIDI form, or the musical control signal is used for real-time playback by the interactive system, by means of controlling at least one Audio Block operatively connected to said interactive system, wherein the Audio Block is one part of the PCU characterized in that the real-time music generation engine further comprises: - an Audio Analysis Block, AAB, configured to analyze spectral information of any outputted audio being played back by the interactive system; and