Messages Between Musebots - musebots/Musebots GitHub Wiki

The Protocol

Musebots communicate with each other using your computer's UDP ports. The conductor receives messages from local bots (that is, bots running on your computer) at port 7474. The musebots the conductor launches receive messages from the conductor on ports 7475 and up, respectively. The ports get allocated like this: the first bot the conductor launches receives on port 7475. The next bot the conductor launches listens at the next available port, so probably 7476. If you close down the bot on port 7475, it frees up that port, so the next bot to launch will use that one. Your musebot listens on port 7476 for messages from remote computers.

The Messages

The messages a musebot sends and understands are up to its developer. However, the messages use a common Open Sound Control syntax. Here is an example message: /broadcast/density myBotName 0.568.

/broadcast means the message comes from another musebot and is being broadcast to all the others in the framework. Right now, all messages from one musebot to another will have the /broadcast namespace, since no current musebots message each other individually - they all broadcast through the conductor.

/density describes the meaning of the message in terms of the sound this musebot is making. Its meaning depends completely on its usage convention. Right now, density tends to refer to something like spectral density - the amount of "space" in the sonic environment the musebot's activity is taking up. If your bot is receiving this description from another bot, you probably want to program it to react in some way.

myBotName is the name of the bot sending out the message. Since many bots may be sending messages describing their activities, the name tag lets you know which one is which, so your bot can, for example, tell the difference between a situation in which 5 other bots are all shouting at the top of their lungs vs the situation in which 4 other bots are present but quiet while 1 other is asserting itself loudly.

0.568 is the value of the message. Depending on the message description, it might send values in different formats. For example some messages send lists of integers describing MIDI notes. Others send lists of floats describing the loudnesses of different frequency bands. This message uses just a single float to articulate its point.

Some Common Descriptive Messages

  • /density: a float between 0. and 1. describing the amount of space a musebot is taking up in the conversation. Example: /broadcast/density myBotName 0.568.
  • /notepool: a list of numbers describing the pitches a musebot is playing right now, approximated as MIDI note numbers. Some bots send floats for greater accuracy. Others may only send integers. Example: /broadcast/density myBotName 54 30 86 0 4.5 7.84.