{"id":13861882,"url":"https://github.com/FedericoDiMarzo/MusesEchoes","last_synced_at":"2025-07-14T09:34:08.542Z","repository":{"id":73305812,"uuid":"322635247","full_name":"FedericoDiMarzo/MusesEchoes","owner":"FedericoDiMarzo","description":"An automatic improvisation software and an interactive installation that generates chord progressions and melodies on the fly, following the playing of the musician, understanding the modal changes and providing an artificial musical companion that could provide new unexpected composition ideas.","archived":false,"fork":false,"pushed_at":"2023-05-23T15:20:47.000Z","size":546,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-28T13:46:21.397Z","etag":null,"topics":["artistic-visualization","audio","automatic-music-generation","creative-coding","generative-art","markov-chain","markov-model","midi","new-media-art","real-time","sequencer-midi","touchdesigner"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FedericoDiMarzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-12-18T15:38:49.000Z","updated_at":"2024-06-09T20:30:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"381e4cb9-6458-4b52-8a60-54accce0da84","html_url":"https://github.com/FedericoDiMarzo/MusesEchoes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoDiMarzo%2FMusesEchoes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoDiMarzo%2FMusesEchoes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoDiMarzo%2FMusesEchoes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoDiMarzo%2FMusesEchoes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FedericoDiMarzo","download_url":"https://codeload.github.com/FedericoDiMarzo/MusesEchoes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225968891,"owners_count":17553157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artistic-visualization","audio","automatic-music-generation","creative-coding","generative-art","markov-chain","markov-model","midi","new-media-art","real-time","sequencer-midi","touchdesigner"],"created_at":"2024-08-05T06:01:32.156Z","updated_at":"2024-11-22T21:31:18.365Z","avatar_url":"https://github.com/FedericoDiMarzo.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n## [VIDEO PROMO](https://youtu.be/8IJ5-5ZLTEk)\nThe video shows the hole system set up and running on Windows 10 PC.\nHardware: Novation Launchkey Mini mk3.\nSoftware: Ableton Live 10 - TouchDesigner - LoopMidi - OBS.\n\n\n## Muses Echoes\n\nOur creativity is inspired by everything we heard, everything we have listened to. Creativity is an amazing process generated by the ideas of who came before us in history.\nIt often happens that creativity experiences a block, an interruption, a moment of stalemate; This is where technology comes into play, simulating the most intimate thing there can be during the creative process, providing the artist not merely with support but with a total source of inspiration. Greeks used to have Inspirational Muses. We created this tool to make an inspiring Muse available to the user.\n\nOnce your instrument is connected, Muses’echoes will provide the opportunity to be surrounded by rhythms, chords and vocal melodies that will dance together with the musician's creative flow, contributing to an endless inspirational flow.\n\nMuses’s echoes can also be seen as an installation to be placed in a dark room consisting of a screen and speakers that gives a visual and acoustical feedback based upon musical inputs of attenders.\nThe immersive experience you live inside the room will give you the possibility of interacting with the installation by the instruments placed inside the room.\n\n ## muses.py\nThe script muses.py contains the main class that makes up the Muses' Echoes application. After an object is created passing all the requested parameters to modify the settings, the application can be started calling the start method. The start method will block the execution and spawn the threads needed for the application to work. The fire_event method will than handle the synchronization between the threads.\n\n### Constructor\nCan be found in ```muses.py``` class. The following are the editable parameters for an easy Muses Echoes customization:\n\n```midi_in_port```: name of the midi input port\n\n```midi_sequence_out_port```: name of the midi output port for the melody\n\n```midi_chord_out_port```: name of the midi output port for the chords\n\n ```midi_rhythm_out_port```: name of the midi output port for the rhythm\n \n```midi_mapping```: indicates how the modes are mapped to a certain midi channel\n\n```midi_buffer_size```: size of the buffer used to store midi notes before pushing them in the MidiNoteQueue\n\n```osc_ip```: ip string for the osc node receiving information about the scale\n\n```osc_port```: port string the osc node receiving information about the scale\n\n```bpm```: floats indicating the beats per minutes of the performance\n\n```measures_for_scale_change```: positive integer indicating the number of measures for a change of scale\n\n```melody_octave_range```: tuple containing the lowest and the highest octaves used for generating the melodies\n\n```chord_octave_range```: tuple containing the lowest and the highest octaves used for generating the chords\n\n```rhythm_midi_note```: midi note used for the rhythmic sequencer track\n\n```markov_chains_order```: order of the Markov Chains used to generate the melodies\n\n```markov_chains_inertia```: value between ```[0-1]``` used to indicate the influence of old melodies in the learning\n\n\n## Markov Chains\nMuses Echoes implements a Markov chain driven through a database of Beatles songs as an “engine” for the progressive generation of melodies, chords, rhythms.\nThe database used is that relating to the discography of the musical group The Beatles, thanks to the great variety of tones within the songs and the considerable popularity that these songs have achieved. The generation of rhythms, chords, melodies will therefore have a completely familiar feeling.\nThe database used can be found at the following link: [http://isophonics.net/content/reference-annotations-beatles](http://isophonics.net/content/reference-annotations-beatles).\n\nThe process of creating the customized database comes from a \"cleaning\" relating to the information relating to the songs that are not necessary for the training of the Markov chains. The processing of the Structural_Segmentation, csv and Chords.csv files was useful. A Python script has been implemented which is useful for extrapolating from these .csv files only what is of interest to us. The process used to create the model, can be found in this repository https://github.com/FedericoDiMarzo/BeatlesChordsMarkovChain .\n\nThe implementation of the Markov Chain was possible thanks to the use of a library provided by [Pomegranate]( https://pomegranate.readthedocs.io/en/latest/MarkovChain.html)\n\nInside the ```__main__.py``` file, Pomegranate gives the possibility to manage two fundamental parameters for the correct functioning of Muses Echoes. The following parameters can be changed as desired based on artistic and performance matters.\n\n```python\n_markov_chains_order = 3\n_markov_chains_inertia = 0.78\n```\nMore precisely, the “Inertia” parameter provides the possibility to totally ignore the old parameters (0.0), or the new parameters (1.0).\n\nThe \"Order\" parameter defines the order of the Markow Chain. It is possible to modify this parameter as desired, taking into account the following factors:\n- Goodness of predictions\n- Overall latency\n\nAn order \"3\" with an inertia \"0.78\" generally shows itself as a good compromise.\n\n\n## Modularity\nThe design of the system focuses on modularity, i.e. the possibility that the user or artist has to use all the tools available at will, developing personal installations and keeping the level of creativity high.\nIt is possible to use the Muses Echoes output parameters as you see fit, by implementing different DAWs and programming sounds and rhythms to your liking, or by triggering different musical instruments using the universal MIDI and OSC protocols.\nThere is also a total modularity of ports. Muses Echoes provides the ability to set names and uses for the ports you prefer.\n\n\n## Preliminary steps\nFirst of all, make sure to run the\n```shell\npip install requirements.txt\n```\ncommand in you shell, in order to install all the packages needed for a correct Muse’s Echoes funtioning.\n\nFor some reason, the package pyaudio needs to be installed manually in a windows environment. We provided a precompiled version of it for a win_amd64 architecture. If this doesn't match your architecture, search for a correct precompiled wheel file in the web, or try to use pipwin (https://pypi.org/project/pipwin/)\n```shell\npip install lib/PyAudio-0.2.11-cp38-cp38-win_amd64.whl\n```\n\n## MIDI set up\nMuses Echoes needs 4 MIDI ports in input-output in the following configuration:\n- Input Ports: ```python [in]```\n- Output Ports: ```python [melody] [chord] [rhythm]```\n\nThe input port must necessarily be configured by your DAW in order to be able to send midi notes to Muse's Echoes.\n\nFirst of all, it is recommended to use the [loopMidi](https://www.tobias-erichsen.de/software/loopmidi.html) software for setting the midi ports. In the following figure you can see the loopMidi software screen in which four virtual Midi ports have been created, called respectively midi_in, midi_melody, midi_chords, midi_rhythm.\n\n ![image](https://user-images.githubusercontent.com/60785720/123107810-293d3180-d43a-11eb-93cb-714a691745fe.png)\n \nMuse's Echoes will change the midi channel on the basis of the modal scale, starting from the Ionic mode (CH 1) up to the Locrian mode (CH 7). This behavior of the software is useful if the user wants to assign a different sound for each mode within, for example, their DAW. A different scale to midi mapping can be provided in the ```__main__.py``` file.\n\n### Selecting the right MIDI ports\nOnce the ```__main.__py``` file is set up, go to the terminal and type the following command:\n```shell\npython -m muses echoes\n```\nThe system will show the position of the midi ports.\n\n```\nusage: python -m muses_echoes [in] [melodies] [chords] [rhythm]\n\n-----------\n\nmidi in ports: ['Launchkey Mini MK3 MIDI 4', 'MIDIIN2 (Launchkey Mini MK3 MID 5', 'loop-chords 2', 'loop-input 0', 'loop-melody 1', 'loop-rhythm 3']\nmidi out ports: ['Launchkey Mini MK3 MIDI 5', 'MIDIOUT2 (Launchkey Mini MK3 MI 6', 'Microsoft GS Wavetable Synth 0', 'loop-chords 3', 'loop-input 1', 'loop-melody 2', 'loop-rhythm 4']\n\n-----------\n\n[in]: midi in port index used to receive notes\n[melodies]: midi out port index used to send notes for the melody\n[chords]: midi out port index used to send notes for the chords\n[rhythm]: midi out port index used to send notes for the rhythm\n```\n\nTo set the correct parameter for each midi port it is sufficient to indicate the position of the relative ports shown, starting from the zero value:\n\n```shell\npython -m muses_echoes [in] [melody] [chord] [rhythm]\n```\n\nIn this precise case for example the input needs to be:\n\n```shell\npython -m muses_echoes 4 6 4 7\n```\n\nWhen __main__.py is executed, the name of the ports associated with each relative input / output is printed on the terminal. It is therefore possible to check that everything is set correctly.\n\n```shell\nselected midi input: loop-input 0\nselected midi sequence output: loop-melody 2\nselected midi chord output: loop-chords 3\nselected midi rhythm output: loop-rhythm 4\n```\n\n## OSC Set up\nMuses Echoes supports the OSC protocol for sending data. These data can be used for the management of a particular graphic interface through for example the [MadMapper](https://madmapper.com/) software, [Processing](https://processing.org/), [TouchDesigner](https://derivative.ca/), or a [DMX](https://it.wikipedia.org/wiki/Digital_MultipleX) control unit or anything else.\nA different value is sent through the OSC protocol each time a scale change occurs.\nInside the ```__main__.py``` file there is the area where you can set parameters such as:\n- IP address (default: 127.0.0.1)\n- UDP port (default: 1337)\n\n```python\n_osc_ip = \"127.0.0.1\"\n_osc_port = 1337\n```\nOSC sends a value every time a change of scale occurs (useful for programming changing visuals)\n\n## Sound Design\n\nthere are certain ways to use different modes, in order to produce scales and melodies. One  way to describe or distinguish one mode from another is the **mood** or **feeling** that a certain mode gives to an human being. This comes from how Bright or Dark these modes are. For example, Lydian and Ionian Modes are used in happy and spiritually uplifting music. Mixolydian and Dorian Modes are often used in blues and gospel music. The Aeolian (minor) Mode is defined as melancholy and sad while Phrygian and Locrian Modes are the go-to Modes for scary, dramatic, and otherworldly sounds. [1]\nBelow we represent a Brightest to Darkest modes chart. It is possible to notice that the more Flats, the Darker the sound:\n- Lydian: 1 2 3 #4 5 6 7 (Brightest)\n- Ionian: 1 2 3 4 5 6 7\n- Mixolydian: 1 2 3 4 5 6 b7\n- Dorian: 1 2 b3 4 5 6 b7\n- Aeolian: 1 2 b3 4 5 b6 b7\n- Phrygian: 1 b2 b3 4 5 b6 b7\n- Locrian: 1 b2 b3 4 b5 b6 b7 (Darkest)\n\n[1] For more, read this article: [http://blog.dubspot.com/music-theory-modes/](http://blog.dubspot.com/music-theory-modes/)\n\n\n### DAW Set up\nHere we used the Ableton Live software but it is possible to carry out the same operations with all DAWs / software that support the management of the Midi / OSC protocol.\n\nHere our Ableton Live settings:\n\n![LOOP-IN](https://user-images.githubusercontent.com/60785720/123548930-307c7c00-d767-11eb-8ec0-f04a23335eef.JPG)\n![DIRECT-PLAY](https://user-images.githubusercontent.com/60785720/123548929-2fe3e580-d767-11eb-895a-ffd2b0fd991b.JPG)\n![MELODY](https://user-images.githubusercontent.com/60785720/123548931-307c7c00-d767-11eb-91ac-224854b8fb90.JPG)\n![CHORDS](https://user-images.githubusercontent.com/60785720/123548928-2f4b4f00-d767-11eb-84d8-4208bf31c53a.JPG)\n![RHYTHM](https://user-images.githubusercontent.com/60785720/123549132-ea73e800-d767-11eb-8911-a85b66faa848.JPG)\n![WHOLE](https://user-images.githubusercontent.com/60785720/123549067-b13b7800-d767-11eb-9eda-d5fac6fb43dd.JPG)\n\n\n## Touch Designer\nAlthough Muses’ Echoes can be used with many different subsystems for visual renderings, an example application, based on TouchDesigner (https://derivative.ca)  can be found directly in this repository inside the omonimous folder.\n\nIn order to run the TouchDesigner project, a version of the software (the free one is compatible with it) should be downloaded and installed from their website at https://derivative.ca/download .\nAfter the software has been installed, the script MusesEchoes.x.toe (where x is the latest version) inside the TouchDesigner folder can be launched.\n\nThe visuals will start, presenting a white screen. In order to interact with the animation, the osc and midi settings must be changed. \n\nFor the midi settings, follow “Dialogs/MIDI Device Mapper”, a window showing the midi devices will appear. From this window, after the loopback ports have been setted up as explained in the previous section, check that the devices shown are the same as the ones in the figure below.\n\n![Screenshot (29)](https://user-images.githubusercontent.com/25433493/123935581-a6b1f600-d994-11eb-829c-090f1a9f1b91.png)\n\nThe TouchDesigner implementation supports only major and minor clusters of modes in the midi channels 1 (I-IV-V modes) and 2 (II-III-VI-VII modes). To reflect this mapping, the following setting should be changed inside the ``__main__.py`` script:\n\n```python\n_midi_mapping = [1, 2, 2, 1, 1, 2, 2]\n```\n\nRegarding the osc settings, the default port 1337 is already configured, if you want to change this setting search the osc dat block in figure (top left of the network), and modify its setting reflecting the one inside the ``__main__.py`` script.\n\n![Screenshot (30)](https://user-images.githubusercontent.com/25433493/123935613-ad406d80-d994-11eb-85df-7640365dee30.png)\n\ninside the const dat block named “params” (top left of the network) other settings can be modified, affecting the visuals, such as the midi note extensions of the various midi instruments, the size of the rendered notes, the vertical speed, etc..\n\n![Screenshot (31)](https://user-images.githubusercontent.com/25433493/123935633-b16c8b00-d994-11eb-8b5b-eeaa9bf83880.png)\n\nThe last change that you should do before enjoying the installation, regards the colours of the notes for each instrument. The three tex3d top blocks contain a reset pulse button that can be pressed for a random palette generation. Keep resetting the palettes until you find the best for your tastes.\n\n![Screenshot (32)](https://user-images.githubusercontent.com/25433493/123935657-b5001200-d994-11eb-9d74-75d951e29a78.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFedericoDiMarzo%2FMusesEchoes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFedericoDiMarzo%2FMusesEchoes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFedericoDiMarzo%2FMusesEchoes/lists"}