Developer Guide
User guide
  • JJazzLab
  • Build from source code
  • Getting started
  • Add a rhythm engine
  • API
    • Main modules
    • Data model
    • Javadoc API
Powered by GitBook
On this page
  • ## hyperlinks to be updated to https://github.com/jjazzboss/JJazzLab instead of deprecated JJazzLab-X
  • Architecture
  • Create your code
  • Main interfaces
  • RhythmProvider
  • Rhythm
  • RhythmVoice
  • RhythmParameter
  • MusicGenerator

Was this helpful?

Export as PDF

Add a rhythm engine

PreviousGetting startedNextMain modules

Last updated 1 year ago

Was this helpful?

## hyperlinks to be updated to instead of deprecated JJazzLab-X

Architecture

The main APIs you'll be using are found in the Rhythm and RhythmMusicGeneration modules:

  • Give JJazzLab-X access to one or more Rhythm objects provided by your engine

  • The main interface which provides descriptive information about the rhythm, with its RhythmVoices, and hythmParameters.

  • There is one RhythmVoice for each track generated by your rhythm, e.g. "Drums", "Bass", "Piano"

  • The parameters to modulate the rhythm, e.g. "Complexity" or "Fill"

Create your code

Your engine must be recognized by the JJazzLab framework, so that it can be accessible to the end-user. For this you'll need to start by adding a RhythmProvider implementation, as explained below.

Main interfaces

RhythmProvider

When user needs to pick up a rhythm, the rhythm selection dialog asks the RhythmDatabase to provide the available RhythmProvider instances (e.g. "Yamaha style based generator") and their list of rhythms (e.g. "jazz", "pop", ...).

The RhythmProvider implementation is responsible to provide:

  • An Info object (name, description, author, version, uniqueId)

  • The list of built-in Rhythm objects provided by this implementation

  • The list of file-based Rhythm objects provided by this implementation

  • An optional settings dialog to tune the rhythm generation engine

Rhythm

A Rhythm interface describes... a rhythm !

  • name, for example "samba-fast"

  • description

  • time signature

  • preferred tempo

  • feel : ternary/binary

  • etc...

It also defines the RhythmVoices, RhythmParameters.

The Rhythm implementation must also implement the MusicGenerator interface to be able to generate music.

RhythmVoice

There is one RhythmVoice for each track generated by this rhythm, e.g. "Drums", "Bass", "Piano". The RhythmVoiceprovides the recommended Midi instrument and settings for the track.

The RhythmVoices information is used for example by the Mix Console to display the relevant tracks.

RhythmParameter

Examples of RhythmParameters are "Variation", "Fill", or "Complexity".

The RhythmParameters are the control knobs given to the user so he can modulate the rhythm for each song part. You see them in the Song Structure Editor, for each Song Part.

There are ready-to-use classes to quickly define your RhythmParameters depending on their type (a boolean value, one value amongst a set of values, etc). When these classes are used the framework will automatically show the relevant UI widget in the Song Structure Editor. You can also define your own UI widgets if you prefer.

MusicGenerator

This is an interface which indicates the capability to generate rhythm music. It has just a single method which takes the music generation context as a parameter, and returns the musical phrases (one per track) that make the backing track.

When user presses the Play button for a given song, JJazzLab-X will:

  • If Rhythm implements the MusicGenerator interface, pass it the context data and ask it to generate the backing track

  • wait until the MusicGenerator has finished the music generation

  • convert the received music data into a Midi sequence

  • play the sequence.

So the MusicGenerator is really where the heavy stuff will be done by your engine. There is no synchronization constraint since JJazzLab will simply block until music generation is complete.

Note that you can use any technology to perform the generation, including non-Java ones. Only the lightweight API that connects to JJazzLab needs to be in Java.

A Rhythm implementation should also implement the MusicGenerator interface to be able to generate music

You should first create your own Netbeans module, as explained in the page.

The RhythmProvider interface is defined in the module.

Your implementation must use the @ServiceProvider annotation so that the RhythmDatabase instance can automatically find it upon startup. The general Netbeans mechanism used is described .

Example: See for a simple RhythmProvider implementation example.

Example: See for a very simple Rhythm implementation example.

prepare the (e.g. mainly a object which contains a and a )

Example: See for a very simple MusicGenerator implementation example.

RhythmProvider
Rhythm
MusicGenerator
RhythmVoice
RhythmParameter
Getting started
Rhythm
here
RhythmStubProviderImpl.java
RhythmStub.java
MusicGenerationContext
Song
ChordLeadSheet
SongStructure
DummyGenerator.java
https://github.com/jjazzboss/JJazzLab