Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand some note and note expression doc #381

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions include/clap/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,36 @@ enum {
typedef struct clap_event_note {
clap_event_header_t header;

int32_t note_id; // -1 if unspecified, otherwise >=0
int16_t port_index;
int16_t channel; // 0..15
int16_t key; // 0..127
int32_t note_id; // host provided note id >= 0, or -1 if unspecified or wildcard
int16_t port_index; // port index from ext/note-ports; -1 for wildcard
int16_t channel; // 0..15, same as MIDI1 Channel Number, -1 for wildcard
int16_t key; // 0..127, same as MIDI1 Key Number (60==Middle C), -1 for wildcard
double velocity; // 0..1
} clap_event_note_t;

// Note Expressions are well named modifications of a voice targeted to
// voices using the same wildcard rules described above. Note Expressions are delivered
// as sample accurate events and should be applied at the sample when received.
//
// Note expressions are a statement of value, not cumulative. A PAN event of 0 followed by 1
// followed by 0.5 would pan hard left, hard right, and center. They are intended as
// an offset from the non-note-expression voice default. A voice which had a volume of
// -20db absent note expressions which received a +4db note expression would move the
// voice to -16db.
//
// A plugin which receives a note expression at the same sample as a NOTE_ON event
// should apply that expression to all generated samples. A plugin which receives
// a note expression after a NOTE_ON event should initiate the voice with default
// values and then apply the note expression when received. A plugin may make a choice
// to smooth note expression streams.
enum {
// with 0 < x <= 4, plain = 20 * log(x)
CLAP_NOTE_EXPRESSION_VOLUME = 0,

// pan, 0 left, 0.5 center, 1 right
CLAP_NOTE_EXPRESSION_PAN = 1,

// relative tuning in semitone, from -120 to +120
// relative tuning in semitone, from -120 to +120, in equal temperament
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change "semitone" to "semitones". In English "in" + unit usually has the unit in plural. For example "in kilos", "in dollars".

The "in equal temperament" could be read to imply that only integer values are expected. Perhaps just note something like: "delta_in_cents = 100 * x". That should be clear enough, since a 12EDO semitone is 100 cents.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see it has already been merged. You can discard this comment then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed in #382 to include it. If @abique is happy to merge it I am too.

CLAP_NOTE_EXPRESSION_TUNING = 2,

// 0..1
Expand Down