QtCraft API C++ classes QML types Handbook

QcMusicComposer Class

Background music composed from a seed: a calm piece on a pentatonic scale with a melody of varied motifs (A A' B A), a slow bass line and soft held chords, ending on the root. More...

Header: #include <clientcore/sound/QcMusicComposer.h>

Public Types

struct Note
struct Piece
enum class Voice { Lead, Bass, Pad }

Static Public Members

const int barsPerPhrase
const int beatsPerBar
QcMusicComposer::Piece compose(quint64 seed)
double frequency(int midiPitch)
QcSampleBuffer render(const QcMusicComposer::Piece &piece, int sampleRate)
std::array<int, 5> scale(bool minor)

Detailed Description

Member Type Documentation

enum class QcMusicComposer::Voice

The instrument a note is played with.

ConstantValueDescription
QcMusicComposer::Voice::Lead0The melody
QcMusicComposer::Voice::Bass1The slow bass line
QcMusicComposer::Voice::Pad2The soft held chords

Member Function Documentation

[static] QcMusicComposer::Piece QcMusicComposer::compose(quint64 seed)

Returns the piece composed from seed; the same seed gives the same piece.

[static] double QcMusicComposer::frequency(int midiPitch)

Returns the frequency in Hz of MIDI note midiPitch (equal temperament, 69 = 440 Hz).

[static] QcSampleBuffer QcMusicComposer::render(const QcMusicComposer::Piece &piece, int sampleRate)

Returns piece rendered at sampleRate.

[static] std::array<int, 5> QcMusicComposer::scale(bool minor)

Returns the semitones above the root of the major (0 2 4 7 9) or, with minor, the minor (0 3 5 7 10) pentatonic scale.

Member Variable Documentation

const int QcMusicComposer::barsPerPhrase

Bars per phrase of the melody.

const int QcMusicComposer::beatsPerBar

Beats per bar.