wavesongs.utils.paths#

Create and manage project directory trees: input audios and results (images, parameters files, and audios)

Classes

ProjDirs([audios, results, metadata, catalog])

Creates a ProjDirs class, which is used to store a project's file structure.

class wavesongs.utils.paths.ProjDirs(audios: AnyStr = './assets/audios', results: AnyStr = './assets/results', metadata: AnyStr = 'spreadsheet.csv', catalog: bool = False)[source]#

Creates a ProjDirs class, which is used to store a project’s file structure. This is required when constructing a Syllable or a Song objects and generally useful to keep paths tidy and in the same location.

Parameters:
  • audios (str ='./assets/audio') – Folder path where the audio records samples are stored.

  • results (str = "./assets/results") – Folder path to store the files and data generated.

  • metadata (str = "spreadsheet.csv") – Name of the csv file with the metadata of the audios. Usually given by the data provider.

Example

>>> proj_dirs = ProjDirs(
>>>     "./assets/audio", "./assets/results", "spreadsheet.csv"
>>> )
__init__(audios: AnyStr = './assets/audios', results: AnyStr = './assets/results', metadata: AnyStr = 'spreadsheet.csv', catalog: bool = False)[source]#

Constructor

find_audios(pretty=False) List | DataFrame[source]#

Search for all audios, mp3 and wav types, in the audios folder.

Parameters:

None

Returns:

files_names – List with the audios files names

Return type:

list

Notes

If the audios folder contains a metadata file, spreadsheet.csv, the method will return a dataframe. However, the parameter files_names always is present.

Example

>>>
audios_info() None[source]#

Get information about the audios folder: audios paths and number of audios.

Parameters:

None

Return type:

None

Example

>>>
find_audio(id: AnyStr) PosixPath[source]#

Find an audio in the audios folder by the id or filename

Parameters:

id (str) – Whole filename of a part of it. Usually, the catalog number.

Returns:

path – Aduio path location.

Return type:

PosixPath

Example

>>>
import_mg(id, no_syllable=0)[source]#
read_mg(file_name: AnyStr, no_syllable: int | AnyStr, type: AnyStr = '') Syllable[source]#

Read motor gesture parameters from csv file

Parameters:
  • proj_dirs (ProjDirs)

  • file_name (AnyStr)

  • no_syllable (Union[int, AnyStr])

  • type (AnyStr = "")

Returns:

synth

Return type:

Syllable

Example

>>>
tree_list(prefix: str = '')[source]#

A recursive generator, given a directory Path object will yield a visual tree structure line by line with each line prefixed by the same characters

tree(prefix: str = '') str[source]#