Welcome to py_sonicvisualiser’s documentation!

py_sonicvisualiser

py_sonicvisualiser is a framework for manipulating environment files to be used with sonic visualiser, and application for viewing and analysing the contents of music audio files http://www.sonicvisualiser.org/

This module is currently restricted to the generation of sonic visualiser environment files (export). Parsing (import) of such files will be hopefully supported in the next releases. Feel free to contribute if you like this project!

SVEnv class

class py_sonicvisualiser.SVEnv(wavpath)

This class allows to generate sonic visualiser environment files

__init__(wavpath)

Init a sonic visualiser environment structure

Args:
wavpath(str): Full path to the wav file used in the current environment
add_continuous_annotations(x, y, colourName='Purple', colour='#c832ff', name='', view=None, vscale=None)

add a continous annotation layer

Args:
x (float iterable): temporal indices of the dataset y (float iterable): values of the dataset
Kwargs:
view (<DOM Element: view>): environment view used to display the spectrogram, if set to None, a new view is created
Returns:
<DOM Element: view>: the view used to store the spectrogram
add_interval_annotations(temp_idx, durations, labels, values=None, colourName='Purple', colour='#c832ff', name='', view=None)

add a labelled interval annotation layer

Args:
temp_idx (float iterable): The temporal indices of invervals durations (float iterable): intervals durations labels (string iterable): interval labels values (int iterable): interval numeric values, if set to None, values are set to 0
Kwargs:
view (<DOM Element: view>): environment view used to display the spectrogram, if set to None, a new view is created
add_spectrogram(view=None)

add a spectrogram layer to the environment

Kwargs:
view(<DOM Element: view>): environment view used to display the spectrogram, if set to None, a new view is created
Returns:
<DOM Element: view>: the view used to store the spectrogram
save(outfname)

Save the environment of a sv file to be used with soniv visualiser

Args:
outfname(str): full path to the file storing the environment

Example

import sys
import numpy as np
from py_sonicvisualiser import SVEnv

wavfname = sys.argv[1]
outsvenvfname = sys.argv[2]

# init a sonic visualiser environment file corresponding
# to the analysis of media wavfname
sve = SVEnv(wavfname)

# append a spectrogram view
specview = sve.add_spectrogram()

# append a continuous annotation layer corresponding to a sinusoidal signal
# on the spectrogram view previously defined
x = np.array(range(10000, 20000, 5)) / 1000.
sve.add_continuous_annotations(x, 1 + 3 * np.sin(2 * x), view=specview)

# append a labelled interval annotation layer on a new view
intvtime = [1., 5., 21.5]
intvdur = [3., 11., 5.]
intvlabel = ['myintv1', 'mywonderfull  intv2', 'intv3']
intvval = [0, 1, 5]
sve.add_interval_annotations(intvtime,intvdur,intvlabel,intvval)

# save the environment to a sonic visualiser environment file
sve.save(outsvenvfname)

AUTHOR

David Doukhan - LIMSI-CNRS - doukhan@limsi.fr - david.doukhan@gmail.com

CREDITS

This module has been initiated the framework of the ANR Project DIADEMS http://www.irit.fr/recherches/SAMOVA/DIADEMS

Table Of Contents

This Page