def Func(arg_0):
    '''Adds method f to the DataFrame class'''
    arg_1 = arg_0.__name__
    setattr(DataFrame, arg_1, arg_0)
    return arg_0


def Func(arg_0, arg_1, arg_2=True, arg_3=True):
    '''Returns an array where missing values are replaced by value.

    If the dtype is object, nan values and 'nan' string values
    are replaced by value when fill_nan==True.
    '''
    arg_0 = arg_0 if not isinstance(arg_0, column.Column) else arg_0.to_numpy()
    if arg_0.dtype.kind in 'O' and arg_2:
        arg_4 = arg_0.astype(str)
        arg_5 = arg_4 == 'nan'
        arg_0 = arg_0.copy()
        arg_0[arg_5] = arg_1
    elif arg_0.dtype.kind in 'f' and arg_2:
        arg_5 = np.isnan(arg_0)
        if np.any(arg_5):
            arg_0 = arg_0.copy()
            arg_0[arg_5] = arg_1
    if arg_3 and np.ma.isMaskedArray(arg_0):
        arg_5 = arg_0.mask
        if np.any(arg_5):
            arg_0 = arg_0.data.copy()
            arg_0[arg_5] = arg_1
    return arg_0


def Func(arg_0):
    """Obtain the day of the week with Monday=0 and Sunday=6

    :returns: an expression containing the day of week.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.dayofweek
    Expression = Func(date)
    Length: 3 dtype: int64 (expression)
    -----------------------------------
    0  0
    1  3
    2  3
    """
    import pandas as pd
    return pd.Series(arg_0).dt.dayofweek.values


def Func(arg_0):
    """The ordinal day of the year.

    :returns: an expression containing the ordinal day of the year.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.dayofyear
    Expression = Func(date)
    Length: 3 dtype: int64 (expression)
    -----------------------------------
    0  285
    1   42
    2  316
    """
    import pandas as pd
    return pd.Series(arg_0).dt.dayofyear.values


def Func(arg_0):
    """Extracts the month out of a datetime sample.

    :returns: an expression containing the month extracted from a datetime column.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.month
    Expression = Func(date)
    Length: 3 dtype: int64 (expression)
    -----------------------------------
    0  10
    1   2
    2  11
    """
    import pandas as pd
    return pd.Series(arg_0).dt.month.values


def Func(arg_0):
    """Returns the month names of a datetime sample in English.

    :returns: an expression containing the month names extracted from a datetime column.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.month_name
    Expression = Func(date)
    Length: 3 dtype: str (expression)
    ---------------------------------
    0   October
    1  February
    2  November
    """
    import pandas as pd
    return pd.Series(_pandas_dt_fix(arg_0)).dt.month_name().values.astype(str)


def Func(arg_0):
    """Returns the day names of a datetime sample in English.

    :returns: an expression containing the day names extracted from a datetime column.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.day_name
    Expression = Func(date)
    Length: 3 dtype: str (expression)
    ---------------------------------
    0    Monday
    1  Thursday
    2  Thursday
    """
    import pandas as pd
    return pd.Series(_pandas_dt_fix(arg_0)).dt.day_name().values.astype(str)


def Func(arg_0):
    """Returns the week ordinal of the year.

    :returns: an expression containing the week ordinal of the year, extracted from a datetime column.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.weekofyear
    Expression = Func(date)
    Length: 3 dtype: int64 (expression)
    -----------------------------------
    0  42
    1   6
    2  46
    """
    import pandas as pd
    return pd.Series(arg_0).dt.weekofyear.values


def Func(arg_0):
    """Extracts the hour out of a datetime samples.

    :returns: an expression containing the hour extracted from a datetime column.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.hour
    Expression = Func(date)
    Length: 3 dtype: int64 (expression)
    -----------------------------------
    0   3
    1  10
    2  11
    """
    import pandas as pd
    return pd.Series(arg_0).dt.hour.values


def Func(arg_0):
    """Extracts the minute out of a datetime samples.

    :returns: an expression containing the minute extracted from a datetime column.

    Example:

    >>> import vaex
    >>> import numpy as np
    >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64)
    >>> df = vaex.from_arrays(date=date)
    >>> df
      #  date
      0  2009-10-12 03:31:00
      1  2016-02-11 10:17:34
      2  2015-11-12 11:34:22

    >>> df.date.dt.minute
    Expression = Func(date)
    Length: 3 dtype: int64 (expression)
    -----------------------------------
    0  31
    1  17
    2  34
    """
    import pandas as pd
    return pd.Series(arg_0).dt.minute.values


def Func(arg_0):
    """Capitalize the first letter of a string sample.

    :returns: an expression containing the capitalized strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.capitalize()
    Expression = Func(text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0    Something
    1  Very pretty
    2    Is coming
    3          Our
    4         Way.
    """
    arg_1 = _to_string_sequence(arg_0).capitalize()
    return column.ColumnStringArrow(arg_1.bytes, arg_1.indices, arg_1.length, arg_1.offset, string_sequence=arg_1)


def Func(arg_0, arg_1):
    """Concatenate two string columns on a row-by-row basis.

    :param expression other: The expression of the other column to be concatenated.
    :returns: an expression containing the concatenated columns.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.cat(df.text)
    Expression = Func(text, text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0      SomethingSomething
    1  very prettyvery pretty
    2      is comingis coming
    3                  ourour
    4                way.way.
    """
    arg_2 = _to_string_sequence(arg_0)
    arg_3 = _to_string_sequence(arg_1)
    arg_4 = arg_2.concat(arg_3)
    return column.ColumnStringArrow.from_string_sequence(arg_4)


def Func(arg_0, arg_1, arg_2=True):
    """Check if a string pattern or regex is contained within a sample of a string column.

    :param str pattern: A string or regex pattern
    :param bool regex: If True,
    :returns: an expression which is evaluated to True if the pattern is found in a given sample, and it is False otherwise.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.contains('very')
    Expression = Func(text, 'very')
    Length: 5 dtype: bool (expression)
    ----------------------------------
    0  False
    1   True
    2  False
    3  False
    4  False
    """
    return _to_string_sequence(arg_0).search(arg_1, arg_2)


def Func(arg_0, arg_1, arg_2=False):
    """Count the occurences of a pattern in sample of a string column.

    :param str pat: A string or regex pattern
    :param bool regex: If True,
    :returns: an expression containing the number of times a pattern is found in each sample.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.count(pat="et", regex=False)
    Expression = Func(text, pat='et', regex=False)
    Length: 5 dtype: int64 (expression)
    -----------------------------------
    0  1
    1  1
    2  0
    3  0
    4  0
    """
    return _to_string_sequence(arg_0).count(arg_1, arg_2)


def Func(arg_0, arg_1, arg_2=0, arg_3=None):
    """Returns the lowest indices in each string in a column, where the provided substring is fully contained between within a
    sample. If the substring is not found, -1 is returned.

    :param str sub: A substring to be found in the samples
    :param int start:
    :param int end:
    :returns: an expression containing the lowest indices specifying the start of the substring.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.find(sub="et")
    Expression = Func(text, sub='et')
    Length: 5 dtype: int64 (expression)
    -----------------------------------
    0   3
    1   7
    2  -1
    3  -1
    4  -1
    """
    return _to_string_sequence(arg_0).find(arg_1, arg_2, 0 if arg_3 is None else arg_3, arg_3 is None, True)


def Func(arg_0):
    """Converts string samples to lower case.

    :returns: an expression containing the converted strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.lower()
    Expression = Func(text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0    something
    1  very pretty
    2    is coming
    3          our
    4         way.
    """
    arg_1 = _to_string_sequence(arg_0).lower()
    return column.ColumnStringArrow(arg_1.bytes, arg_1.indices, arg_1.length, arg_1.offset, string_sequence=arg_1)


def Func(arg_0, arg_1=None):
    """Remove leading characters from a string sample.

    :param str to_strip: The string to be removed
    :returns: an expression containing the modified string column.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.lstrip(to_strip='very ')
    Expression = Func(text, to_strip='very ')
    Length: 5 dtype: str (expression)
    ---------------------------------
    0  Something
    1     pretty
    2  is coming
    3        our
    4       way.
    """
    # in c++ we give empty string the same meaning as None
    arg_2 = _to_string_sequence(arg_0).lstrip('' if arg_1 is None else arg_1) if arg_1 != '' else arg_0
    return column.ColumnStringArrow(arg_2.bytes, arg_2.indices, arg_2.length, arg_2.offset, string_sequence=arg_2)


def Func(arg_0, arg_1, arg_2='left', arg_3=' '):
    """Pad strings in a given column.

    :param int width: The total width of the string
    :param str side: If 'left' than pad on the left, if 'right' than pad on the right side the string.
    :param str fillchar: The character used for padding.
    :returns: an expression containing the padded strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.pad(width=10, side='left', fillchar='!')
    Expression = Func(text, width=10, side='left', fillchar='!')
    Length: 5 dtype: str (expression)
    ---------------------------------
    0   !Something
    1  very pretty
    2   !is coming
    3   !!!!!!!our
    4   !!!!!!way.
    """
    arg_4 = _to_string_sequence(arg_0).pad(arg_1, arg_3, arg_2 in ['left', 'both'], arg_2 in ['right', 'both'])
    return column.ColumnStringArrow(arg_4.bytes, arg_4.indices, arg_4.length, arg_4.offset, string_sequence=arg_4)


def Func(arg_0, arg_1):
    """Duplicate each string in a column.

    :param int repeats: number of times each string sample is to be duplicated.
    :returns: an expression containing the duplicated strings

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.repeat(3)
    Expression = Func(text, 3)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0        SomethingSomethingSomething
    1  very prettyvery prettyvery pretty
    2        is comingis comingis coming
    3                          ourourour
    4                       way.way.way.
    """
    arg_2 = _to_string_sequence(arg_0).repeat(arg_1)
    return column.ColumnStringArrow(arg_2.bytes, arg_2.indices, arg_2.length, arg_2.offset, string_sequence=arg_2)


def Func(arg_0, arg_1, arg_2=0, arg_3=None):
    """Returns the highest indices in each string in a column, where the provided substring is fully contained between within a
    sample. If the substring is not found, -1 is returned.

    :param str sub: A substring to be found in the samples
    :param int start:
    :param int end:
    :returns: an expression containing the highest indices specifying the start of the substring.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.rfind(sub="et")
    Expression = Func(text, sub='et')
    Length: 5 dtype: int64 (expression)
    -----------------------------------
    0   3
    1   7
    2  -1
    3  -1
    4  -1
    """
    return _to_string_sequence(arg_0).find(arg_1, arg_2, 0 if arg_3 is None else arg_3, arg_3 is None, False)


def Func(arg_0, arg_1, arg_2=0, arg_3=None):
    """Returns the highest indices in each string in a column, where the provided substring is fully contained between within a
    sample. If the substring is not found, -1 is returned. Same as `str.rfind`.

    :param str sub: A substring to be found in the samples
    :param int start:
    :param int end:
    :returns: an expression containing the highest indices specifying the start of the substring.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.rindex(sub="et")
    Expression = Func(text, sub='et')
    Length: 5 dtype: int64 (expression)
    -----------------------------------
    0   3
    1   7
    2  -1
    3  -1
    4  -1
    """
    return str_rfind(arg_0, arg_1, arg_2, arg_3)


def Func(arg_0, arg_1, arg_2=' '):
    """Fills the left side of string samples with a specified character such that the strings are left-hand justified.

    :param int width: The minimal width of the strings.
    :param str fillchar: The character used for filling.
    :returns: an expression containing the filled strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.rjust(width=10, fillchar='!')
    Expression = Func(text, width=10, fillchar='!')
    Length: 5 dtype: str (expression)
    ---------------------------------
    0   !Something
    1  very pretty
    2   !is coming
    3   !!!!!!!our
    4   !!!!!!way.
    """
    arg_3 = _to_string_sequence(arg_0).pad(arg_1, arg_2, True, False)
    return column.ColumnStringArrow(arg_3.bytes, arg_3.indices, arg_3.length, arg_3.offset, string_sequence=arg_3)


def Func(arg_0, arg_1=None):
    """Remove trailing characters from a string sample.

    :param str to_strip: The string to be removed
    :returns: an expression containing the modified string column.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.rstrip(to_strip='ing')
    Expression = Func(text, to_strip='ing')
    Length: 5 dtype: str (expression)
    ---------------------------------
    0       Someth
    1  very pretty
    2       is com
    3          our
    4         way.
    """
    # in c++ we give empty string the same meaning as None
    arg_2 = _to_string_sequence(arg_0).rstrip('' if arg_1 is None else arg_1) if arg_1 != '' else arg_0
    return column.ColumnStringArrow(arg_2.bytes, arg_2.indices, arg_2.length, arg_2.offset, string_sequence=arg_2)


def Func(arg_0, arg_1=0, arg_2=None):  # TODO: support n
    """Slice substrings from each string element in a column.

    :param int start: The start position for the slice operation.
    :param int end: The stop position for the slice operation.
    :returns: an expression containing the sliced substrings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.slice(start=2, stop=5)
    Expression = str_pandas_slice(text, start=2, stop=5)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0  met
    1   ry
    2   co
    3    r
    4   y.
    """
    if arg_2 is None:
        arg_3 = _to_string_sequence(arg_0).slice_string_end(arg_1)
    else:
        arg_3 = _to_string_sequence(arg_0).slice_string(arg_1, arg_2)
    return arg_3


def Func(arg_0, arg_1=None):
    """Removes leading and trailing characters.

    Strips whitespaces (including new lines), or a set of specified
    characters from each string saple in a column, both from the left
    right sides.

    :param str to_strip: The characters to be removed. All combinations of the characters will be removed.
                         If None, it removes whitespaces.
    :param returns: an expression containing the modified string samples.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.strip(to_strip='very')
    Expression = Func(text, to_strip='very')
    Length: 5 dtype: str (expression)
    ---------------------------------
    0  Something
    1      prett
    2  is coming
    3         ou
    4       way.
    """
    # in c++ we give empty string the same meaning as None
    arg_2 = _to_string_sequence(arg_0).strip('' if arg_1 is None else arg_1) if arg_1 != '' else arg_0
    return column.ColumnStringArrow(arg_2.bytes, arg_2.indices, arg_2.length, arg_2.offset, string_sequence=arg_2)


def Func(arg_0):
    """Converts all string samples to titlecase.

    :returns: an expression containing the converted strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.title()
    Expression = Func(text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0    Something
    1  Very Pretty
    2    Is Coming
    3          Our
    4         Way.
    """
    arg_1 = _to_string_sequence(arg_0).title()
    return column.ColumnStringArrow(arg_1.bytes, arg_1.indices, arg_1.length, arg_1.offset, string_sequence=arg_1)


def Func(arg_0):
    """Converts all strings in a column to uppercase.

    :returns: an expression containing the converted strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.upper()
    Expression = Func(text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0    SOMETHING
    1  VERY PRETTY
    2    IS COMING
    3          OUR
    4         WAY.

    """
    arg_1 = _to_string_sequence(arg_0).upper()
    return column.ColumnStringArrow(arg_1.bytes, arg_1.indices, arg_1.length, arg_1.offset, string_sequence=arg_1)


def Func(arg_0, arg_1):
  """
    Writes a comment to the file in Java properties format.

    Newlines in the comment text are automatically turned into a continuation
    of the comment by adding a "#" to the beginning of each line.

    :param fh: a writable file-like object
    :param comment: comment string to write
  """
  _require_string(arg_1, 'comments')
  arg_0.write(_escape_comment(arg_1))
  arg_0.write(b'\n')


def Func(arg_0, arg_1=False):
  """
    Incrementally read properties from a Java .properties file.

    Yields tuples of key/value pairs.

    If ``comments`` is `True`, comments will be included with ``jprops.COMMENT``
    in place of the key.

    :param fh: a readable file-like object
    :param comments: should include comments (default: False)
  """
  for arg_2 in _property_lines(arg_0):
    arg_3, arg_4 = _split_key_value(arg_2)
    if arg_3 is not COMMENT:
      arg_3 = _unescape(arg_3)
    elif not arg_1:
      continue
    yield arg_3, _unescape(arg_4)


def Func():
    '''Return the version information for all librosa dependencies.'''

    arg_0 = ['audioread',
                 'numpy',
                 'scipy',
                 'sklearn',
                 'joblib',
                 'decorator',
                 'six',
                 'soundfile',
                 'resampy',
                 'numba']

    arg_1 = ['numpydoc',
                  'sphinx',
                  'sphinx_rtd_theme',
                  'sphinxcontrib.versioning',
                  'sphinx-gallery',
                  'pytest',
                  'pytest-mpl',
                  'pytest-cov',
                  'matplotlib']

    print('INSTALLED VERSIONS')
    print('------------------')
    print('python: {}\n'.format(sys.version))
    print('librosa: {}\n'.format(version))
    for arg_2 in arg_0:
        print('{}: {}'.format(arg_2, __get_mod_version(arg_2)))
    print('')
    for arg_2 in arg_1:
        print('{}: {}'.format(arg_2, __get_mod_version(arg_2)))
    pass


def Func(arg_0, arg_1, arg_2, arg_3,
              arg_4, arg_5):
    '''Handle renamed arguments.

    Parameters
    ----------
    old_name : str
    old_value
        The name and value of the old argument

    new_name : str
    new_value
        The name and value of the new argument

    version_deprecated : str
        The version at which the old name became deprecated

    version_removed : str
        The version at which the old name will be removed

    Returns
    -------
    value
        - `new_value` if `old_value` of type `Deprecated`
        - `old_value` otherwise

    Warnings
    --------
    if `old_value` is not of type `Deprecated`

    '''
    if isinstance(arg_1, Deprecated):
        return arg_3
    else:
        arg_6 = inspect.stack()
        arg_7 = arg_6[1]
        arg_8 = arg_6[2]

        warnings.warn_explicit("{:s}() keyword argument '{:s}' has been "
                               "renamed to '{:s}' in version {:}."
                               "\n\tThis alias will be removed in version "
                               "{:}.".format(arg_7[3],
                                             arg_0, arg_2,
                                             arg_4,
                                             arg_5),
                               category=DeprecationWarning,
                               filename=arg_8[1],
                               lineno=arg_8[2])

        return arg_1


def Func(arg_0=None):
    '''Set the FFT library used by librosa.

    Parameters
    ----------
    lib : None or module
        Must implement an interface compatible with `numpy.fft`.
        If `None`, reverts to `numpy.fft`.

    Examples
    --------
    Use `pyfftw`:

    >>> import pyfftw
    >>> librosa.Func(pyfftw.interfaces.numpy_fft)

    Reset to default `numpy` implementation

    >>> librosa.Func()

    '''

    global arg_1
    if arg_0 is None:
        from numpy import fft
        arg_0 = fft

    arg_1 = arg_0


def Func(arg_0, arg_1):
    '''Beat tracking function

    :parameters:
      - input_file : str
          Path to input audio file (wav, mp3, m4a, flac, etc.)

      - output_file : str
          Path to save beat event timestamps as a CSV file
    '''

    print('Loading ', arg_0)
    arg_2, arg_3 = librosa.load(arg_0, arg_3=22050)

    # Use a default hop size of 512 samples @ 22KHz ~= 23ms
    arg_4 = 512

    # This is the window length used by default in stft
    print('Tracking beats')
    arg_5, arg_6 = librosa.beat.Func(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)

    print('Estimated tempo: {:0.2f} beats per minute'.format(arg_5))

    # save output
    # 'beats' will contain the frame numbers of beat events.
    arg_7 = librosa.frames_to_time(arg_6, arg_3=arg_3, arg_4=arg_4)

    print('Saving output to ', arg_1)
    librosa.output.times_csv(arg_1, arg_7)
    print('done!')


def Func(arg_0, arg_1):
    '''Load audio, estimate tuning, apply pitch correction, and save.'''
    print('Loading ', arg_0)
    arg_2, arg_3 = librosa.load(arg_0)

    print('Separating harmonic component ... ')
    arg_4 = librosa.effects.harmonic(arg_2)

    print('Estimating tuning ... ')
    # Just track the pitches associated with high magnitude
    arg_5 = librosa.estimate_tuning(arg_2=arg_4, arg_3=arg_3)

    print('{:+0.2f} cents'.format(100 * arg_5))
    print('Applying pitch-correction of {:+0.2f} cents'.format(-100 * arg_5))
    arg_6 = librosa.effects.pitch_shift(arg_2, arg_3, -arg_5)

    print('Saving tuned audio to: ', arg_1)
    librosa.output.write_wav(arg_1, arg_6, arg_3)


def Func(arg_0, arg_1=True, arg_2=False):
    '''Convert one or more MIDI numbers to note strings.

    MIDI numbers will be rounded to the nearest integer.

    Notes will be of the format 'C0', 'C#0', 'D0', ...

    Examples
    --------
    >>> librosa.Func(0)
    'C-1'
    >>> librosa.Func(37)
    'C#2'
    >>> librosa.Func(-2)
    'A#-2'
    >>> librosa.Func(104.7)
    'A7'
    >>> librosa.Func(104.7, cents=True)
    'A7-30'
    >>> librosa.Func(list(range(12, 24)))
    ['C0', 'C#0', 'D0', 'D#0', 'E0', 'F0', 'F#0', 'G0', 'G#0', 'A0', 'A#0', 'B0']

    Parameters
    ----------
    midi : int or iterable of int
        Midi numbers to convert.

    octave: bool
        If True, include the octave number

    cents: bool
        If true, cent markers will be appended for fractional notes.
        Eg, `Func(69.3, cents=True)` == `A4+03`

    Returns
    -------
    notes : str or iterable of str
        Strings describing each midi note.

    Raises
    ------
    ParameterError
        if `cents` is True and `octave` is False

    See Also
    --------
    midi_to_hz
    note_to_midi
    hz_to_note
    '''

    if arg_2 and not arg_1:
        raise ParameterError('Cannot encode cents without octave information.')

    if not np.isscalar(arg_0):
        return [Func(arg_3, arg_1=arg_1, arg_2=arg_2) for arg_3 in arg_0]

    arg_4 = ['C', 'C#', 'D', 'D#',
                'E', 'F', 'F#', 'G',
                'G#', 'A', 'A#', 'B']

    arg_5 = int(np.round(arg_0))
    arg_6 = int(100 * np.around(arg_0 - arg_5, 2))

    arg_7 = arg_4[arg_5 % 12]

    if arg_1:
        arg_7 = '{:s}{:0d}'.format(arg_7, int(arg_5 / 12) - 1)
    if arg_2:
        arg_7 = '{:s}{:+02d}'.format(arg_7, arg_6)

    return arg_7


def Func(arg_0, arg_1=False):
    """Convert Hz to Mels

    Examples
    --------
    >>> librosa.Func(60)
    0.9
    >>> librosa.Func([110, 220, 440])
    array([ 1.65,  3.3 ,  6.6 ])

    Parameters
    ----------
    frequencies   : number or np.ndarray [shape=(n,)] , float
        scalar or array of frequencies
    htk           : bool
        use HTK formula instead of Slaney

    Returns
    -------
    mels        : number or np.ndarray [shape=(n,)]
        input frequencies in Mels

    See Also
    --------
    mel_to_hz
    """

    arg_0 = np.asanyarray(arg_0)

    if arg_1:
        return 2595.0 * np.log10(1.0 + arg_0 / 700.0)

    # Fill in the linear part
    arg_2 = 0.0
    arg_3 = 200.0 / 3

    arg_4 = (arg_0 - arg_2) / arg_3

    # Fill in the log-scale part

    arg_5 = 1000.0                         # beginning of log region (Hz)
    arg_6 = (arg_5 - arg_2) / arg_3   # same (Mels)
    arg_7 = np.log(6.4) / 27.0                # step size for log region

    if arg_0.ndim:
        # If we have array data, vectorize
        arg_8 = (arg_0 >= arg_5)
        arg_4[arg_8] = arg_6 + np.log(arg_0[arg_8]/arg_5) / arg_7
    elif arg_0 >= arg_5:
        # If we have scalar data, heck directly
        arg_4 = arg_6 + np.log(arg_0 / arg_5) / arg_7

    return arg_4


def Func(arg_0, arg_1=False):
    """Convert mel bin numbers to frequencies

    Examples
    --------
    >>> librosa.Func(3)
    200.

    >>> librosa.Func([1,2,3,4,5])
    array([  66.667,  133.333,  200.   ,  266.667,  333.333])

    Parameters
    ----------
    mels          : np.ndarray [shape=(n,)], float
        mel bins to convert
    htk           : bool
        use HTK formula instead of Slaney

    Returns
    -------
    frequencies   : np.ndarray [shape=(n,)]
        input mels in Hz

    See Also
    --------
    hz_to_mel
    """

    arg_0 = np.asanyarray(arg_0)

    if arg_1:
        return 700.0 * (10.0**(arg_0 / 2595.0) - 1.0)

    # Fill in the linear scale
    arg_2 = 0.0
    arg_3 = 200.0 / 3
    arg_4 = arg_2 + arg_3 * arg_0

    # And now the nonlinear scale
    arg_5 = 1000.0                         # beginning of log region (Hz)
    arg_6 = (arg_5 - arg_2) / arg_3   # same (Mels)
    arg_7 = np.log(6.4) / 27.0                # step size for log region

    if arg_0.ndim:
        # If we have vector data, vectorize
        arg_8 = (arg_0 >= arg_6)
        arg_4[arg_8] = arg_5 * np.exp(arg_7 * (arg_0[arg_8] - arg_6))
    elif arg_0 >= arg_6:
        # If we have scalar data, check directly
        arg_4 = arg_5 * np.exp(arg_7 * (arg_0 - arg_6))

    return arg_4


def Func(arg_0=22050, arg_1=2048):
    '''Alternative implementation of `np.fft.fftfreq`

    Parameters
    ----------
    sr : number > 0 [scalar]
        Audio sampling rate

    n_fft : int > 0 [scalar]
        FFT window size

    Returns
    -------
    freqs : np.ndarray [shape=(1 + n_fft/2,)]
        Frequencies `(0, sr/n_fft, 2*sr/n_fft, ..., sr/2)`

    Examples
    --------
    >>> librosa.Func(sr=22050, n_fft=16)
    array([     0.   ,   1378.125,   2756.25 ,   4134.375,
             5512.5  ,   6890.625,   8268.75 ,   9646.875,  11025.   ])

    '''

    return np.linspace(0,
                       float(arg_0) / 2,
                       int(1 + arg_1//2),
                       endpoint=True)


def Func(arg_0, arg_1=-80.0):     # pylint: disable=invalid-name
    '''Compute the A-weighting of a set of frequencies.

    Parameters
    ----------
    frequencies : scalar or np.ndarray [shape=(n,)]
        One or more frequencies (in Hz)

    min_db : float [scalar] or None
        Clip weights below this threshold.
        If `None`, no clipping is performed.

    Returns
    -------
    Func : scalar or np.ndarray [shape=(n,)]
        `Func[i]` is the A-weighting of `frequencies[i]`

    See Also
    --------
    perceptual_weighting

    Examples
    --------

    Get the A-weighting for CQT frequencies

    >>> import matplotlib.pyplot as plt
    >>> freqs = librosa.cqt_frequencies(108, librosa.note_to_hz('C1'))
    >>> aw = librosa.Func(freqs)
    >>> plt.plot(freqs, aw)
    >>> plt.xlabel('Frequency (Hz)')
    >>> plt.ylabel('Weighting (log10)')
    >>> plt.title('A-Weighting of CQT frequencies')

    '''

    # Vectorize to make our lives easier
    arg_0 = np.asanyarray(arg_0)

    # Pre-compute squared frequency
    arg_2 = arg_0**2.0

    arg_3 = np.array([12200, 20.6, 107.7, 737.9])**2.0

    arg_4 = 2.0 + 20.0 * (np.log10(arg_3[0]) + 4 * np.log10(arg_0)
                            - np.log10(arg_2 + arg_3[0])
                            - np.log10(arg_2 + arg_3[1])
                            - 0.5 * np.log10(arg_2 + arg_3[2])
                            - 0.5 * np.log10(arg_2 + arg_3[3]))

    if arg_1 is not None:
        arg_4 = np.maximum(arg_1, arg_4)

    return arg_4


def Func(arg_0, arg_1=22050, arg_2=512, arg_3=None, arg_4=-1):
    """Return an array of time values to match the time axis from a feature matrix.

    Parameters
    ----------
    X : np.ndarray or scalar
        - If ndarray, X is a feature matrix, e.g. STFT, chromagram, or mel spectrogram.
        - If scalar, X represents the number of frames.

    sr : number > 0 [scalar]
        audio sampling rate

    hop_length : int > 0 [scalar]
        number of samples between successive frames

    n_fft : None or int > 0 [scalar]
        Optional: length of the FFT window.
        If given, time conversion will include an offset of `n_fft / 2`
        to counteract windowing effects when using a non-centered STFT.

    axis : int [scalar]
        The axis representing the time axis of X.
        By default, the last axis (-1) is taken.

    Returns
    -------
    times : np.ndarray [shape=(n,)]
        ndarray of times (in seconds) corresponding to each frame of X.

    See Also
    --------
    samples_like : Return an array of sample indices to match the time axis from a feature matrix.

    Examples
    --------
    Provide a feature matrix input:

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> X = librosa.stft(y)
    >>> times = librosa.Func(X)
    >>> times
    array([  0.00000000e+00,   2.32199546e-02,   4.64399093e-02, ...,
             6.13935601e+01,   6.14167800e+01,   6.14400000e+01])

    Provide a scalar input:

    >>> n_frames = 2647
    >>> times = librosa.Func(n_frames)
    >>> times
    array([  0.00000000e+00,   2.32199546e-02,   4.64399093e-02, ...,
             6.13935601e+01,   6.14167800e+01,   6.14400000e+01])
    """
    arg_5 = samples_like(arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)
    return samples_to_time(arg_5, arg_1=arg_1)


def Func(arg_0, arg_1=512, arg_2=None, arg_3=-1):
    """Return an array of sample indices to match the time axis from a feature matrix.

    Parameters
    ----------
    X : np.ndarray or scalar
        - If ndarray, X is a feature matrix, e.g. STFT, chromagram, or mel spectrogram.
        - If scalar, X represents the number of frames.

    hop_length : int > 0 [scalar]
        number of samples between successive frames

    n_fft : None or int > 0 [scalar]
        Optional: length of the FFT window.
        If given, time conversion will include an offset of `n_fft / 2`
        to counteract windowing effects when using a non-centered STFT.

    axis : int [scalar]
        The axis representing the time axis of X.
        By default, the last axis (-1) is taken.

    Returns
    -------
    samples : np.ndarray [shape=(n,)]
        ndarray of sample indices corresponding to each frame of X.

    See Also
    --------
    times_like : Return an array of time values to match the time axis from a feature matrix.

    Examples
    --------
    Provide a feature matrix input:

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> X = librosa.stft(y)
    >>> samples = librosa.Func(X)
    >>> samples
    array([      0,     512,    1024, ..., 1353728, 1354240, 1354752])

    Provide a scalar input:

    >>> n_frames = 2647
    >>> samples = librosa.Func(n_frames)
    >>> samples
    array([      0,     512,    1024, ..., 1353728, 1354240, 1354752])
    """
    if np.isscalar(arg_0):
        arg_4 = np.arange(arg_0)
    else:
        arg_4 = np.arange(arg_0.shape[arg_3])
    return frames_to_samples(arg_4, arg_1=arg_1, arg_2=arg_2)


def Func(arg_0, arg_1=22050, arg_2=512, arg_3=None, arg_4=84,
               arg_5=12, arg_6=0.0, arg_7=1,
               arg_8=1, arg_9=0.01, arg_10='hann', arg_11=True,
               arg_12='reflect', arg_13=None):
    '''Compute the hybrid constant-Q transform of an audio signal.

    Here, the hybrid CQT uses the pseudo CQT for higher frequencies where
    the hop_length is longer than half the filter length and the full CQT
    for lower frequencies.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series

    sr : number > 0 [scalar]
        sampling rate of `y`

    hop_length : int > 0 [scalar]
        number of samples between successive CQT columns.

    fmin : float > 0 [scalar]
        Minimum frequency. Defaults to C1 ~= 32.70 Hz

    n_bins : int > 0 [scalar]
        Number of frequency bins, starting at `fmin`

    bins_per_octave : int > 0 [scalar]
        Number of bins per octave

    tuning : None or float in `[-0.5, 0.5)`
        Tuning offset in fractions of a bin (cents).

        If `None`, tuning will be automatically estimated from the signal.

    filter_scale : float > 0
        Filter filter_scale factor. Larger values use longer windows.

    sparsity : float in [0, 1)
        Sparsify the CQT basis by discarding up to `sparsity`
        fraction of the energy in each basis.

        Set `sparsity=0` to disable sparsification.

    window : str, tuple, number, or function
        Window specification for the basis filters.
        See `filters.get_window` for details.

    pad_mode : string
        Padding mode for centered frame analysis.

        See also: `librosa.core.stft` and `np.pad`.

    res_type : string
        Resampling mode.  See `librosa.core.cqt` for details.

    Returns
    -------
    CQT : np.ndarray [shape=(n_bins, t), dtype=np.float]
        Constant-Q energy for each frequency at each time.

    Raises
    ------
    ParameterError
        If `hop_length` is not an integer multiple of
        `2**(n_bins / bins_per_octave)`

        Or if `y` is too short to support the frequency range of the CQT.

    See Also
    --------
    cqt
    pseudo_cqt

    Notes
    -----
    This function caches at level 20.

    '''

    if arg_3 is None:
        # C1 by default
        arg_3 = note_to_hz('C1')

    if arg_6 is None:
        arg_6 = estimate_tuning(arg_0=arg_0, arg_1=arg_1)

    # Get all CQT frequencies
    arg_14 = cqt_frequencies(arg_4, arg_3,
                            arg_5=arg_5,
                            arg_6=arg_6)

    # Compute the length of each constant-Q basis function
    arg_15 = filters.constant_q_lengths(arg_1, arg_3,
                                         arg_4=arg_4,
                                         arg_5=arg_5,
                                         arg_6=arg_6,
                                         arg_7=arg_7,
                                         arg_10=arg_10)

    # Determine which filters to use with Pseudo CQT
    # These are the ones that fit within 2 hop lengths after padding
    arg_16 = 2.0**np.ceil(np.log2(arg_15)) < 2 * arg_2

    arg_17 = int(np.sum(arg_16))

    arg_18 = arg_4 - arg_17
    arg_19 = []

    if arg_17 > 0:
        arg_20 = np.min(arg_14[arg_16])

        arg_19.append(pseudo_cqt(arg_0, arg_1,
                                   arg_2=arg_2,
                                   arg_3=arg_20,
                                   arg_4=arg_17,
                                   arg_5=arg_5,
                                   arg_6=arg_6,
                                   arg_7=arg_7,
                                   arg_8=arg_8,
                                   arg_9=arg_9,
                                   arg_10=arg_10,
                                   arg_11=arg_11,
                                   arg_12=arg_12))

    if arg_18 > 0:
        arg_19.append(np.abs(cqt(arg_0, arg_1,
                                   arg_2=arg_2,
                                   arg_3=arg_3,
                                   arg_4=arg_18,
                                   arg_5=arg_5,
                                   arg_6=arg_6,
                                   arg_7=arg_7,
                                   arg_8=arg_8,
                                   arg_9=arg_9,
                                   arg_10=arg_10,
                                   arg_11=arg_11,
                                   arg_12=arg_12,
                                   arg_13=arg_13)))

    return __trim_stack(arg_19, arg_4)


def Func(arg_0, arg_1=22050, arg_2=512, arg_3=None, arg_4=84,
               arg_5=12, arg_6=0.0, arg_7=1,
               arg_8=1, arg_9=0.01, arg_10='hann', arg_11=True,
               arg_12='reflect'):
    '''Compute the pseudo constant-Q transform of an audio signal.

    This uses a single fft size that is the smallest power of 2 that is greater
    than or equal to the max of:

        1. The longest CQT filter
        2. 2x the hop_length

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series

    sr : number > 0 [scalar]
        sampling rate of `y`

    hop_length : int > 0 [scalar]
        number of samples between successive CQT columns.

    fmin : float > 0 [scalar]
        Minimum frequency. Defaults to C1 ~= 32.70 Hz

    n_bins : int > 0 [scalar]
        Number of frequency bins, starting at `fmin`

    bins_per_octave : int > 0 [scalar]
        Number of bins per octave

    tuning : None or float in `[-0.5, 0.5)`
        Tuning offset in fractions of a bin (cents).

        If `None`, tuning will be automatically estimated from the signal.

    filter_scale : float > 0
        Filter filter_scale factor. Larger values use longer windows.

    sparsity : float in [0, 1)
        Sparsify the CQT basis by discarding up to `sparsity`
        fraction of the energy in each basis.

        Set `sparsity=0` to disable sparsification.

    window : str, tuple, number, or function
        Window specification for the basis filters.
        See `filters.get_window` for details.

    pad_mode : string
        Padding mode for centered frame analysis.

        See also: `librosa.core.stft` and `np.pad`.

    Returns
    -------
    CQT : np.ndarray [shape=(n_bins, t), dtype=np.float]
        Pseudo Constant-Q energy for each frequency at each time.

    Raises
    ------
    ParameterError
        If `hop_length` is not an integer multiple of
        `2**(n_bins / bins_per_octave)`

        Or if `y` is too short to support the frequency range of the CQT.

    Notes
    -----
    This function caches at level 20.

    '''

    if arg_3 is None:
        # C1 by default
        arg_3 = note_to_hz('C1')

    if arg_6 is None:
        arg_6 = estimate_tuning(arg_0=arg_0, arg_1=arg_1)

    arg_13, arg_14, arg_15 = __cqt_filter_fft(arg_1, arg_3, arg_4,
                                           arg_5,
                                           arg_6, arg_7,
                                           arg_8, arg_9,
                                           arg_2=arg_2,
                                           arg_10=arg_10)

    arg_13 = np.abs(arg_13)

    # Compute the magnitude STFT with Hann window
    arg_16 = np.abs(stft(arg_0, arg_14=arg_14, arg_2=arg_2, arg_12=arg_12))

    # Project onto the pseudo-cqt basis
    arg_17 = arg_13.dot(arg_16)

    if arg_11:
        arg_17 /= np.sqrt(arg_14)
    else:
        arg_18 = filters.constant_q_lengths(arg_1, arg_3,
                                             arg_4=arg_4,
                                             arg_5=arg_5,
                                             arg_6=arg_6,
                                             arg_10=arg_10,
                                             arg_7=arg_7)

        arg_17 *= np.sqrt(arg_18[:, np.newaxis] / arg_14)

    return arg_17


def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                     arg_5, arg_6, arg_7, arg_8=None,
                     arg_9='hann'):
    '''Generate the frequency domain constant-Q filter basis.'''

    arg_10, arg_11 = filters.constant_q(arg_0,
                                        arg_1=arg_1,
                                        arg_2=arg_2,
                                        arg_3=arg_3,
                                        arg_4=arg_4,
                                        arg_5=arg_5,
                                        arg_6=arg_6,
                                        pad_fft=True,
                                        arg_9=arg_9)

    # Filters are padded up to the nearest integral power of 2
    arg_12 = arg_10.shape[1]

    if (arg_8 is not None and
            arg_12 < 2.0**(1 + np.ceil(np.log2(arg_8)))):

        arg_12 = int(2.0 ** (1 + np.ceil(np.log2(arg_8))))

    # re-normalize bases with respect to the FFT window length
    arg_10 *= arg_11[:, np.newaxis] / float(arg_12)

    # FFT and retain only the non-negative frequencies
    arg_13 = get_fftlib()
    arg_14 = arg_13.fft(arg_10, n=arg_12, axis=1)[:, :(arg_12 // 2)+1]

    # sparsify the basis
    arg_14 = util.sparsify_rows(arg_14, quantile=arg_7)

    return arg_14, arg_12, arg_11


def Func(arg_0, arg_1):
    '''Helper function to trim and stack a collection of CQT responses'''

    # cleanup any framing errors at the boundaries
    arg_2 = min(x.shape[1] for x in arg_0)

    arg_0 = np.vstack([x[:, :arg_2] for x in arg_0][::-1])

    # Finally, clip out any bottom frequencies that we don't really want
    # Transpose magic here to ensure column-contiguity
    return np.ascontiguousarray(arg_0[-arg_1:].T).T


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    '''Compute the filter response with a target STFT hop.'''

    # Compute the STFT matrix
    arg_5 = stft(arg_0, arg_1=arg_1, arg_2=arg_2,
             window='ones',
             pad_mode=arg_4)

    # And filter response energy
    return arg_3.dot(arg_5)


def Func(arg_0, arg_1, arg_2, arg_3):
    '''Compute the number of early downsampling operations'''

    arg_4 = max(0, int(np.ceil(np.log2(audio.BW_FASTEST * arg_0 /
                                                   arg_1)) - 1) - 1)

    arg_5 = __num_two_factors(arg_2)
    arg_6 = max(0, arg_5 - arg_3 + 1)

    return min(arg_4, arg_6)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                       arg_5, arg_6, arg_7):
    '''Perform early downsampling on an audio signal, if it applies.'''

    arg_8 = Func_count(arg_5, arg_6,
                                                arg_2, arg_4)

    if arg_8 > 0 and arg_3 == 'kaiser_fast':
        arg_9 = 2**(arg_8)

        arg_2 //= arg_9

        if len(arg_0) < arg_9:
            raise ParameterError('Input signal length={:d} is too short for '
                                 '{:d}-octave CQT'.format(len(arg_0), arg_4))

        arg_10 = arg_1 / float(arg_9)
        arg_0 = audio.resample(arg_0, arg_1, arg_10,
                           arg_3=arg_3,
                           arg_7=True)

        # If we're not going to length-scale after CQT, we
        # need to compensate for the downsampling factor here
        if not arg_7:
            arg_0 *= np.sqrt(arg_9)

        arg_1 = arg_10

    return arg_0, arg_1, arg_2


def Func(arg_0, arg_1, arg_2, arg_3,
                         arg_4, arg_5, arg_6, arg_7):  # pragma: no cover
    '''Calculate the accumulated cost matrix D.

    Use dynamic programming to calculate the accumulated costs.

    Parameters
    ----------
    C : np.ndarray [shape=(N, M)]
        pre-computed cost matrix

    D : np.ndarray [shape=(N, M)]
        accumulated cost matrix

    D_steps : np.ndarray [shape=(N, M)]
        steps which were used for calculating D

    step_sizes_sigma : np.ndarray [shape=[n, 2]]
        Specifies allowed step sizes as used by the dtw.

    weights_add : np.ndarray [shape=[n, ]]
        Additive weights to penalize certain step sizes.

    weights_mul : np.ndarray [shape=[n, ]]
        Multiplicative weights to penalize certain step sizes.

    max_0 : int
        maximum number of steps in step_sizes_sigma in dim 0.

    max_1 : int
        maximum number of steps in step_sizes_sigma in dim 1.

    Returns
    -------
    D : np.ndarray [shape=(N,M)]
        accumulated cost matrix.
        D[N,M] is the total alignment cost.
        When doing subsequence DTW, D[N,:] indicates a matching function.

    D_steps : np.ndarray [shape=(N,M)]
        steps which were used for calculating D.

    See Also
    --------
    dtw
    '''
    for arg_8 in range(arg_6, arg_1.shape[0]):
        for arg_9 in range(arg_7, arg_1.shape[1]):
            # accumulate costs
            for arg_10, arg_11, arg_12 in zip(range(arg_3.shape[0]),
                                                          arg_5, arg_4):
                arg_13 = arg_1[arg_8 - arg_3[arg_10, 0],
                          arg_9 - arg_3[arg_10, 1]]
                arg_14 = arg_12 * arg_0[arg_8 - arg_6, arg_9 - arg_7]
                arg_14 += arg_11
                arg_15 = arg_13 + arg_14

                # check if cur_cost is smaller than the one stored in D
                if arg_15 < arg_1[arg_8, arg_9]:
                    arg_1[arg_8, arg_9] = arg_15

                    # save step-index
                    arg_2[arg_8, arg_9] = arg_10

    return arg_1, arg_2


def Func(arg_0, arg_1):  # pragma: no cover
    '''Backtrack optimal warping path.

    Uses the saved step sizes from the cost accumulation
    step to backtrack the index pairs for an optimal
    warping path.

    Parameters
    ----------
    D_steps : np.ndarray [shape=(N, M)]
        Saved indices of the used steps used in the calculation of D.

    step_sizes_sigma : np.ndarray [shape=[n, 2]]
        Specifies allowed step sizes as used by the dtw.

    Returns
    -------
    wp : list [shape=(N,)]
        Warping path with index pairs.
        Each list entry contains an index pair
        (n,m) as a tuple

    See Also
    --------
    dtw
    '''
    arg_2 = []
    # Set starting point D(N,M) and append it to the path
    arg_3 = (arg_0.shape[0] - 1, arg_0.shape[1] - 1)
    arg_2.append((arg_3[0], arg_3[1]))

    # Loop backwards.
    # Stop criteria:
    # Setting it to (0, 0) does not work for the subsequence dtw,
    # so we only ask to reach the first row of the matrix.
    while arg_3[0] > 0:
        arg_4 = arg_0[(arg_3[0], arg_3[1])]

        # save tuple with minimal acc. cost in path
        arg_3 = (arg_3[0] - arg_1[arg_4][0],
                   arg_3[1] - arg_1[arg_4][1])

        # append to warping path
        arg_2.append((arg_3[0], arg_3[1]))

    return arg_2


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):  # pragma: no cover
    '''Core Viterbi algorithm.

    This is intended for internal use only.

    Parameters
    ----------
    log_prob : np.ndarray [shape=(T, m)]
        `log_prob[t, s]` is the conditional log-likelihood
        log P[X = X(t) | State(t) = s]

    log_trans : np.ndarray [shape=(m, m)]
        The log transition matrix
        `log_trans[i, j]` = log P[State(t+1) = j | State(t) = i]

    log_p_init : np.ndarray [shape=(m,)]
        log of the initial state distribution

    state : np.ndarray [shape=(T,), dtype=int]
        Pre-allocated state index array

    value : np.ndarray [shape=(T, m)] float
        Pre-allocated value array

    ptr : np.ndarray [shape=(T, m), dtype=int]
        Pre-allocated pointer array

    Returns
    -------
    None
        All computations are performed in-place on `state, value, ptr`.
    '''
    arg_6, arg_7 = arg_0.shape

    # factor in initial state distribution
    arg_4[0] = arg_0[0] + arg_2

    for arg_8 in range(1, arg_6):
        # Want V[t, j] <- p[t, j] * max_k V[t-1, k] * A[k, j]
        #    assume at time t-1 we were in state k
        #    transition k -> j

        # Broadcast over rows:
        #    Tout[k, j] = V[t-1, k] * A[k, j]
        #    then take the max over columns
        # We'll do this in log-space for stability

        arg_9 = arg_4[arg_8 - 1] + arg_1.T

        # Unroll the max/argmax loop to enable numba support
        for arg_10 in range(arg_7):
            arg_5[arg_8, arg_10] = np.argmax(arg_9[arg_10])
            # value[t, j] = log_prob[t, j] + np.max(trans_out[j])
            arg_4[arg_8, arg_10] = arg_0[arg_8, arg_10] + arg_9[arg_10, arg_5[arg_8][arg_10]]

    # Now roll backward

    # Get the last state
    arg_3[-1] = np.argmax(arg_4[-1])

    for arg_8 in range(arg_6 - 2, -1, -1):
        arg_3[arg_8] = arg_5[arg_8+1, arg_3[arg_8+1]]


def Func(arg_0, arg_1):
    '''Construct a self-loop transition matrix over `n_states`.

    The transition matrix will have the following properties:

        - `transition[i, i] = p` for all i
        - `transition[i, j] = (1 - p) / (n_states - 1)` for all `j != i`

    This type of transition matrix is appropriate when states tend to be
    locally stable, and there is no additional structure between different
    states.  This is primarily useful for de-noising frame-wise predictions.

    Parameters
    ----------
    n_states : int > 1
        The number of states

    prob : float in [0, 1] or iterable, length=n_states
        If a scalar, this is the probability of a self-transition.

        If a vector of length `n_states`, `p[i]` is the probability of state `i`'s self-transition.

    Returns
    -------
    transition : np.ndarray [shape=(n_states, n_states)]
        The transition matrix

    Examples
    --------
    >>> librosa.sequence.Func(3, 0.5)
    array([[0.5 , 0.25, 0.25],
           [0.25, 0.5 , 0.25],
           [0.25, 0.25, 0.5 ]])

    >>> librosa.sequence.Func(3, [0.8, 0.5, 0.25])
    array([[0.8  , 0.1  , 0.1  ],
           [0.25 , 0.5  , 0.25 ],
           [0.375, 0.375, 0.25 ]])
    '''

    if not isinstance(arg_0, int) or arg_0 <= 1:
        raise ParameterError('n_states={} must be a positive integer > 1')

    arg_2 = np.empty((arg_0, arg_0), dtype=np.float)

    # if it's a float, make it a vector
    arg_1 = np.asarray(arg_1, dtype=np.float)

    if arg_1.ndim == 0:
        arg_1 = np.tile(arg_1, arg_0)

    if arg_1.shape != (arg_0,):
        raise ParameterError('prob={} must have length equal to n_states={}'.format(arg_1, arg_0))

    if np.any(arg_1 < 0) or np.any(arg_1 > 1):
        raise ParameterError('prob={} must have values in the range [0, 1]'.format(arg_1))

    for arg_3, arg_4 in enumerate(arg_1):
        arg_2[arg_3] = (1. - arg_4) / (arg_0 - 1)
        arg_2[arg_3, arg_3] = arg_4

    return arg_2


def Func(arg_0, arg_1, arg_2='triangle', arg_3=False):
    '''Construct a localized transition matrix.

    The transition matrix will have the following properties:

        - `transition[i, j] = 0` if `|i - j| > width`
        - `transition[i, i]` is maximal
        - `transition[i, i - width//2 : i + width//2]` has shape `window`

    This type of transition matrix is appropriate for state spaces
    that discretely approximate continuous variables, such as in fundamental
    frequency estimation.

    Parameters
    ----------
    n_states : int > 1
        The number of states

    width : int >= 1 or iterable
        The maximum number of states to treat as "local".
        If iterable, it should have length equal to `n_states`,
        and specify the width independently for each state.

    window : str, callable, or window specification
        The window function to determine the shape of the "local" distribution.

        Any window specification supported by `filters.get_window` will work here.

        .. note:: Certain windows (e.g., 'hann') are identically 0 at the boundaries,
            so and effectively have `width-2` non-zero values.  You may have to expand
            `width` to get the desired behavior.

    wrap : bool
        If `True`, then state locality `|i - j|` is computed modulo `n_states`.
        If `False` (default), then locality is absolute.

    See Also
    --------
    filters.get_window

    Returns
    -------
    transition : np.ndarray [shape=(n_states, n_states)]
        The transition matrix

    Examples
    --------

    Triangular distributions with and without wrapping

    >>> librosa.sequence.Func(5, 3, window='triangle', wrap=False)
    array([[0.667, 0.333, 0.   , 0.   , 0.   ],
           [0.25 , 0.5  , 0.25 , 0.   , 0.   ],
           [0.   , 0.25 , 0.5  , 0.25 , 0.   ],
           [0.   , 0.   , 0.25 , 0.5  , 0.25 ],
           [0.   , 0.   , 0.   , 0.333, 0.667]])

    >>> librosa.sequence.Func(5, 3, window='triangle', wrap=True)
    array([[0.5 , 0.25, 0.  , 0.  , 0.25],
           [0.25, 0.5 , 0.25, 0.  , 0.  ],
           [0.  , 0.25, 0.5 , 0.25, 0.  ],
           [0.  , 0.  , 0.25, 0.5 , 0.25],
           [0.25, 0.  , 0.  , 0.25, 0.5 ]])

    Uniform local distributions with variable widths and no wrapping

    >>> librosa.sequence.Func(5, [1, 2, 3, 3, 1], window='ones', wrap=False)
    array([[1.   , 0.   , 0.   , 0.   , 0.   ],
           [0.5  , 0.5  , 0.   , 0.   , 0.   ],
           [0.   , 0.333, 0.333, 0.333, 0.   ],
           [0.   , 0.   , 0.333, 0.333, 0.333],
           [0.   , 0.   , 0.   , 0.   , 1.   ]])
    '''

    if not isinstance(arg_0, int) or arg_0 <= 1:
        raise ParameterError('n_states={} must be a positive integer > 1')

    arg_1 = np.asarray(arg_1, dtype=int)
    if arg_1.ndim == 0:
        arg_1 = np.tile(arg_1, arg_0)

    if arg_1.shape != (arg_0,):
        raise ParameterError('width={} must have length equal to n_states={}'.format(arg_1, arg_0))

    if np.any(arg_1 < 1):
        raise ParameterError('width={} must be at least 1')

    arg_4 = np.zeros((arg_0, arg_0), dtype=np.float)

    # Fill in the widths.  This is inefficient, but simple
    for arg_5, arg_6 in enumerate(arg_1):
        arg_7 = pad_center(get_window(arg_2, arg_6, fftbins=False), arg_0)
        arg_7 = np.roll(arg_7, arg_0//2 + arg_5 + 1)

        if not arg_3:
            # Knock out the off-diagonal-band elements
            arg_7[arg_8(arg_0, arg_5 + arg_6//2 + 1):] = 0
            arg_7[:arg_9(0, arg_5 - arg_6//2)] = 0

        arg_4[arg_5] = arg_7

    # Row-normalize
    arg_4 /= arg_4.sum(axis=1, keepdims=True)

    return arg_4


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=512,
                 arg_4=False, arg_5=None,
                 arg_6='frames', **arg_7):
    """Basic onset detector.  Locate note onset events by picking peaks in an
    onset strength envelope.

    The `peak_pick` parameters were chosen by large-scale hyper-parameter
    optimization over the dataset provided by [1]_.

    .. [1] https://github.com/CPJKU/onset_db

    Parameters
    ----------
    y          : np.ndarray [shape=(n,)]
        audio time series

    sr         : number > 0 [scalar]
        sampling rate of `y`

    onset_envelope     : np.ndarray [shape=(m,)]
        (optional) pre-computed onset strength envelope

    hop_length : int > 0 [scalar]
        hop length (in samples)

    units : {'frames', 'samples', 'time'}
        The units to encode detected onset events in.
        By default, 'frames' are used.

    backtrack : bool
        If `True`, detected onset events are backtracked to the nearest
        preceding minimum of `energy`.

        This is primarily useful when using onsets as slice points for segmentation.

    energy : np.ndarray [shape=(m,)] (optional)
        An energy function to use for backtracking detected onset events.
        If none is provided, then `onset_envelope` is used.

    kwargs : additional keyword arguments
        Additional parameters for peak picking.

        See `librosa.util.peak_pick` for details.

    Returns
    -------

    onsets : np.ndarray [shape=(n_onsets,)]
        estimated positions of detected onsets, in whichever units
        are specified.  By default, frame indices.

        .. note::
            If no onset strength could be detected, Func returns
            an empty list.

    Raises
    ------
    ParameterError
        if neither `y` nor `onsets` are provided

        or if `units` is not one of 'frames', 'samples', or 'time'

    See Also
    --------
    onset_strength : compute onset strength per-frame
    onset_backtrack : backtracking onset events
    librosa.util.peak_pick : pick peaks from a time series

    Examples
    --------
    Get onset times from a signal

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      offset=30, duration=2.0)
    >>> onset_frames = librosa.onset.Func(y=y, sr=sr)
    >>> librosa.frames_to_time(onset_frames, sr=sr)
    array([ 0.07 ,  0.395,  0.511,  0.627,  0.766,  0.975,
            1.207,  1.324,  1.44 ,  1.788,  1.881])

    Or use a pre-computed onset envelope

    >>> o_env = librosa.onset.onset_strength(y, sr=sr)
    >>> times = librosa.frames_to_time(np.arange(len(o_env)), sr=sr)
    >>> onset_frames = librosa.onset.Func(onset_envelope=o_env, sr=sr)

    >>> import matplotlib.pyplot as plt
    >>> D = np.abs(librosa.stft(y))
    >>> plt.figure()
    >>> ax1 = plt.subplot(2, 1, 1)
    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
    ...                          x_axis='time', y_axis='log')
    >>> plt.title('Power spectrogram')
    >>> plt.subplot(2, 1, 2, sharex=ax1)
    >>> plt.plot(times, o_env, label='Onset strength')
    >>> plt.vlines(times[onset_frames], 0, o_env.max(), color='r', alpha=0.9,
    ...            linestyle='--', label='Onsets')
    >>> plt.axis('tight')
    >>> plt.legend(frameon=True, framealpha=0.75)

    """

    # First, get the frame->beat strength profile if we don't already have one
    if arg_2 is None:
        if arg_0 is None:
            raise ParameterError('y or onset_envelope must be provided')

        arg_2 = onset_strength(arg_0=arg_0, arg_1=arg_1, arg_3=arg_3)

    # Shift onset envelope up to be non-negative
    # (a common normalization step to make the threshold more consistent)
    arg_2 -= arg_2.min()

    # Do we have any onsets to grab?
    if not arg_2.any():
        return np.array([], dtype=np.int)

    # Normalize onset strength function to [0, 1] range
    arg_2 /= arg_2.max()

    # These parameter settings found by large-scale search
    arg_7.setdefault('pre_max', 0.03*arg_1//arg_3)       # 30ms
    arg_7.setdefault('post_max', 0.00*arg_1//arg_3 + 1)  # 0ms
    arg_7.setdefault('pre_avg', 0.10*arg_1//arg_3)       # 100ms
    arg_7.setdefault('post_avg', 0.10*arg_1//arg_3 + 1)  # 100ms
    arg_7.setdefault('wait', 0.03*arg_1//arg_3)          # 30ms
    arg_7.setdefault('delta', 0.07)

    # Peak pick the onset envelope
    arg_8 = util.peak_pick(arg_2, **arg_7)

    # Optionally backtrack the events
    if arg_4:
        if arg_5 is None:
            arg_5 = arg_2

        arg_8 = onset_backtrack(arg_8, arg_5)

    if arg_6 == 'frames':
        pass
    elif arg_6 == 'samples':
        arg_8 = core.frames_to_samples(arg_8, arg_3=arg_3)
    elif arg_6 == 'time':
        arg_8 = core.frames_to_time(arg_8, arg_3=arg_3, arg_1=arg_1)
    else:
        raise ParameterError('Invalid unit type: {}'.format(arg_6))

    return arg_8


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=1, arg_4=1,
                         arg_5=None, arg_6=False, arg_7=True, arg_8=None,
                         arg_9=None, arg_10=None, **arg_11):
    """Compute a spectral flux onset strength envelope across multiple channels.

    Onset strength for channel `i` at time `t` is determined by:

    `mean_{f in channels[i]} max(0, S[f, t+1] - S[f, t])`

    Parameters
    ----------
    y        : np.ndarray [shape=(n,)]
        audio time-series

    sr       : number > 0 [scalar]
        sampling rate of `y`

    S        : np.ndarray [shape=(d, m)]
        pre-computed (log-power) spectrogram

    lag      : int > 0
        time lag for computing differences

    max_size : int > 0
        size (in frequency bins) of the local max filter.
        set to `1` to disable filtering.

    ref : None or np.ndarray [shape=(d, m)]
        An optional pre-computed reference spectrum, of the same shape as `S`.
        If not provided, it will be computed from `S`.
        If provided, it will override any local max filtering governed by `max_size`.

    detrend : bool [scalar]
        Filter the onset strength to remove the DC component

    center : bool [scalar]
        Shift the onset function by `n_fft / (2 * hop_length)` frames

    feature : function
        Function for computing time-series features, eg, scaled spectrograms.
        By default, uses `librosa.feature.melspectrogram` with `fmax=11025.0`

    aggregate : function or False
        Aggregation function to use when combining onsets
        at different frequency bins.

        If `False`, then no aggregation is performed.

        Default: `np.mean`

    channels : list or None
        Array of channel boundaries or slice objects.
        If `None`, then a single channel is generated to span all bands.

    kwargs : additional keyword arguments
        Additional parameters to `feature()`, if `S` is not provided.

    Returns
    -------
    onset_envelope   : np.ndarray [shape=(n_channels, m)]
        array containing the onset strength envelope for each specified channel

    Raises
    ------
    ParameterError
        if neither `(y, sr)` nor `S` are provided

    See Also
    --------
    onset_strength

    Notes
    -----
    This function caches at level 30.

    Examples
    --------
    First, load some audio and plot the spectrogram

    >>> import matplotlib.pyplot as plt
    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      duration=10.0)
    >>> D = np.abs(librosa.stft(y))
    >>> plt.figure()
    >>> plt.subplot(2, 1, 1)
    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
    ...                          y_axis='log')
    >>> plt.title('Power spectrogram')

    Construct a standard onset function over four sub-bands

    >>> onset_subbands = librosa.onset.Func(y=y, sr=sr,
    ...                                                     channels=[0, 32, 64, 96, 128])
    >>> plt.subplot(2, 1, 2)
    >>> librosa.display.specshow(onset_subbands, x_axis='time')
    >>> plt.ylabel('Sub-bands')
    >>> plt.title('Sub-band onset strength')

    """

    if arg_8 is None:
        arg_8 = melspectrogram
        arg_11.setdefault('fmax', 11025.0)

    if arg_9 is None:
        arg_9 = np.mean

    if arg_3 < 1 or not isinstance(arg_3, int):
        raise ParameterError('lag must be a positive integer')

    if arg_4 < 1 or not isinstance(arg_4, int):
        raise ParameterError('max_size must be a positive integer')

    # First, compute mel spectrogram
    if arg_2 is None:
        arg_2 = np.abs(arg_8(arg_0=arg_0, arg_1=arg_1, **arg_11))

        # Convert to dBs
        arg_2 = core.power_to_db(arg_2)

    # Retrieve the n_fft and hop_length,
    # or default values for onsets if not provided
    arg_12 = arg_11.get('n_fft', 2048)
    arg_13 = arg_11.get('hop_length', 512)

    # Ensure that S is at least 2-d
    arg_2 = np.atleast_2d(arg_2)

    # Compute the reference spectrogram.
    # Efficiency hack: skip filtering step and pass by reference
    # if max_size will produce a no-op.
    if arg_5 is None:
        if arg_4 == 1:
            arg_5 = arg_2
        else:
            arg_5 = scipy.ndimage.maximum_filter1d(arg_2, arg_4, axis=0)
    elif arg_5.shape != arg_2.shape:
        raise ParameterError('Reference spectrum shape {} must match input spectrum {}'.format(arg_5.shape, arg_2.shape))

    # Compute difference to the reference, spaced by lag
    arg_14 = arg_2[:, arg_3:] - arg_5[:, :-arg_3]

    # Discard negatives (decreasing amplitude)
    arg_14 = np.maximum(0.0, arg_14)

    # Aggregate within channels
    arg_15 = True
    if arg_10 is None:
        arg_10 = [slice(None)]
    else:
        arg_15 = False

    if arg_9:
        arg_14 = util.sync(arg_14, arg_10,
                              arg_9=arg_9,
                              arg_15=arg_15, axis=0)

    # compensate for lag
    arg_16 = arg_3
    if arg_7:
        # Counter-act framing effects. Shift the onsets by n_fft / hop_length
        arg_16 += arg_12 // (2 * arg_13)

    arg_14 = np.pad(arg_14, ([0, 0], [int(arg_16), 0]),
                       mode='constant')

    # remove the DC component
    if arg_6:
        arg_14 = scipy.signal.lfilter([1.0, -1.0], [1.0, -0.99],
                                         arg_14, axis=-1)

    # Trim to match the input duration
    if arg_7:
        arg_14 = arg_14[:, :arg_2.shape[1]]

    return arg_14


def Func(arg_0, arg_1, arg_2=None, arg_3=',', arg_4='%0.3f'):
    r"""Save time steps as in CSV format.  This can be used to store the output
    of a beat-tracker or segmentation algorithm.

    If only `times` are provided, the file will contain each value
    of `times` on a row::

        times[0]\n
        times[1]\n
        times[2]\n
        ...

    If `annotations` are also provided, the file will contain
    delimiter-separated values::

        times[0],annotations[0]\n
        times[1],annotations[1]\n
        times[2],annotations[2]\n
        ...

    Parameters
    ----------
    path : string
        path to save the output CSV file

    times : list-like of floats
        list of frame numbers for beat events

    annotations : None or list-like
        optional annotations for each time step

    delimiter : str
        character to separate fields

    fmt : str
        format-string for rendering time

    Raises
    ------
    ParameterError
        if `annotations` is not `None` and length does not
        match `times`

    Examples
    --------
    Write beat-tracker time to CSV

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> tempo, beats = librosa.beat.beat_track(y, sr=sr, units='time')
    >>> librosa.output.Func('beat_times.csv', beats)
    """

    if arg_2 is not None and len(arg_2) != len(arg_1):
        raise ParameterError('len(annotations) != len(times)')

    with open(arg_0, 'w') as output_file:
        arg_5 = csv.writer(output_file, arg_3=arg_3)

        if arg_2 is None:
            for arg_6 in arg_1:
                arg_5.writerow([arg_4 % arg_6])
        else:
            for arg_6, arg_7 in zip(arg_1, arg_2):
                arg_5.writerow([(arg_4 % arg_6), arg_7])


def Func(arg_0, arg_1, arg_2, arg_3=False):
    """Output a time series as a .wav file

    Note: only mono or stereo, floating-point data is supported.
        For more advanced and flexible output options, refer to
        `soundfile`.

    Parameters
    ----------
    path : str
        path to save the output wav file

    y : np.ndarray [shape=(n,) or (2,n), dtype=np.float]
        audio time series (mono or stereo).

        Note that only floating-point values are supported.

    sr : int > 0 [scalar]
        sampling rate of `y`

    norm : boolean [scalar]
        enable amplitude normalization.
        For floating point `y`, scale the data to the range [-1, +1].

    Examples
    --------
    Trim a signal to 5 seconds and save it back

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      duration=5.0)
    >>> librosa.output.Func('file_trim_5s.wav', y, sr)

    See Also
    --------
    soundfile.write
    """

    # Validate the buffer.  Stereo is okay here.
    util.valid_audio(arg_1, mono=False)

    # normalize
    if arg_3 and np.issubdtype(arg_1.dtype, np.floating):
        arg_4 = util.normalize(arg_1, arg_3=np.inf, axis=None)
    else:
        arg_4 = arg_1

    # Check for stereo
    if arg_4.ndim > 1 and arg_4.shape[0] == 2:
        arg_4 = arg_4.T

    # Save
    scipy.io.wavfile.write(arg_0, arg_2, arg_4)


def Func(arg_0, arg_1=True, arg_2='magma', arg_3='gray_r', arg_4='coolwarm'):
    '''Get a default colormap from the given data.

    If the data is boolean, use a black and white colormap.

    If the data has both positive and negative values,
    use a diverging colormap.

    Otherwise, use a sequential colormap.

    Parameters
    ----------
    data : np.ndarray
        Input data

    robust : bool
        If True, discard the top and bottom 2% of data when calculating
        range.

    Func_seq : str
        The sequential colormap name

    Func_bool : str
        The boolean colormap name

    Func_div : str
        The diverging colormap name

    Returns
    -------
    Func : matplotlib.colors.Colormap
        The colormap to use for `data`

    See Also
    --------
    matplotlib.pyplot.colormaps
    '''

    arg_0 = np.atleast_1d(arg_0)

    if arg_0.dtype == 'bool':
        return get_Func(arg_3)

    arg_0 = arg_0[np.isfinite(arg_0)]

    if arg_1:
        arg_5, arg_6 = 2, 98
    else:
        arg_5, arg_6 = 0, 100

    arg_7 = np.percentile(arg_0, arg_6)
    arg_8 = np.percentile(arg_0, arg_5)

    if arg_8 >= 0 or arg_7 <= 0:
        return get_Func(arg_2)

    return get_Func(arg_4)


def Func(arg_0, arg_1=22050, arg_2=5e4, arg_3='time', arg_4=0.0,
             arg_5=1000, arg_6=None, **arg_7):
    '''Plot the amplitude envelope of a waveform.

    If `y` is monophonic, a filled curve is drawn between `[-abs(y), abs(y)]`.

    If `y` is stereo, the curve is drawn between `[-abs(y[1]), abs(y[0])]`,
    so that the left and right channels are drawn above and below the axis,
    respectively.

    Long signals (`duration >= max_points`) are down-sampled to at
    most `max_sr` before plotting.

    Parameters
    ----------
    y : np.ndarray [shape=(n,) or (2,n)]
        audio time series (mono or stereo)

    sr : number > 0 [scalar]
        sampling rate of `y`

    max_points : postive number or None
        Maximum number of time-points to plot: if `max_points` exceeds
        the duration of `y`, then `y` is downsampled.

        If `None`, no downsampling is performed.

    x_axis : str {'time', 'off', 'none'} or None
        If 'time', the x-axis is given time tick-marks.

    ax : matplotlib.axes.Axes or None
        Axes to plot on instead of the default `plt.gca()`.

    offset : float
        Horizontal offset (in seconds) to start the waveform plot

    max_sr : number > 0 [scalar]
        Maximum sampling rate for the visualization

    kwargs
        Additional keyword arguments to `matplotlib.pyplot.fill_between`

    Returns
    -------
    pc : matplotlib.collections.PolyCollection
        The PolyCollection created by `fill_between`.

    See also
    --------
    librosa.core.resample
    matplotlib.pyplot.fill_between

    Examples
    --------
    Plot a monophonic waveform

    >>> import matplotlib.pyplot as plt
    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=10)
    >>> plt.figure()
    >>> plt.subplot(3, 1, 1)
    >>> librosa.display.Func(y, sr=sr)
    >>> plt.title('Monophonic')

    Or a stereo waveform

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      mono=False, duration=10)
    >>> plt.subplot(3, 1, 2)
    >>> librosa.display.Func(y, sr=sr)
    >>> plt.title('Stereo')

    Or harmonic and percussive components with transparency

    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=10)
    >>> y_harm, y_perc = librosa.effects.hpss(y)
    >>> plt.subplot(3, 1, 3)
    >>> librosa.display.Func(y_harm, sr=sr, alpha=0.25)
    >>> librosa.display.Func(y_perc, sr=sr, color='r', alpha=0.5)
    >>> plt.title('Harmonic + Percussive')
    >>> plt.tight_layout()
    '''

    util.valid_audio(arg_0, mono=False)

    if not (isinstance(arg_5, int) and arg_5 > 0):
        raise ParameterError('max_sr must be a non-negative integer')

    arg_8 = arg_1
    arg_9 = 1

    if arg_2 is not None:
        if arg_2 <= 0:
            raise ParameterError('max_points must be strictly positive')

        if arg_2 < arg_0.shape[-1]:
            arg_8 = min(arg_5, (arg_1 * arg_0.shape[-1]) // arg_2)

        arg_9 = arg_1 // arg_8

        if arg_0.ndim == 1:
            arg_0 = __envelope(arg_0, arg_9)
        else:
            arg_0 = np.vstack([__envelope(_, arg_9) for _ in arg_0])

    if arg_0.ndim > 1:
        arg_10 = arg_0[0]
        arg_11 = -arg_0[1]
    else:
        arg_10 = arg_0
        arg_11 = -arg_0

    arg_12 = __check_axes(arg_6)

    arg_7.setdefault('color', next(arg_12._get_lines.prop_cycler)['color'])

    arg_13 = arg_4 + core.frames_to_time(np.arange(len(arg_10)),
                                        arg_1=arg_1,
                                        arg_9=arg_9)

    arg_14 = arg_12.fill_between(arg_13, arg_11, arg_10, **arg_7)

    arg_12.set_xlim([arg_13.min(), arg_13.max()])
    if arg_3 == 'time':
        arg_12.xaxis.set_major_formatter(TimeFormatter(lag=False))
        arg_12.xaxis.set_label_text('Time')
    elif arg_3 is None or arg_3 in ['off', 'none']:
        arg_12.set_xticks([])
    else:
        raise ParameterError('Unknown x_axis value: {}'.format(arg_3))

    return arg_14


def Func(arg_0, arg_1):
    '''Helper to set the current image in pyplot mode.

    If the provided `ax` is not `None`, then we assume that the user is using the object API.
    In this case, the pyplot current image is not set.
    '''

    if arg_0 is None:
        import matplotlib.pyplot as plt
        plt.sci(arg_1)


def Func(arg_0, arg_1, arg_2, **arg_3):
    '''Compute axis coordinates'''

    if arg_1 is not None:
        if len(arg_1) < arg_2:
            raise ParameterError('Coordinate shape mismatch: '
                                 '{}<{}'.format(len(arg_1), arg_2))
        return arg_1

    arg_4 = {'linear': __coord_fft_hz,
                 'hz': __coord_fft_hz,
                 'log': __coord_fft_hz,
                 'mel': __coord_mel_hz,
                 'cqt': __coord_cqt_hz,
                 'cqt_hz': __coord_cqt_hz,
                 'cqt_note': __coord_cqt_hz,
                 'chroma': __coord_chroma,
                 'time': __coord_time,
                 's': __coord_time,
                 'ms': __coord_time,
                 'lag': __coord_time,
                 'lag_s': __coord_time,
                 'lag_ms': __coord_time,
                 'tonnetz': __coord_n,
                 'off': __coord_n,
                 'tempo': __coord_tempo,
                 'frames': __coord_n,
                 None: __coord_n}

    if arg_0 not in arg_4:
        raise ParameterError('Unknown axis type: {}'.format(arg_0))
    return arg_4[arg_0](arg_2, **arg_3)


def Func(arg_0):
    '''Check if "axes" is an instance of an axis object. If not, use `gca`.'''
    if arg_0 is None:
        import matplotlib.pyplot as plt
        arg_0 = plt.gca()
    elif not isinstance(arg_0, Axes):
        raise ValueError("`axes` must be an instance of matplotlib.axes.Axes. "
                         "Found type(axes)={}".format(type(arg_0)))
    return arg_0


def Func(arg_0, arg_1=None, arg_2=12, **arg_3):
    '''Get CQT bin frequencies'''
    if arg_1 is None:
        arg_1 = core.note_to_hz('C1')

    # we drop by half a bin so that CQT bins are centered vertically
    return core.cqt_frequencies(arg_0+1,
                                arg_1=arg_1 / 2.0**(0.5/arg_2),
                                arg_2=arg_2)


def Func(arg_0, arg_1=12, **arg_2):
    '''Get chroma bin numbers'''
    return np.linspace(0, (12.0 * arg_0) / arg_1, num=arg_0+1, endpoint=True)


def Func(arg_0, arg_1=22050, arg_2=512, **arg_3):
    '''Get time coordinates from frames'''
    return core.frames_to_time(np.arange(arg_0+1), arg_1=arg_1, arg_2=arg_2)


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=2048,
                    arg_4=0.01, arg_5=12, **arg_6):
    '''Estimate the tuning of an audio time series or spectrogram input.

    Parameters
    ----------
    y: np.ndarray [shape=(n,)] or None
        audio signal

    sr : number > 0 [scalar]
        audio sampling rate of `y`

    S: np.ndarray [shape=(d, t)] or None
        magnitude or power spectrogram

    n_fft : int > 0 [scalar] or None
        number of FFT bins to use, if `y` is provided.

    resolution : float in `(0, 1)`
        Resolution of the tuning as a fraction of a bin.
        0.01 corresponds to measurements in cents.

    bins_per_octave : int > 0 [scalar]
        How many frequency bins per octave

    kwargs : additional keyword arguments
        Additional arguments passed to `piptrack`

    Returns
    -------
    tuning: float in `[-0.5, 0.5)`
        estimated tuning deviation (fractions of a bin)

    See Also
    --------
    piptrack
        Pitch tracking by parabolic interpolation

    Examples
    --------
    >>> # With time-series input
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.Func(y=y, sr=sr)
    0.089999999999999969

    >>> # In tenths of a cent
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.Func(y=y, sr=sr, resolution=1e-3)
    0.093999999999999972

    >>> # Using spectrogram input
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> S = np.abs(librosa.stft(y))
    >>> librosa.Func(S=S, sr=sr)
    0.089999999999999969

    >>> # Using pass-through arguments to `librosa.piptrack`
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.Func(y=y, sr=sr, n_fft=8192,
    ...                         fmax=librosa.note_to_hz('G#9'))
    0.070000000000000062

    '''

    arg_7, arg_8 = piptrack(arg_0=arg_0, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, **arg_6)

    # Only count magnitude where frequency is > 0
    arg_9 = arg_7 > 0

    if arg_9.any():
        arg_10 = np.median(arg_8[arg_9])
    else:
        arg_10 = 0.0

    return pitch_tuning(arg_7[(arg_8 >= arg_10) & arg_9],
                        arg_4=arg_4,
                        arg_5=arg_5)


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=2048, arg_4=None,
             arg_5=150.0, arg_6=4000.0, arg_7=0.1,
             arg_8=None, arg_9='hann', arg_10=True, arg_11='reflect',
             arg_12=None):
    '''Pitch tracking on thresholded parabolically-interpolated STFT.

    This implementation uses the parabolic interpolation method described by [1]_.

    .. [1] https://ccrma.stanford.edu/~jos/sasp/Sinusoidal_Peak_Interpolation.html

    Parameters
    ----------
    y: np.ndarray [shape=(n,)] or None
        audio signal

    sr : number > 0 [scalar]
        audio sampling rate of `y`

    S: np.ndarray [shape=(d, t)] or None
        magnitude or power spectrogram

    n_fft : int > 0 [scalar] or None
        number of FFT bins to use, if `y` is provided.

    hop_length : int > 0 [scalar] or None
        number of samples to hop

    threshold : float in `(0, 1)`
        A bin in spectrum `S` is considered a pitch when it is greater than
        `threshold*ref(S)`.

        By default, `ref(S)` is taken to be `max(S, axis=0)` (the maximum value in
        each column).

    fmin : float > 0 [scalar]
        lower frequency cutoff.

    fmax : float > 0 [scalar]
        upper frequency cutoff.

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    ref : scalar or callable [default=np.max]
        If scalar, the reference value against which `S` is compared for determining
        pitches.

        If callable, the reference value is computed as `ref(S, axis=0)`.

    .. note::
        One of `S` or `y` must be provided.

        If `S` is not given, it is computed from `y` using
        the default parameters of `librosa.core.stft`.

    Returns
    -------
    pitches : np.ndarray [shape=(d, t)]
    magnitudes : np.ndarray [shape=(d,t)]
        Where `d` is the subset of FFT bins within `fmin` and `fmax`.

        `pitches[f, t]` contains instantaneous frequency at bin
        `f`, time `t`

        `magnitudes[f, t]` contains the corresponding magnitudes.

        Both `pitches` and `magnitudes` take value 0 at bins
        of non-maximal magnitude.

    Notes
    -----
    This function caches at level 30.

    Examples
    --------
    Computing pitches from a waveform input

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> pitches, magnitudes = librosa.Func(y=y, sr=sr)

    Or from a spectrogram input

    >>> S = np.abs(librosa.stft(y))
    >>> pitches, magnitudes = librosa.Func(S=S, sr=sr)

    Or with an alternate reference value for pitch detection, where
    values above the mean spectral energy in each frame are counted as pitches

    >>> pitches, magnitudes = librosa.Func(S=S, sr=sr, threshold=1,
    ...                                        ref=np.mean)

    '''

    # Check that we received an audio time series or STFT
    arg_2, arg_3 = _spectrogram(arg_0=arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                            arg_8=arg_8, arg_9=arg_9,
                            arg_10=arg_10, arg_11=arg_11)

    # Make sure we're dealing with magnitudes
    arg_2 = np.abs(arg_2)

    # Truncate to feasible region
    arg_5 = np.maximum(arg_5, 0)
    arg_6 = np.minimum(arg_6, float(arg_1) / 2)

    arg_13 = time_frequency.fft_frequencies(arg_1=arg_1, arg_3=arg_3)

    # Do the parabolic interpolation everywhere,
    # then figure out where the peaks are
    # then restrict to the feasible range (fmin:fmax)
    arg_14 = 0.5 * (arg_2[2:] - arg_2[:-2])

    arg_15 = 2 * arg_2[1:-1] - arg_2[2:] - arg_2[:-2]

    # Suppress divide-by-zeros.
    # Points where shift == 0 will never be selected by localmax anyway
    arg_15 = arg_14 / (arg_15 + (np.abs(arg_15) < util.tiny(arg_15)))

    # Pad back up to the same shape as S
    arg_14 = np.pad(arg_14, ([1, 1], [0, 0]), mode='constant')
    arg_15 = np.pad(arg_15, ([1, 1], [0, 0]), mode='constant')

    arg_16 = 0.5 * arg_14 * arg_15

    # Pre-allocate output
    arg_17 = np.zeros_like(arg_2)
    arg_18 = np.zeros_like(arg_2)

    # Clip to the viable frequency range
    arg_19 = ((arg_5 <= arg_13) & (arg_13 < arg_6)).reshape((-1, 1))

    # Compute the column-wise local max of S after thresholding
    # Find the argmax coordinates
    if arg_12 is None:
        arg_12 = np.max

    if six.callable(arg_12):
        arg_20 = arg_7 * arg_12(arg_2, axis=0)
    else:
        arg_20 = np.abs(arg_12)

    arg_21 = np.argwhere(arg_19 & util.localmax(arg_2 * (arg_2 > arg_20)))

    # Store pitch and magnitude
    arg_17[arg_21[:, 0], arg_21[:, 1]] = ((arg_21[:, 0] + arg_15[arg_21[:, 0], arg_21[:, 1]])
                                     * float(arg_1) / arg_3)

    arg_18[arg_21[:, 0], arg_21[:, 1]] = (arg_2[arg_21[:, 0], arg_21[:, 1]]
                                  + arg_16[arg_21[:, 0], arg_21[:, 1]])

    return arg_17, arg_18


def Func(arg_0, **arg_1):
    '''Decompose an audio time series into harmonic and percussive components.

    This function automates the STFT->HPSS->ISTFT pipeline, and ensures that
    the output waveforms have equal length to the input waveform `y`.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series
    kwargs : additional keyword arguments.
        See `librosa.decompose.Func` for details.

    Returns
    -------
    y_harmonic : np.ndarray [shape=(n,)]
        audio time series of the harmonic elements

    y_percussive : np.ndarray [shape=(n,)]
        audio time series of the percussive elements

    See Also
    --------
    harmonic : Extract only the harmonic component
    percussive : Extract only the percussive component
    librosa.decompose.Func : HPSS on spectrograms

    Examples
    --------
    >>> # Extract harmonic and percussive components
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> y_harmonic, y_percussive = librosa.effects.Func(y)

    >>> # Get a more isolated percussive component by widening its margin
    >>> y_harmonic, y_percussive = librosa.effects.Func(y, margin=(1.0,5.0))

    '''

    # Compute the STFT matrix
    arg_2 = core.stft(arg_0)

    # Decompose into harmonic and percussives
    arg_3, arg_4 = decompose.Func(arg_2, **arg_1)

    # Invert the STFTs.  Adjust length to match the input.
    arg_5 = util.fix_length(core.istft(arg_3, dtype=arg_0.dtype), len(arg_0))
    arg_6 = util.fix_length(core.istft(arg_4, dtype=arg_0.dtype), len(arg_0))

    return arg_5, arg_6


def Func(arg_0, **arg_1):
    '''Extract Func elements from an audio time-series.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series
    kwargs : additional keyword arguments.
        See `librosa.decompose.hpss` for details.

    Returns
    -------
    y_Func : np.ndarray [shape=(n,)]
        audio time series of just the Func portion

    See Also
    --------
    hpss : Separate harmonic and Func components
    harmonic : Extract only the harmonic component
    librosa.decompose.hpss : HPSS for spectrograms

    Examples
    --------
    >>> # Extract Func component
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> y_Func = librosa.effects.Func(y)

    >>> # Use a margin > 1.0 for greater Func separation
    >>> y_Func = librosa.effects.Func(y, margin=3.0)

    '''

    # Compute the STFT matrix
    arg_2 = core.stft(arg_0)

    # Remove harmonics
    arg_3 = decompose.hpss(arg_2, **arg_1)[1]

    # Invert the STFT
    arg_4 = util.fix_length(core.istft(arg_3, dtype=arg_0.dtype), len(arg_0))

    return arg_4


def Func(arg_0, arg_1):
    '''Time-stretch an audio series by a fixed rate.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series

    rate : float > 0 [scalar]
        Stretch factor.  If `rate > 1`, then the signal is sped up.

        If `rate < 1`, then the signal is slowed down.

    Returns
    -------
    y_stretch : np.ndarray [shape=(rate * n,)]
        audio time series stretched by the specified rate

    See Also
    --------
    pitch_shift : pitch shifting
    librosa.core.phase_vocoder : spectrogram phase vocoder

    Examples
    --------
    Compress to be twice as fast

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> y_fast = librosa.effects.Func(y, 2.0)

    Or half the original speed

    >>> y_slow = librosa.effects.Func(y, 0.5)

    '''

    if arg_1 <= 0:
        raise ParameterError('rate must be a positive number')

    # Construct the stft
    arg_2 = core.stft(arg_0)

    # Stretch by phase vocoding
    arg_3 = core.phase_vocoder(arg_2, arg_1)

    # Invert the stft
    arg_4 = core.istft(arg_3, dtype=arg_0.dtype)

    return arg_4


def Func(arg_0, arg_1, arg_2, arg_3=12, arg_4='kaiser_best'):
    '''Pitch-shift the waveform by `n_steps` half-steps.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time-series

    sr : number > 0 [scalar]
        audio sampling rate of `y`

    n_steps : float [scalar]
        how many (fractional) half-steps to shift `y`

    bins_per_octave : float > 0 [scalar]
        how many steps per octave

    res_type : string
        Resample type.
        Possible options: 'kaiser_best', 'kaiser_fast', and 'scipy', 'polyphase',
        'fft'.
        By default, 'kaiser_best' is used.

        See `core.resample` for more information.

    Returns
    -------
    y_shift : np.ndarray [shape=(n,)]
        The pitch-shifted audio time-series

    See Also
    --------
    time_stretch : time stretching
    librosa.core.phase_vocoder : spectrogram phase vocoder

    Examples
    --------
    Shift up by a major third (four half-steps)

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> y_third = librosa.effects.Func(y, sr, n_steps=4)

    Shift down by a tritone (six half-steps)

    >>> y_tritone = librosa.effects.Func(y, sr, n_steps=-6)

    Shift up by 3 quarter-tones

    >>> y_three_qt = librosa.effects.Func(y, sr, n_steps=3,
    ...                                          bins_per_octave=24)
    '''

    if arg_3 < 1 or not np.issubdtype(type(arg_3), np.integer):
        raise ParameterError('bins_per_octave must be a positive integer.')

    arg_5 = 2.0 ** (-float(arg_2) / arg_3)

    # Stretch in time, then resample
    arg_6 = core.resample(time_stretch(arg_0, arg_5), float(arg_1) / arg_5, arg_1,
                            arg_4=arg_4)

    # Crop to the same dimension as the input
    return util.fix_length(arg_6, len(arg_0))


def Func(arg_0, arg_1=60, arg_2=arg_3.max, arg_5=2048, arg_6=512):
    '''Split an audio signal into non-silent intervals.

    Parameters
    ----------
    y : np.ndarray, shape=(n,) or (2, n)
        An audio signal

    top_db : number > 0
        The threshold (in decibels) below reference to consider as
        silence

    ref : number or callable
        The reference power.  By default, it uses `np.max` and compares
        to the peak power in the signal.

    frame_length : int > 0
        The number of samples per analysis frame

    hop_length : int > 0
        The number of samples between analysis frames

    Returns
    -------
    intervals : np.ndarray, shape=(m, 2)
        `intervals[i] == (start_i, end_i)` are the start and end time
        (in samples) of non-silent interval `i`.

    '''

    arg_7 = _signal_to_frame_nonsilent(arg_0,
                                            arg_5=arg_5,
                                            arg_6=arg_6,
                                            arg_2=arg_2,
                                            arg_1=arg_1)

    # Interval slicing, adapted from
    # https://stackoverflow.com/questions/2619413/efficiently-finding-the-interval-with-non-zeros-in-scipy-numpy-in-python
    # Find points where the sign flips
    arg_8 = arg_3.flatnonzero(arg_3.diff(arg_7.astype(int)))

    # Pad back the sample lost in the diff
    arg_8 = [arg_8 + 1]

    # If the first frame had high energy, count it
    if arg_7[0]:
        arg_8.insert(0, [0])

    # Likewise for the last frame
    if arg_7[-1]:
        arg_8.append([len(arg_7)])

    # Convert from frames to samples
    arg_8 = core.frames_to_samples(arg_3.concatenate(arg_8),
                                   arg_6=arg_6)

    # Clip to the signal duration
    arg_8 = arg_3.minimum(arg_8, arg_0.shape[-1])

    # Stack the results back as an ndarray
    return arg_8.reshape((-1, 2))