GstBtToneConversion

GstBtToneConversion — helper class for tone unit conversion

Synopsis

struct              GstBtToneConversion;
enum                GstBtToneConversionTuning;
GstBtToneConversion * gstbt_tone_conversion_new         (GstBtToneConversionTuning tuning);
gdouble             gstbt_tone_conversion_translate_from_string
                                                        (GstBtToneConversion *self,
                                                         gchar *note);
gdouble             gstbt_tone_conversion_translate_from_number
                                                        (GstBtToneConversion *self,
                                                         guint note);
guint               gstbt_tone_conversion_note_string_2_number
                                                        (const gchar *note);
const gchar *       gstbt_tone_conversion_note_number_2_string
                                                        (guint note);

Object Hierarchy

  GObject
   +----GstBtToneConversion

Properties

  "tuning"                   GstBtToneConversionTuning  : Read / Write

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.

Details

struct GstBtToneConversion

struct GstBtToneConversion;

Opaque object instance.


enum GstBtToneConversionTuning

typedef enum {
  /* 12 tones with equal distance (equal temperament) */
  GSTBT_TONE_CONVERSION_CROMATIC=0,
  /* @todo: add more */
} GstBtToneConversionTuning;

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

GSTBT_TONE_CONVERSION_CROMATIC

12 tones with equal distance (equal temperament)

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.

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.

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.

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.

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).

note :

a musical note as number

Returns :

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

Property Details

The "tuning" property

  "tuning"                   GstBtToneConversionTuning  : Read / Write

selection frequency tuning table.

Default value: GSTBT_TONE_CONVERSION_CROMATIC