Tune¶
- class mavsdk.tune.SongElement(value)¶
Bases:
Enum
An element of the tune
Values¶
- STYLE_LEGATO
After this element, start playing legato
- STYLE_NORMAL
After this element, start playing normal
- STYLE_STACCATO
After this element, start playing staccato
- DURATION_1
After this element, set the note duration to 1
- DURATION_2
After this element, set the note duration to 2
- DURATION_4
After this element, set the note duration to 4
- DURATION_8
After this element, set the note duration to 8
- DURATION_16
After this element, set the note duration to 16
- DURATION_32
After this element, set the note duration to 32
- NOTE_A
Play note A
- NOTE_B
Play note B
- NOTE_C
Play note C
- NOTE_D
Play note D
- NOTE_E
Play note E
- NOTE_F
Play note F
- NOTE_G
Play note G
- NOTE_PAUSE
Play a rest
- SHARP
After this element, sharp the note (half a step up)
- FLAT
After this element, flat the note (half a step down)
- OCTAVE_UP
After this element, shift the note 1 octave up
- OCTAVE_DOWN
After this element, shift the note 1 octave down
- DURATION_1 = 3¶
- DURATION_16 = 7¶
- DURATION_2 = 4¶
- DURATION_32 = 8¶
- DURATION_4 = 5¶
- DURATION_8 = 6¶
- FLAT = 18¶
- NOTE_A = 9¶
- NOTE_B = 10¶
- NOTE_C = 11¶
- NOTE_D = 12¶
- NOTE_E = 13¶
- NOTE_F = 14¶
- NOTE_G = 15¶
- NOTE_PAUSE = 16¶
- OCTAVE_DOWN = 20¶
- OCTAVE_UP = 19¶
- SHARP = 17¶
- STYLE_LEGATO = 0¶
- STYLE_NORMAL = 1¶
- STYLE_STACCATO = 2¶
- class mavsdk.tune.Tune(async_plugin_manager)¶
Bases:
AsyncBase
Enable creating and sending a tune to be played on the system.
Generated by dcsdkgen - MAVSDK Tune API
- name = 'Tune'¶
- async play_tune(tune_description)¶
Send a tune to be played by the system.
- Parameters:
tune_description (TuneDescription) – The tune to be played
- Raises:
TuneError – If the request fails. The error contains the reason for the failure.
- class mavsdk.tune.TuneDescription(song_elements, tempo)¶
Bases:
object
Tune description, containing song elements and tempo.
- Parameters:
song_elements ([SongElement]) – The list of song elements (notes, pauses, …) to be played
tempo (int32_t) – The tempo of the song (range: 32 - 255)
- exception mavsdk.tune.TuneError(result, origin, *params)¶
Bases:
Exception
Raised when a TuneResult is a fail code
- class mavsdk.tune.TuneResult(result, result_str)¶
Bases:
object
- Parameters:
result (Result) – Result enum value
result_str (std::string) – Human-readable English string describing the result
- class Result(value)¶
Bases:
Enum
Possible results returned for tune requests.
Values¶
- UNKNOWN
Unknown result
- SUCCESS
Request succeeded
- INVALID_TEMPO
Invalid tempo (range: 32 - 255)
- TUNE_TOO_LONG
Invalid tune: encoded string must be at most 247 chars
- ERROR
Failed to send the request
- NO_SYSTEM
No system connected
- ERROR = 4¶
- INVALID_TEMPO = 2¶
- NO_SYSTEM = 5¶
- SUCCESS = 1¶
- TUNE_TOO_LONG = 3¶
- UNKNOWN = 0¶