from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Iterable

if TYPE_CHECKING:
    from Live.Clip import Clip
    from Live.DrumPad import DrumPad
    from Live.SimplerDevice import SimplerDevice
    from Live.Song import Song
    from Live.Track import Track



class AudioToMidiType(int):
    harmony_to_midi: int = 0
    melody_to_midi: int = 1
    drums_to_midi: int = 2

def audio_to_midi_clip(song: Song | None, audio_clip: Clip | None, audio_to_midi_type: int | None, /) -> None:
    """
    Creates a MIDI clip in a new MIDI track with the notes extracted from the given
    audio_clip. The `audio_to_midi_type` decides which algorithm is used in
    the process. Raises error when called with an inconvertible clip or invalid
    `audio_to_midi_type`.
    """
    ...

def create_drum_rack_from_audio_clip(song: Song | None, audio_clip: Clip | None, /) -> None:
    """
    Creates a new track with a drum rack with a simpler on the first pad with
    the specified audio clip.
    """
    ...

def create_midi_track_from_drum_pad(song: Song | None, drum_pad: DrumPad | None, /) -> None:
    """Creates a new Midi track containing the specified Drum Pad's device chain."""
    ...

def create_midi_track_with_simpler(song: Song | None, audio_clip: Clip | None, /) -> None:
    """Creates a new Midi track with a simpler including the specified audio clip."""
    ...

def is_convertible_to_midi(song: Song | None, audio_clip: Clip | None, /) -> bool:
    """
    Returns whether `audio_clip` can be converted to MIDI.
    Raises error when called with a MIDI clip
    """
    ...

def move_devices_on_track_to_new_drum_rack_pad(song: Song | None, track_index: int | None, /) -> Track:
    """
    Moves the entire device chain of the track according to the track index
    onto the C1 (note 36) drum pad of a new drum rack in a new track.If the track associated with the track index does not contain any devices
    nothing changes (i.e. a new track and new drum rack are not created).
    """
    ...

def sliced_simpler_to_drum_rack(song: Song | None, simpler: SimplerDevice | None, /) -> None:
    """
    Converts the Simpler into a Drum Rack, assigning each slice to a drum pad.
    Calling it on a non-sliced simpler raises an error.
    """
    ...

__all__ = ['AudioToMidiType', 'audio_to_midi_clip', 'create_drum_rack_from_audio_clip', 'create_midi_track_from_drum_pad', 'create_midi_track_with_simpler', 'is_convertible_to_midi', 'move_devices_on_track_to_new_drum_rack_pad', 'sliced_simpler_to_drum_rack']
