16 changed files with 225 additions and 29 deletions
@ -0,0 +1,115 @@
|
||||
#!/usr/bin/python3 |
||||
|
||||
# @begin:license |
||||
# |
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de> |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 2 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License along |
||||
# with this program; if not, write to the Free Software Foundation, Inc., |
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
# |
||||
# @end:license |
||||
|
||||
import fractions |
||||
from typing import overload, Any, Union |
||||
|
||||
from google.protobuf import message as protobuf |
||||
|
||||
from noisicaa import value_types |
||||
from . import musical_time_pb2 |
||||
|
||||
|
||||
class PyMusicalDuration(value_types.ProtoValue): |
||||
@overload |
||||
def __init__(self) -> None: ... |
||||
@overload |
||||
def __init__(self, numerator: int, denominator: int) -> None: ... |
||||
@overload |
||||
def __init__(self, duration: PyMusicalDuration) -> None: ... |
||||
@overload |
||||
def __init__(self, duration: fractions.Fraction) -> None: ... |
||||
@overload |
||||
def __init__(self, duration: int) -> None: ... |
||||
def __hash__(self) -> int: ... |
||||
def __str__(self) -> str: ... |
||||
def __repr__(self) -> str: ... |
||||
def __getstate__(self) -> Any: ... |
||||
def __setstate__(self, state: Any) -> None: ... |
||||
@property |
||||
def numerator(self) -> int: ... |
||||
@property |
||||
def denominator(self) -> int: ... |
||||
@property |
||||
def fraction(self) -> fractions.Fraction: ... |
||||
def to_float(self) -> float: ... |
||||
def __bool__(self) -> bool: ... |
||||
def __eq__(self, other: Any) -> bool: ... |
||||
def __ne__(self, other: Any) -> bool: ... |
||||
def __gt__(self, other: PyMusicalDuration) -> bool: ... |
||||
def __ge__(self, other: PyMusicalDuration) -> bool: ... |
||||
def __le__(self, other: PyMusicalDuration) -> bool: ... |
||||
def __lt__(self, other: PyMusicalDuration) -> bool: ... |
||||
def __add__(self, other: PyMusicalDuration) -> PyMusicalDuration: ... |
||||
def __sub__(self, other: PyMusicalDuration) -> PyMusicalDuration: ... |
||||
def __mul__(self, other: Union[PyMusicalDuration, PyMusicalTime, fractions.Fraction, int]) -> PyMusicalDuration: ... |
||||
def __truediv__(self, other: Union[PyMusicalDuration, PyMusicalTime, fractions.Fraction, int]) -> PyMusicalDuration: ... |
||||
def __int__(self) -> int: ... |
||||
def __float__(self) -> float: ... |
||||
@classmethod |
||||
def from_proto(cls, pb: protobuf.Message) -> PyMusicalDuration: ... |
||||
def to_proto(self) -> musical_time_pb2.MusicalDuration: ... |
||||
|
||||
|
||||
class PyMusicalTime(value_types.ProtoValue): |
||||
@overload |
||||
def __init__(self) -> None: ... |
||||
@overload |
||||
def __init__(self, numerator: int, denominator: int) -> None: ... |
||||
@overload |
||||
def __init__(self, duration: PyMusicalTime) -> None: ... |
||||
@overload |
||||
def __init__(self, duration: fractions.Fraction) -> None: ... |
||||
@overload |
||||
def __init__(self, duration: int) -> None: ... |
||||
def __hash__(self) -> int: ... |
||||
def __str__(self) -> str: ... |
||||
def __repr__(self) -> str: ... |
||||
def __getstate__(self) -> Any: ... |
||||
def __setstate__(self, state: Any) -> None: ... |
||||
@property |
||||
def numerator(self) -> int: ... |
||||
@property |
||||
def denominator(self) -> int: ... |
||||
@property |
||||
def fraction(self) -> fractions.Fraction: ... |
||||
def to_float(self) -> float: ... |
||||
def __bool__(self) -> bool: ... |
||||
def __eq__(self, other: Any) -> bool: ... |
||||
def __ne__(self, other: Any) -> bool: ... |
||||
def __gt__(self, other: PyMusicalTime) -> bool: ... |
||||
def __ge__(self, other: PyMusicalTime) -> bool: ... |
||||
def __lt__(self, other: PyMusicalTime) -> bool: ... |
||||
def __le__(self, other: PyMusicalTime) -> bool: ... |
||||
def __add__(self, other: PyMusicalDuration) -> PyMusicalTime: ... |
||||
@overload |
||||
def __sub__(self, other: PyMusicalDuration) -> PyMusicalTime: ... |
||||
@overload |
||||
def __sub__(self, other: PyMusicalTime) -> PyMusicalDuration: ... |
||||
def __mul__(self, other: Union[PyMusicalDuration, PyMusicalTime, fractions.Fraction, int]) -> PyMusicalTime: ... |
||||
def __truediv__(self, other: Union[PyMusicalDuration, PyMusicalTime, fractions.Fraction, int]) -> PyMusicalTime: ... |
||||
def __mod__(self, other: Union[PyMusicalDuration, PyMusicalTime, fractions.Fraction, int]) -> PyMusicalTime: ... |
||||
def __int__(self) -> int: ... |
||||
def __float__(self) -> float: ... |
||||
@classmethod |
||||
def from_proto(cls, pb: protobuf.Message) -> PyMusicalTime: ... |
||||
def to_proto(self) -> musical_time_pb2.MusicalTime: ... |
@ -0,0 +1,41 @@
|
||||
# @begin:license |
||||
# |
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de> |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 2 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License along |
||||
# with this program; if not, write to the Free Software Foundation, Inc., |
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
# |
||||
# @end:license |
||||
|
||||
from typing import Iterator |
||||
from .musical_time import PyMusicalTime, PyMusicalDuration |
||||
from noisicaa import music |
||||
|
||||
|
||||
class PyTimeMapper(object): |
||||
bpm = ... # type: int |
||||
duration = ... # type: PyMusicalDuration |
||||
|
||||
def __init__(self, sample_rate: int) -> None: ... |
||||
def setup(self, project: music.BaseProject = None) -> None: ... |
||||
def cleanup(self) -> None: ... |
||||
@property |
||||
def end_time(self) -> PyMusicalTime: ... |
||||
@property |
||||
def num_samples(self) -> int: ... |
||||
def sample_to_musical_time(self, sample_time: int) -> PyMusicalTime: ... |
||||
def musical_to_sample_time(self, musical_time: PyMusicalTime) -> int: ... |
||||
def __iter__(self) -> Iterator[PyMusicalTime]: ... |
||||
def find(self, t: PyMusicalTime) -> Iterator[PyMusicalTime]: ... |
||||
|
Loading…
Reference in new issue