GstBtToneConversion

GstBtToneConversion — helper class for tone unit conversion

Functions

Properties

Types and Values

Object Hierarchy

    GEnum
    ╰── GstBtToneConversionTuning
    GObject
    ╰── GstBtToneConversion

Includes

#include <libgstbuzztrax/toneconversion.h>

Description

An instance of this class can translate a musical note to a frequency, while taking a specific tuning into account. It also provides conversion betwen notes as numbers and strings.

Functions

gstbt_tone_conversion_new ()

GstBtToneConversion *
gstbt_tone_conversion_new (GstBtToneConversionTuning tuning);

Create a new instance of a note to frequency translator, that will use the given tuning .

Parameters

tuning

the GstBtToneConversionTuning to use

 

Returns

a new GstBtToneConversion translator


gstbt_tone_conversion_translate_from_string ()

gdouble
gstbt_tone_conversion_translate_from_string
                               (GstBtToneConversion *self,
                                gchar *note);

Converts the string representation of a musical note such as 'C-3' or 'd#4' to a frequency in Hz.

Parameters

self

a GstBtToneConversion

 

note

a musical note in string representation

 

Returns

the frequency of the note or 0.0 in case of an error


gstbt_tone_conversion_translate_from_number ()

gdouble
gstbt_tone_conversion_translate_from_number
                               (GstBtToneConversion *self,
                                guint note);

Converts the musical note number to a frequency in Hz.

Parameters

self

a GstBtToneConversion

 

note

a musical note (GstBtNote)

 

Returns

the frequency of the note or 0.0 in case of an error


gstbt_tone_conversion_note_string_2_number ()

guint
gstbt_tone_conversion_note_string_2_number
                               (const gchar *note);

Converts the string representation of a musical note such as 'C-3' or 'd#4' to a note number.

Parameters

note

a musical note in string representation

 

Returns

the note number or 0 in case of an error.


gstbt_tone_conversion_note_number_2_string ()

const gchar *
gstbt_tone_conversion_note_number_2_string
                               (guint note);

Converts the numerical number of a note to a string. A value of 1 for note represents 'c-0'. The highest supported value is 'b-9' (or 'h-9') which is 1+(9*16)+11 (1 octave has 12 tones, 4 are left unused for easy coding).

Parameters

note

a musical note as number

 

Returns

the note as string or an empty string in the case of an error.


gstbt_tone_conversion_note_number_offset ()

guint
gstbt_tone_conversion_note_number_offset
                               (guint note,
                                guint semitones);

Adds the given semitone offset to the given note number.

Parameters

note

a musical note as number

 

semitones

the semitone offset

 

Returns

the note plus a semitone offset

Types and Values

enum GstBtToneConversionTuning

Supported tuning types. see http://en.wikipedia.org/wiki/Musical_tuning

Members

GSTBT_TONE_CONVERSION_EQUAL_TEMPERAMENT

12 tones with equal distance

 

GSTBT_TONE_CONVERSION_JUST_INTONATION

12 tones with just intonation

 

GSTBT_TONE_CONVERSION_PYTHAGOREAN_TUNING

12 tones with pythagorean tuning

 

GSTBT_TONE_CONVERSION_COUNT

number of tunings

 

struct GstBtToneConversion

struct GstBtToneConversion;

Opaque object instance.

Property Details

The “tuning” property

  “tuning”                   GstBtToneConversionTuning

Harmonic tuning schema.

Owner: GstBtToneConversion

Flags: Read / Write

Default value: GSTBT_TONE_CONVERSION_EQUAL_TEMPERAMENT