astronify.utils.data_to_pitch(data_array, pitch_range=[100, 10000], center_pitch=440, zero_point='median', stretch='linear', minmax_percent=None, minmax_value=None, invert=False)[source]

Map data array to audible pitches in the given range, and apply stretch and scaling as required.


Data to map to pitch values. Individual data values should be floats.


Optional, default [100,10000]. Range of acceptable pitches in Hz.


Optional, default 440. The pitch in Hz where that the the zero point of the data will be mapped to.

zero_pointstr or float

Optional, default “median”. The data value that will be mapped to the center pitch. Options are mean, median, or a specified data value (float).


Optional, default ‘linear’. The stretch to apply to the data array. Valid values are: asinh, sinh, sqrt, log, linear


Optional. Interval based on a keeping a specified fraction of data values (can be asymmetric) when scaling the data. The format is [lower percentile, upper percentile], where data values below the lower percentile and above the upper percentile are clipped. Only one of minmax_percent and minmax_value should be specified.


Optional. Interval based on user-specified data values when scaling the data array. The format is [min value, max value], where data values below the min value and above the max value are clipped. Only one of minmax_percent and minmax_value should be specified.


Optional, default False. If True the pitch array is inverted (low pitches become high and vice versa).


The normalized data array, with values in given pitch range.