## AgsNote

AgsNote — Note class

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_NOTE_GET_OBJ_MUTEX()
GRecMutex * | ags_note_get_obj_mutex ()
gboolean | ags_note_test_flags ()
void | ags_note_set_flags ()
void | ags_note_unset_flags ()
gboolean | ags_note_test_key_format ()
void | ags_note_set_key_format ()
gint | ags_note_sort_func ()
gboolean | ags_note_get_is_minor ()
void | ags_note_set_is_minor ()
guint | ags_note_get_sharp_flats ()
void | ags_note_set_sharp_flats ()
guint | ags_note_get_x0 ()
void | ags_note_set_x0 ()
guint | ags_note_get_x1 ()
void | ags_note_set_x1 ()
guint | ags_note_get_y ()
void | ags_note_set_y ()
guint64 | ags_note_get_rt_offset ()
void | ags_note_set_rt_offset ()
guint | ags_note_get_rt_attack ()
void | ags_note_set_rt_attack ()
AgsComplex * | ags_note_get_attack ()
void | ags_note_set_attack ()
AgsComplex * | ags_note_get_sustain ()
void | ags_note_set_sustain ()
AgsComplex * | ags_note_get_decay ()
void | ags_note_set_decay ()
AgsComplex * | ags_note_get_release ()
void | ags_note_set_release ()
AgsComplex * | ags_note_get_ratio ()
void | ags_note_set_ratio ()
gboolean | ags_note_get_feed_x_256th ()
void | ags_note_set_feed_x_256th ()
guint | ags_note_get_x0_256th ()
void | ags_note_set_x0_256th ()
guint | ags_note_get_x1_256th ()
void | ags_note_set_x1_256th ()
GList * | ags_note_find_prev ()
GList * | ags_note_find_next ()
glong | ags_note_length_to_smf_delta_time ()
guint | ags_note_smf_delta_time_to_length ()
guchar * | ags_note_to_raw_midi ()
guchar * | ags_note_to_raw_midi_extended ()
snd_seq_event_t * | ags_note_to_seq_event ()
snd_seq_event_t * | ags_note_to_seq_event_extended ()
GList * | ags_note_from_raw_midi ()
GList * | ags_note_from_raw_midi_extended ()
GList * | ags_note_from_seq_event ()
GList * | ags_note_from_seq_event_extended ()
AgsNote * | ags_note_duplicate ()
AgsNote * | ags_note_from_string ()
gchar * | ags_note_to_string ()
AgsNote * | ags_note_new ()
AgsNote * | ags_note_new_with_offset ()

## Properties

AgsComplex * | attack | Read / Write
AgsComplex * | decay | Read / Write
gboolean | feed-x-256th | Read / Write
double | frequency | Read / Write
char * | note-name | Read / Write
AgsComplex * | ratio | Read / Write
AgsComplex * | release | Read / Write
guint | rt-attack | Read / Write
guint64 | rt-offset | Read / Write
double | stream-attack | Read / Write
double | stream-delay | Read / Write
guint64 | stream-frame-count | Read / Write
AgsComplex * | sustain | Read / Write
guint | x0 | Read / Write
guint | x0-256th | Read / Write
guint | x1 | Read / Write
guint | x1-256th | Read / Write
guint | y | Read / Write

## Types and Values

enum | AgsNoteFlags

## Object Hierarchy

        GObject
        ╰── AgsNote

## Includes

    #include <ags/audio/ags_note.h>

## Description

AgsNote represents a tone. The note object contains envelope information by specifying `attack`, `decay`, `sustain`, `release` and `ratio` properties as AgsComplex data type.

The real field of AgsComplex is the magnitude of the envelope and the imag field the relative offset. Raised by `ratio` real field amount.

## Functions

### AGS_NOTE_GET_OBJ_MUTEX()

    #define AGS_NOTE_GET_OBJ_MUTEX(obj) (&(((AgsNote *) obj)->obj_mutex))

### ags_note_get_obj_mutex ()

    GRecMutex *
    ags_note_get_obj_mutex (AgsNote *note);

Get object mutex.

#### Parameters

note | the AgsNote |

#### Returns

the GRecMutex to lock `note`

Since: 3.1.0

### ags_note_test_flags ()

    gboolean
    ags_note_test_flags (AgsNote *note,
                         AgsNoteFlags flags);

Test `flags` to be set on `note` .

#### Parameters

note | the AgsNote |
flags | the flags |

#### Returns

`TRUE` if flags are set, else `FALSE`

Since: 3.0.0

### ags_note_set_flags ()

    void
    ags_note_set_flags (AgsNote *note,
                        AgsNoteFlags flags);

Set `flags` on `note` .

#### Parameters

note | the AgsNote |
flags | the flags |

Since: 3.0.0

### ags_note_unset_flags ()

    void
    ags_note_unset_flags (AgsNote *note,
                          AgsNoteFlags flags);

Unset `flags` on `note` .

#### Parameters

note | the AgsNote |
flags | the flags |

Since: 3.0.0

### ags_note_test_key_format ()

    gboolean
    ags_note_test_key_format (AgsNote *note,
                              AgsSoundKeyFormat key_format);

Test `key_format` to be set on `note` .

#### Parameters

note | the AgsNote |
key_format | the key format |

#### Returns

`TRUE` if key format is set, else `FALSE`

Since: 6.2.0

### ags_note_set_key_format ()

    void
    ags_note_set_key_format (AgsNote *note,
                             AgsSoundKeyFormat key_format);

Set `key_format` on `note` .

#### Parameters

note | the AgsNote |
key_format | the key format |

Since: 6.2.0

### ags_note_sort_func ()

    gint
    ags_note_sort_func (gconstpointer a,
                        gconstpointer b);

Sort notes.

#### Parameters

a | the AgsNote |
b | another AgsNote |

#### Returns

0 if equal, -1 if smaller and 1 if bigger offset

Since: 3.0.0

### ags_note_get_is_minor ()

    gboolean
    ags_note_get_is_minor (AgsNote *note);

Gets is minor.

#### Parameters

note | the AgsNote |

#### Returns

is minor

Since: 3.1.0

### ags_note_set_is_minor ()

    void
    ags_note_set_is_minor (AgsNote *note,
                           gboolean is_minor);

Sets is minor.

#### Parameters

note | the AgsNote |
is_minor | is minor |

Since: 3.1.0

### ags_note_get_sharp_flats ()

    guint
    ags_note_get_sharp_flats (AgsNote *note);

Gets sharp flats.

#### Parameters

note | the AgsNote |

#### Returns

the sharp flats

Since: 3.1.0

### ags_note_set_sharp_flats ()

    void
    ags_note_set_sharp_flats (AgsNote *note,
                              guint sharp_flats);

Sets sharp flats.

#### Parameters

note | the AgsNote |
sharp_flats | the sharp flats |

Since: 3.1.0

### ags_note_get_x0 ()

    guint
    ags_note_get_x0 (AgsNote *note);

Gets x0.

#### Parameters

note | the AgsNote |

#### Returns

the x0

Since: 3.1.0

### ags_note_set_x0 ()

    void
    ags_note_set_x0 (AgsNote *note,
                     guint x0);

Sets x0.

#### Parameters

note | the AgsNote |
x0 | the x0 |

Since: 3.1.0

### ags_note_get_x1 ()

    guint
    ags_note_get_x1 (AgsNote *note);

Gets x1.

#### Parameters

note | the AgsNote |

#### Returns

the x1

Since: 3.1.0

### ags_note_set_x1 ()

    void
    ags_note_set_x1 (AgsNote *note,
                     guint x1);

Sets x1.

#### Parameters

note | the AgsNote |
x1 | the x1 |

Since: 3.1.0

### ags_note_get_y ()

    guint
    ags_note_get_y (AgsNote *note);

Gets y.

#### Parameters

note | the AgsNote |

#### Returns

the y

Since: 3.1.0

### ags_note_set_y ()

    void
    ags_note_set_y (AgsNote *note,
                    guint y);

Sets y.

#### Parameters

note | the AgsNote |
y | the y |

Since: 3.1.0

### ags_note_get_rt_offset ()

    guint64
    ags_note_get_rt_offset (AgsNote *note);

Gets rt-offset.

#### Parameters

note | the AgsNote |

#### Returns

the rt-offset

Since: 3.1.0

### ags_note_set_rt_offset ()

    void
    ags_note_set_rt_offset (AgsNote *note,
                            guint64 rt_offset);

Sets rt-offset.

#### Parameters

note | the AgsNote |
rt_offset | the rt-offset |

Since: 3.1.0

### ags_note_get_rt_attack ()

    guint
    ags_note_get_rt_attack (AgsNote *note);

Gets rt-attack.

#### Parameters

note | the AgsNote |

#### Returns

the rt-attack

Since: 3.1.0

### ags_note_set_rt_attack ()

    void
    ags_note_set_rt_attack (AgsNote *note,
                            guint rt_attack);

Sets rt-attack.

#### Parameters

note | the AgsNote |
rt_attack | the rt-attack |

Since: 3.1.0

### ags_note_get_attack ()

    AgsComplex *
    ags_note_get_attack (AgsNote *note);

Gets attack.

#### Parameters

note | the AgsNote |

#### Returns

the attack

Since: 3.1.0

### ags_note_set_attack ()

    void
    ags_note_set_attack (AgsNote *note,
                         AgsComplex *attack);

Sets attack.

#### Parameters

note | the AgsNote |
attack | the attack |

Since: 3.1.0

### ags_note_get_sustain ()

    AgsComplex *
    ags_note_get_sustain (AgsNote *note);

Gets sustain.

#### Parameters

note | the AgsNote |

#### Returns

the sustain

Since: 3.1.0

### ags_note_set_sustain ()

    void
    ags_note_set_sustain (AgsNote *note,
                          AgsComplex *sustain);

Sets sustain.

#### Parameters

note | the AgsNote |
sustain | the sustain |

Since: 3.1.0

### ags_note_get_decay ()

    AgsComplex *
    ags_note_get_decay (AgsNote *note);

Gets decay.

#### Parameters

note | the AgsNote |

#### Returns

the decay

Since: 3.1.0

### ags_note_set_decay ()

    void
    ags_note_set_decay (AgsNote *note,
                        AgsComplex *decay);

Sets decay.

#### Parameters

note | the AgsNote |
decay | the decay |

Since: 3.1.0

### ags_note_get_release ()

    AgsComplex *
    ags_note_get_release (AgsNote *note);

Gets release.

#### Parameters

note | the AgsNote |

#### Returns

the release

Since: 3.1.0

### ags_note_set_release ()

    void
    ags_note_set_release (AgsNote *note,
                          AgsComplex *release);

Sets release.

#### Parameters

note | the AgsNote |
release | the release |

Since: 3.1.0

### ags_note_get_ratio ()

    AgsComplex *
    ags_note_get_ratio (AgsNote *note);

Gets ratio.

#### Parameters

note | the AgsNote |

#### Returns

the ratio

Since: 3.1.0

### ags_note_set_ratio ()

    void
    ags_note_set_ratio (AgsNote *note,
                        AgsComplex *ratio);

Sets ratio.

#### Parameters

note | the AgsNote |
ratio | the ratio |

Since: 3.1.0

### ags_note_get_feed_x_256th ()

    gboolean
    ags_note_get_feed_x_256th (AgsNote *note);

Gets feed x as 256th.

#### Parameters

note | the AgsNote |

#### Returns

the feed x as 256th

Since: 6.1.0

### ags_note_set_feed_x_256th ()

    void
    ags_note_set_feed_x_256th (AgsNote *note,
                               gboolean feed_x_256th);

### ags_note_get_x0_256th ()

    guint
    ags_note_get_x0_256th (AgsNote *note);

Gets x0 as 256th.

#### Parameters

note | the AgsNote |

#### Returns

the x0 as 256th

Since: 6.1.0

### ags_note_set_x0_256th ()

    void
    ags_note_set_x0_256th (AgsNote *note,
                           guint x0_256th);

Sets x0 as 256th.

#### Parameters

note | the AgsNote |
x0_256th | the x0 as 256th |

Since: 6.1.0

### ags_note_get_x1_256th ()

    guint
    ags_note_get_x1_256th (AgsNote *note);

Gets x1 as 256th.

#### Parameters

note | the AgsNote |

#### Returns

the x1 as 256th

Since: 6.1.0

### ags_note_set_x1_256th ()

    void
    ags_note_set_x1_256th (AgsNote *note,
                           guint x1_256th);

Sets x1 as 256th.

#### Parameters

note | the AgsNote |
x1_256th | the x1 as 256th |

Since: 6.1.0

### ags_note_find_prev ()

    GList *
    ags_note_find_prev (GList *note,
                        guint x0,
                        guint y);

Find prev note having the same y offset.

#### Parameters

note | the GList containing AgsNote. | [element-type AgsAudio.Note][transfer none]
x0 | x offset |
y | y offset |

#### Returns

the matching entry as GList if first entry's x offset bigger than `x0` , else `NULL`.

[element-type AgsAudio.Note][transfer none]

Since: 3.0.0

### ags_note_find_next ()

    GList *
    ags_note_find_next (GList *note,
                        guint x0,
                        guint y);

Find next note having the same y offset.

#### Parameters

note | the GList containing AgsNote. | [element-type AgsAudio.Note][transfer none]
x0 | x offset |
y | y offset |

#### Returns

the matching entry as GList if last entry's x offset smaller than `x0` , else `NULL`.

[element-type AgsAudio.Note][transfer none]

Since: 3.0.0

### ags_note_length_to_smf_delta_time ()

    glong
    ags_note_length_to_smf_delta_time (guint note_length,
                                       gdouble bpm,
                                       gdouble delay_factor,
                                       glong nn,
                                       glong dd,
                                       glong cc,
                                       glong bb,
                                       glong tempo);

Convert note length to SMF delta-time.

#### Parameters

note_length | the note length to convert |
bpm | the source bpm |
delay_factor | the source delay factor |
nn | numerator |
dd | denominator |
cc | clocks |
bb | beats |
tempo | tempo |

#### Returns

the delta-time

Since: 3.0.0

### ags_note_smf_delta_time_to_length ()

    guint
    ags_note_smf_delta_time_to_length (glong delta_time,
                                       glong nn,
                                       glong dd,
                                       glong cc,
                                       glong bb,
                                       glong tempo,
                                       gdouble bpm,
                                       gdouble delay_factor);

Convert SMF delta-time to note length.

#### Parameters

delta_time | delta-time |
nn | numerator |
dd | denominator |
cc | clocks |
bb | beats |
tempo | tempo |
bpm | the target bpm |
delay_factor | the target delay factor |

#### Returns

the note length

Since: 3.0.0

### ags_note_to_raw_midi ()

    guchar *
    ags_note_to_raw_midi (AgsNote *note,
                          gdouble bpm,
                          gdouble delay_factor,
                          guint *buffer_length);

Convert `note` to raw MIDI and set the buffer length of returned bytes in the array as `buffer_length` .

#### Parameters

note | the AgsNote |
bpm | the bpm to use |
delay_factor | the segmentation delay factor |
buffer_length | the length of the returned buffer |

#### Returns

The sequencer raw midi as array.

Since: 3.0.0

### ags_note_to_raw_midi_extended ()

    guchar *
    ags_note_to_raw_midi_extended (AgsNote *note,
                                   gdouble bpm,
                                   gdouble delay_factor,
                                   glong nn,
                                   glong dd,
                                   glong cc,
                                   glong bb,
                                   glong tempo,
                                   guint *buffer_length);

Convert `note` to raw-midi.

#### Parameters

note | the AgsNote |
bpm | the source bpm |
delay_factor | the source delay factor |
nn | numerator |
dd | denominator |
cc | clocks |
bb | beats |
tempo | tempo |
buffer_length | the return location of buffer length |

#### Returns

the raw-midi buffer

Since: 3.0.0

### ags_note_to_seq_event ()

    snd_seq_event_t *
    ags_note_to_seq_event (AgsNote *note,
                           gdouble bpm,
                           gdouble delay_factor,
                           guint *n_events);

Convert `note` to ALSA sequencer events and set the number of events in the array as `n_events` .

#### Parameters

note | the AgsNote |
bpm | the bpm to use |
delay_factor | the segmentation delay factor |
n_events | the count of events |

#### Returns

The sequencer events as array.

[type gpointer][transfer none]

Since: 3.0.0

### ags_note_to_seq_event_extended ()

    snd_seq_event_t *
    ags_note_to_seq_event_extended (AgsNote *note,
                                    gdouble bpm,
                                    gdouble delay_factor,
                                    glong nn,
                                    glong dd,
                                    glong cc,
                                    glong bb,
                                    glong tempo,
                                    guint *n_events);

Convert `note` to raw-midi.

#### Parameters

note | the AgsNote |
bpm | the source bpm |
delay_factor | the source delay factor |
nn | numerator |
dd | denominator |
cc | clocks |
bb | beats |
tempo | tempo |
n_events | the return location of event count |

#### Returns

an array of snd_seq_event_t structs.

[type gpointer][transfer none]

Since: 3.0.0

### ags_note_from_raw_midi ()

    GList *
    ags_note_from_raw_midi (guchar *raw_midi,
                            gdouble bpm,
                            gdouble delay_factor,
                            guint length);

Parse `raw_midi` data and convert to AgsNote.

#### Parameters

raw_midi | the data array |
bpm | the bpm to use |
delay_factor | the segmentation delay factor |
length | the length of the array |

#### Returns

a GList containing the notes.

[element-type AgsAudio.Note][transfer full]

Since: 3.0.0

### ags_note_from_raw_midi_extended ()

    GList *
    ags_note_from_raw_midi_extended (guchar *raw_midi,
                                     glong nn,
                                     glong dd,
                                     glong cc,
                                     glong bb,
                                     glong tempo,
                                     gdouble bpm,
                                     gdouble delay_factor,
                                     guint length);

Parse `raw_midi` data and convert to AgsNote.

#### Parameters

raw_midi | the data array |
nn | numerator |
dd | denominator |
cc | clocks |
bb | beats |
tempo | tempo |
bpm | the bpm to use |
delay_factor | the segmentation delay factor |
length | the length of the array |

#### Returns

a GList containing the notes.

[element-type AgsAudio.Note][transfer full]

Since: 3.0.0

### ags_note_from_seq_event ()

    GList *
    ags_note_from_seq_event (snd_seq_event_t *event,
                             gdouble bpm,
                             gdouble delay_factor,
                             guint n_events);

Convert ALSA sequencer data `event` to AgsNote.

#### Parameters

event | ALSA sequencer events as array. | [type gpointer][transfer none]
bpm | the bpm to use |
delay_factor | the segmentation delay factor |
n_events | the arrays length |

#### Returns

a GList containing the notes.

[element-type AgsAudio.Note][transfer full]

Since: 3.0.0

### ags_note_from_seq_event_extended ()

    GList *
    ags_note_from_seq_event_extended (snd_seq_event_t *event,
                                      glong nn,
                                      glong dd,
                                      glong cc,
                                      glong bb,
                                      glong tempo,
                                      gdouble bpm,
                                      gdouble delay_factor,
                                      guint n_events);

Parse `raw_midi` data and convert to AgsNote.

#### Parameters

event | the snd_seq_event_t struct array. | [type gpointer][transfer none]
nn | numerator |
dd | denominator |
cc | clocks |
bb | beats |
tempo | tempo |
bpm | the bpm to use |
delay_factor | the segmentation delay factor |
n_events | the count snd_seq_event_t structs |

#### Returns

a GList containing the notes.

[element-type AgsAudio.Note][transfer full]

Since: 3.0.0

### ags_note_duplicate ()

    AgsNote *
    ags_note_duplicate (AgsNote *note);

Duplicate a note.

#### Parameters

note | the AgsNote |

#### Returns

the duplicated AgsNote.

[transfer full]

Since: 3.0.0

### ags_note_from_string ()

    AgsNote *
    ags_note_from_string (gchar *str);

Deserialize note.

#### Parameters

str | the string |

Since: 7.2.0

### ags_note_to_string ()

    gchar *
    ags_note_to_string (AgsNote *note);

Serialize note.

#### Parameters

note | the AgsNote |

Since: 7.2.0

### ags_note_new ()

    AgsNote *
    ags_note_new ();

Creates a new instance of AgsNote

#### Returns

the new AgsNote

Since: 3.0.0

### ags_note_new_with_offset ()

    AgsNote *
    ags_note_new_with_offset (guint x0,
                              guint x1,
                              guint y,
                              gdouble stream_delay,
                              gdouble stream_attack);

Creates a new instance of AgsNote

#### Parameters

x0 | x0 |
x1 | x1 |
y | y |
stream_delay | delay |
stream_attack | attack |

#### Returns

the new AgsNote

Since: 3.0.0

## Types and Values

### enum AgsNoteFlags

Enum values to control the behavior or indicate internal state of AgsNote by enable/disable as flags.

#### Members

AGS_NOTE_GUI | gui format |
AGS_NOTE_RUNTIME | runtime format |
AGS_NOTE_HUMAN_READABLE | human readable format |
AGS_NOTE_DEFAULT_LENGTH | default length |
AGS_NOTE_IS_SELECTED | is selected |
AGS_NOTE_FEED | feed note |
AGS_NOTE_ENVELOPE | do envelope |
AGS_NOTE_ENVELOPE_LFO | do envelope |

## Property Details

### The `“attack”` property

      “attack”                   AgsComplex *

Envelope attack.

Owner: AgsNote

Flags: Read / Write

Since: 3.0.0

### The `“decay”` property

      “decay”                    AgsComplex *

Envelope decay.

Owner: AgsNote

Flags: Read / Write

Since: 3.0.0

### The `“feed-x-256th”` property

      “feed-x-256th”             gboolean

Feed note x as 256th.

Owner: AgsNote

Flags: Read / Write

Default value: FALSE

Since: 6.1.0

### The `“frequency”` property

      “frequency”                double

The note's frequency.

Owner: AgsNote

Flags: Read / Write

Allowed values: >= 0

Default value: 0

Since: 3.0.0

### The `“note-name”` property

      “note-name”                char *

The note's name.

Owner: AgsNote

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“ratio”` property

      “ratio”                    AgsComplex *

Envelope ratio.

Owner: AgsNote

Flags: Read / Write

Since: 3.0.0

### The `“release”` property

      “release”                  AgsComplex *

Envelope release.

Owner: AgsNote

Flags: Read / Write

Since: 3.0.0

### The `“rt-attack”` property

      “rt-attack”                guint

Note realtime attack.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“rt-offset”` property

      “rt-offset”                guint64

Note realtime offset.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“stream-attack”` property

      “stream-attack”            double

The stream's attack.

Owner: AgsNote

Flags: Read / Write

Allowed values: >= 0

Default value: 0

Since: 3.0.0

### The `“stream-delay”` property

      “stream-delay”             double

The stream's delay.

Owner: AgsNote

Flags: Read / Write

Allowed values: >= 0

Default value: 0

Since: 3.0.0

### The `“stream-frame-count”` property

      “stream-frame-count”       guint64

The stream's frame count.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“sustain”` property

      “sustain”                  AgsComplex *

Envelope sustain.

Owner: AgsNote

Flags: Read / Write

Since: 3.0.0

### The `“x0”` property

      “x0”                       guint

Note offset x0.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“x0-256th”` property

      “x0-256th”                 guint

Note offset x0 as 256th.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 6.1.0

### The `“x1”` property

      “x1”                       guint

Note offset x1.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“x1-256th”` property

      “x1-256th”                 guint

Note offset x1 as 256th.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 6.1.0

### The `“y”` property

      “y”                        guint

Note offset y.

Owner: AgsNote

Flags: Read / Write

Default value: 0

Since: 3.0.0