dhbw.dasp.io module

dhbw.dasp.io.display(data, sr=None)[source]

Displays the specified audio data or file in a Python notebook.

Parameters:
datandarray, string

Audio samples or string containing the file path, with or without the .wav extension.

srinteger, optional

Sample rate in hertz.

dhbw.dasp.io.open(path, cmd='audacity', shell=False, wait=False)[source]

Executes custom command with specified .wav file path as an argument.

Parameters:
pathstring

File path with or without the .wav extension.

cmdstring

Command to execute, e.g. audacity (https://www.audacityteam.org).

shellbool

If true, the command will be executed through the shell.

waitbool

If true, wait for child process to terminate.

dhbw.dasp.io.play(path, cmd='play', shell=False, wait=True)[source]

Executes custom command with specified .wav file path as an argument.

Parameters:
pathstring

File path with or without the .wav extension.

cmdstring

Command to execute, e.g. play (http://sox.sourceforge.net).

shellbool

If true, the command will be executed through the shell.

waitbool

If true, wait for child process to terminate.

dhbw.dasp.io.read(path)[source]

Reads a .wav file.

Parameters:
pathstring

File path with or without the .wav extension.

Returns:
datandarray

Content of the .wav file.

timendarray

Corresponding timeline array.

srinteger

Sample rate in hertz.

dhbw.dasp.io.write(path, data, sr=None, bits=24)[source]

Writes a .wav file.

Parameters:
pathstring

File path with or without the .wav extension.

datandarray

Content of the .wav file.

srinteger, optional

Sample rate in hertz.

bitsinteger, optional

Sample bitwidth.