Tutorial: The Basics of Celody Modules

What are Modules:

Every Celody stream generates music in real-time according to specific logic. This logic is contained within a module. Modules allow you to focus on a specific musical direction inside a small, swappable unit of code. So if you want to change your direction, you just have to switch the module. Here's a good way to think of modules. Imagine you are building a machine to make fruit. Instead of building one giant machine that contains the messy logic to build all the fruit in the universe, you can build individual modules. You can build an apple module if you want to focus on apples. Or an orange module to focus on oranges. The key point is you can still make any fruit by swapping in the appropriate module, but each fruit is now easier to customize and maintain. Similarly, by specifying the module field in the celody file, you can customize how randomness affects the final stream according to your own desires.

Modules Definition

Modules as Oracles to Data:

A module can be connected to an external data source (a combination module-oracle). So you can set up a pipeline where the external data gets sent to the module and then the value of the data influences the pitch or tempo or volume or pan of the stream. This means that a music stream can be programmed using the time of day (SEE "TIMEOFDAY" MODULE) or weather or temperature or location (SEE "LOCATION" MODULE). In other words, the music in the stream can sound different at different times of day or when it's sunny vs. raining. You can also change the music based on how fast your car is driving (SEE "SPEED" MODULE) or how high your plane is flying (SEE "AIRPLANE" MODULE). You can even hook a module up to stock prices. For example, if the stock market is up, the stream can be programmed to speed up and if it's down, the stream can be slower and deeper. In summary, you can connect any data api provider as an input into the module.

External Data

Example Modules:

A module controls how the generative randomness (SEE TUTORIAL) gets translated into the final music stream. This means you have fine-tuned control over the different elements of a stream. Each module typically focuses on just one element. For example, the "SLOWDEEP" module focuses on making the stream slow & deep. Other modules focus on different features including: CHIPMUNK, DOWNHILL, UPHILL, SEESAW, NUTZO, TIGHT, TIMEOFDAY, WEEKEND, LOCATION, SPEED, AIRPLANE, and COMPASS. View the modules tab to see all the available choices and their descriptions.

Module Examples

Crypto Token Networks and Modules:

Celody already supports new features like micropayments to artists using cryptocurrency. It also supports "like staking" (SEE TUTORIAL). With modules you can connect music to crypto networks. For example, you can connect the balance of an address - so that a higher balance could change the tempo and a lower balance could change it differently. You can do the same thing with token prices or milestone numbers. The output of the crypto network can be used as an input into the music stream module.


How to Specify a Module:

You specify the stream's module in the Celody file. In the module parameter of the file, you enter the name of the module. If you don't enter a module, the stream will default to the "core".

Module File

How to Create a Module:

Every module is just computer code that can be swapped for another module. The code is all open source, so you can see how the module works. You can even write your own module to create new infinite music streams. The place to start is within the src folder of the github repo. You can fork the code of an existing module and modify it to suit your needs.

Create Modules