musicflower.loader.load_file

musicflower.loader.load_file(data, n, use_cache=False, recompute_cache=False, audio=None, audio_ext=('.wav', '.mp3', '.ogg'), top_down=True, **kwargs)[source]

Reads a single file and computes its pitch scape with resolution n.

Parameters
  • data (str) – path to file or a tuple with audio data (see get_chroma())

  • n (int) – resolution of pitch scape, i.e., the number of equally-sized time intervals to split the piece into

  • use_cache – whether to use/reuse cached results; these are stored in cache files specific for each resolution n (see get_cache_file_path()). The kwargs are stored with the cache files and checked for consistency; an error is raised if they do not match the provided kwargs. If use_cache is True and a cache file exists, the cached result is loaded (after checking kwargs for consistency) and returned; if the cache file does not exist, the result is computed and stored in a newly created cache file. This behaviour can be changed by using recompute_cache.

  • recompute_cache – if caching is used, always recompute the result and overwrite potentially existing cache files

  • audio – specifies that this is an audio file (audio_ext is ignored)

  • audio_ext – assumes all files with an extension in this list to be audio files, all other files to be symbolic

  • top_down – use the top-down ordering for flattening the triangular map (as used by the TMap class); if False the start-to-end convention from the pitchscapes library is used

  • kwargs – kwargs to passed to the pitchscapes.reader.sample_scape() function of the pitchscapes library (for symbolic data) or the audio_scape() function (for audio data); by default normalise=True is injected into kwargs, but this is overwritten by an explicitly specified value

Return type

np.ndarray

Returns

array of shape (k , 12), where k=n(n+1)/2