wavesongs.utils.tools#

Some tools for interactive plots, math computing, and sound processing.

Functions

envelope(s, sr, Nt)

get_measures(klicker, obj[, save, labels])

get_roi(klicker)

is_notebook()

klicker_multiple(fig, ax[, labels, colors, ...])

klicker_time(fig, ax)

rk4(f, v, dt)

Implentation of Runge-Kuta 4th order

wavesongs.utils.tools.envelope(s: ndarray, sr: int, Nt: int) ndarray[source]#
Parameters:
  • s (np.array) – Audio amplitude array

  • sr (int) – Sample rate

  • Nt (int)

Returns:

s_env_interpolated

Return type:

np.array

Example

>>>
wavesongs.utils.tools.klicker_multiple(fig: Figure, ax: Axes, labels: List = ['$f_{max/min}$', '$theme_{ini}$', '$theme_{end}$', '$trill_{ini}$', '$trill_{end}$'], colors: List = ['cyan', 'olivedrab', 'darkgreen', 'steelblue', 'royalblue'], markers: List = ['p', '*', '*', 'o', 'o']) clicker[source]#
Parameters:
  • fig (Figure) – Matplotlib Figure object

  • ax (Axes) – Matplotlib Axes objects

  • label (list[str])

  • colors (list[str])

  • markers (list[str])

Returns:

klicker_data – Clicker object with position of the data measured

Return type:

clicker

Example

>>>
wavesongs.utils.tools.klicker_time(fig: Figure, ax: Axes)[source]#
Parameters:
  • fig (Figure) – Matplotlib Figure object

  • ax (Axes) – Matplotlib Axes objects

Returns:

klicker_data – Clicker object with position of the data measured

Return type:

clicker

Example

>>>
wavesongs.utils.tools.get_roi(klicker: clicker) List[Tuple[float]][source]#
Parameters:

klicker (clicker) – Clicker object with position of the data measured

Returns:

times – Times select from the spectrogram

Return type:

list[tuple[float], tuple[float]]

Example

>>>
wavesongs.utils.tools.get_measures(klicker, obj, save=False, labels=['$f_{max/min}$', '$theme_{ini}$', '$theme_{end}$', '$trill_{ini}$', '$trill_{end}$'])[source]#
wavesongs.utils.tools.rk4(f, v: ndarray, dt: float)[source]#

Implentation of Runge-Kuta 4th order

Parameters:
  • f (function) – differential equations functions y’=f(y)

  • v (np.ndarray [x,y,i1,i2,i3]) – array with the differential variables

  • dt (float) – rk4 time step

Returns:

rk4 – reulst approximation

Return type:

np.ndarray [x,y,i1,i2,i3]

Example

>>>
wavesongs.utils.tools.is_notebook() bool[source]#