1. Getting started¶
To install Djalgo, run
pip install git+https://github.com/essicolo/djalgo.git
Djalgo comes battery excluded. Although optional, the following packages will be very useful in your music composition workflow with Djalgo.
pip install jupyterlab
to interact with your code in a notebookMusecore and
pip install music21
to render scores in the notebookpip install pretty-midi
to fine-tune and export your music to midi objectspip install scamp
to play music with sound fonts right from your notebookAlthough not ready yet, Djalgo’s AI is based on Tensorflow, so you will need to
pip install tensorflow
to train an AI on your music
Djalgo is designed to generate musical pieces as generic Python objects.
A note is defined as a tuple of (midi pitch, duration time, time offset from the start). A rest is a note with a pitch defined as
None
. A rhythm is the same thing of a note, but without pitch, i.e. a (duration, offset) tuple.A track is a list of notes.
A piece is a list of tracks.
Such objects can be converted to several music packages in Python, like Music21, Pretty-Midi, Mido and SCAMP.
To start with djalgo, install it then lauch your session by importing the package. The alias dj
will be used through the documentation.
[1]:
import djalgo as dj
Djalgo offera a range of functionalities designed for music composers and enthusiasts. Here’s a snapshot of what Djalgo brings to the table:
Analysis: Located in
analysis.py
, discover a suite of indices for dissecting tracks—whether it’s pitches, durations, or offsets. These metrics serve not just for analysis but also as benchmarks for the evolutionary algorithms found ingenetic.py
.Conversion:
conversion.py
is your gateway to integrating Djalgo with popular music packages. Transform notes and compositions into formats compatible with Music21 for notation, Pretty-Midi for MIDI refinements, and SCAMP for sound production. Installing these packages is a prerequisite for conversion.Fractals:
fractal.py
delves into the beauty of mathematics, extracting music from the intricate patterns of cellular automata and Mandelbrot fractals.Genetic Algorithms: Use
genetic.py
to evolve your music, steering it towards specific analytical targets defined inanalysis.py
.Harmony:
harmony.py
equips you with tools to enrich compositions with scales, voicings, and ornamental touches.Loop Visualization:
loop.py
helps visualize musical loops with radar plots, offering a new dimension to beat creation.Minimalism: Explore minimalist techniques in
minimalism.py
, from additive and subtractive processes to Arvo Pärt’s tintinnabuli, and craft music with a minimalist ethos.Rhythm: The
Rhythm
class inrhythm.py
is designed for crafting and experimenting with complex rhythmic structures.Utilities:
utils.py
provides essential tools for fine-tuning: repair, tune, and quantize your compositions to perfection.Random and Kernel Walks: In
walk.py
, let music wander through algorithmic paths, guided by random and kernel-induced walks.Machine learning: DJai is a work in progress, and does not behave as expected.
djai.py
is aimed at using machine learning to generate new music pieces, all powered by TensorFlow. DJai was designed to learn from any MIDI file, but if art your aim, you’d better create a machine that learns from your own compositions.
↳ To Harmonies