Dunya-desktop Documentation

_images/dunya-desktop-github.png

Dunya-desktop is a desktop application, developed for accessing and visualizing music data such as music scores, audio recordings, extracted features and analysis results. It is a modular and extendable desktop application that the users can customise according to their needs.

_images/dunya-desktop-demo.gif

Dunya-desktop mainly uses PyQt5 Python bindings for Qt5 application framework, for the user interface design and pycompmusic module for reaching the backend of the Dunya-web.


Installation

The code is compatible with Python 2.7+ and Python 3. We highly recommend you to use the code with Python 3 and with a virtual environment.


Installing dependencies on MacOS

The given installation steps were tried on OS El Capitan (v10.11.06) and OS El Sierra (v10.12.1).

  • Install Xcode (can be installed via Mac App Store. Then install command-line tools:

    xcode-select --install
    sudo xcodebuild -license
    

    After the installation, make sure that you have agreed Apple’s licence agreement.

  • Install Homebrew package manager:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

On Mac OS for Python 3.6

  • Install Python 3.6+, Qt 5.7 and wget with Homebrew:

    brew install python3 qt@5.7 ffmpeg wget
    
  • Create a virtual environment (virtualenv) and install requirements.

    pyvenv env
    source env/bin/activate
    
  • Go to directory of where dunya-desktop is downloaded.

    IMPORTANT: Don’t forget to change ‘path/to/dunya-desktop’ with the

    actual directory name.

    cd path/to/dunya-desktop
    
    • Finally, install the package requirements.
    pip3 install -r requirements
    pip3 install PyQt5
    

On Mac OS for Python 2.7

  • Install Python 2.x, Qt 5.7, ffmpeg and wget with Homebrew:

    brew install python qt@5.7 ffmpeg wget
    
  • Download PyQt 5.7.1 and SIP source packages:

    wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19/sip-4.19.tar.gz
    wget https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.7.1/PyQt5_gpl-5.7.1.tar.gz
    
  • Untar and compile PyQt 5.7.1 and SIP:

    # compile sip
    tar -xvf sip-4.19.tar.gz
    cd sip-4.19
    python configure.py -d /usr/local/lib/python2.7/site-packages/
    make
    sudo make install
    
    # compile PyQt5
    cd ..
    tar -xvf PyQt5_gpl-5.7.1.tar.gz
    cd PyQt5_gpl-5.7.1
    python configure.py --confirm-license -d /usr/local/lib/python2.7/site-packages/ --qmake=/usr/local/Cellar/qt\@5.7/5.7.1/bin/qmake --sip=../sip-4.19/sipgen/sip --sip-incdir=../sip-4.19/siplib
    make
    sudo make install
    
  • Create a virtual environment (virtualenv) and install requirements.

    pip install virtualenv
    virtualenv --system-site-packages env
    source env/bin/activate
    
  • Go to directory of where dunya-desktop is downloaded.

    IMPORTANT: Don’t forget to change ‘path/to/dunya-desktop’ with the actual directory name.

    cd path/to/dunya-desktop
    
  • Finally, install the package requirements.

    pip install -r requirements
    

Installing dependencies on Ubuntu 16.04

The given installation steps were tried on Ubuntu 16.04.02 LTS (xenial).

  • Install Qt 5.x and ffmpeg:

    sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
    sudo apt-get update -qq
    sudo apt-get install -qq qtdeclarative5-dev libqt5svg5-dev qtmultimedia5-dev build-essential
    sudo apt-get install -qq ffmpeg
    export QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
    

On Ubuntu for Python 3.6

  • Install Python 3.6

    sudo apt-get install -qq python3-dev
    
  • Create a virtual environment (virtualenv) and install requirements.

    pyvenv env
    source env/bin/activate
    
  • Go to directory of where dunya-desktop is downloaded.

    IMPORTANT: Don’t forget to change ‘path/to/dunya-desktop’ with the actual directory name.

    cd path/to/dunya-desktop
    
  • Finally, install the package requirements.

    pip3 install -r requirements
    pip3 install PyQt5
    

On Ubuntu for Python 2.7

  • Install Python 2.x

    sudo apt-get install -qq python-dev
    
  • Download PyQt 5.8 and SIP source packages:

    wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.1/sip-4.19.1.tar.gz
    wget https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.8/PyQt5_gpl-5.8.tar.gz
    
  • Untar and compile PyQt 5.8 and SIP:

    # compile sip
    tar -xzf sip-4.19.1.tar.gz
    cd sip-4.19.1/
    python configure.py
    make
    sudo make install
    cd ..
    
    # compile PyQt5
    tar -xzf PyQt5_gpl-5.8.tar.gz
    cd PyQt5_gpl-5.8/
    python configure.py --confirm-license --qmake=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
    make
    sudo make install
    
  • Create a virtual environment (virtualenv) and install requirements.

    pip install virtualenv
    virtualenv --system-site-packages env
    source env/bin/activate
    
  • Go to directory of where dunya-desktop is downloaded.

    IMPORTANT: Don’t forget to change ‘path/to/dunya-desktop’ with the actual directory name.

    cd path/to/dunya-desktop
    
  • Finally, install the package requirements.

    pip install -r requirements
    

Annotated Screenshots of The Software

Main Window

_images/dunya-desktop-main-annotated.png

Collection Dialog

_images/dunya-desktop-coll-dialog.png

Player Main Window

_images/dunya-desktop-playermain.png

Histogram Dialog

_images/dunya-desktop-histogram.png

Score Dialog

_images/dunya-desktop-scoredialog.png

Metadata Dialog

_images/dunya-desktop-metadata.png

Main UI

class mainui_makam.MainWindowMakam[source]

The main window of makam


Widgets

Combobox

class widgets.combobox.ComboBox(parent)[source]

Combobox of the attributes.

add_items(attribute)[source]

Adds the items of given attribute to the combobox

change_background(color=”)[source]

Changes the background color of the combobox according to the query results of

change_lineedit_status()[source]

Changes the background color of the combobox according to the user

check_lineedit_status()[source]

Checks the lineedit widget and set the cancel button as visible/invisible

get_attribute_id()[source]

Returns the id of selected item

mousePressEvent(QMouseEvent)[source]

Popups the filtering dialog when the combobox is clicked.

reset_attribute_selection()[source]

Resets the selection.

resizeEvent(QResizeEvent)[source]

Sets the position of cancel button.

set_selection(index)[source]

Sets the selected item on the combobox.

wheelEvent(QWheelEvent)[source]

Wheel event of mouse is disabled.


Player Frame

class widgets.playerframe.PlayerFrame(recid, parent=None)[source]
add_1d_roi_items(f_type, item)[source]

Adds 1d roi item.

Parameters:
  • f_type – (str) Feature type
  • item – (str) Feature subtype
player_pos_changed(playback_pos)[source]

Updates the positions of cursors when playback position is changed. Changes the waveform region item according to the position of playback.

Parameters:playback_pos – (int) Position of player in milliseconds.
plot_1d_data(f_type, feature)[source]

Plots 1D data.

Parameters:
  • f_type
  • feature
wf_region_changed()[source]

Updates the plots according to the change in waveform region item.


Tab Widget

class widgets.tabwidget.TabWidget(parent=None)[source]

Tab widget of related collection/s


Table Widget

_images/table-uml.png
class widgets.table.TableView(parent=None)[source]
contextMenuEvent(event)[source]

Pops up the context menu when the right button is clicked.

get_selected_rows()[source]

Returns the current selected rows in the table.

send_rec()[source]

Emits ‘open_dunya_triggered’ signal and the current index to open the player

send_to_db(coll)[source]

Emits ‘add_to_collection’ signal to add the selected rows to the database


class widgets.table.TableViewResults(parent=None)[source]

Table view widget of query results.


class widgets.table.TableViewCollections(parent=None)[source]

class widgets.table.TableWidget(parent=None)[source]
refresh_row(docid)[source]

checks the status and the title columns of given row


class widgets.table.DialogCollTable(parent)[source]

class widgets.table.TablePlaylist(parent=None)[source]

Tree Widgets

_images/treewidget-uml.png
class widgets.treewidget.FeatureTreeWidget(parent=None)[source]
class widgets.treewidget.MBItem(mb_link)[source]
class widgets.treewidget.MetadataTreeMakam(metadata_dict, parent=None)[source]

Time Series Widget

_images/timeserieswidget.png
_images/timeseries-uml.png
class widgets.timeserieswidget.TimeSeriesWidget(parent=None)[source]
add_1d_view()[source]

Adds a 1d view to TimeSeriesWidget where you can plot and add items on it.

add_tonic(values)[source]

Adds tonic lines on the pitch plot.

Parameters:values – (list or numpy array) A sequence of tonic values in Hz.
change_yaxis_range()[source]

Changes the y-axis range according to the selected region in y-axis.

static find_nearest_index(n_array, value)[source]
Parameters:
  • n_array – (numpy_array)
  • value – (float)
Returns:

(int) Index of the nearest item in the given list.

plot_histogram_raxis(vals, bins)[source]

Plots histogram to the right axis.

Parameters:
  • vals – (list or numpy array) List of valley values of histogram.
  • bins – (list or numpy array) List of bins values of histogram in Hz
plot_pitch(pitch_plot, x_start, x_end, hop_size)[source]

Plots the given pitch_plot array.

Parameters:
  • pitch_plot – (numpy array or list) List of pitch values. Ex: [234.5, 234,3, 234.0, …]
  • x_start – (int or float) Time stamp of starting point in seconds.
  • x_end – (int or float) Time stamp of ending point in seconds.
  • hop_size – (int) Hop size in samples. Ex: 128.
static remove_given_items(obj, items)[source]

Removes the given items from the given object

Parameters:
  • obj – pyqtgraph.GraphicsWidget object
  • items – (list) Sequence of pyqtgraph.GraphicsObject object
set_hist_cursor_pos(pos)[source]

Sets the position of histogram in y-axis.

Parameters:pos – (int or float) Playback position in seconds.
update_notes(xmin, xmax)[source]

Plots the note squares on the time series widget according to the given region.

Parameters:
  • xmin – (int) Minimum value of the region selector item
  • xmax – (int) Maximum value of the region selector item
update_plot(start, stop, hop_size)[source]

Updates the view of the plot region with given time stamps.

Parameters:
  • start – (int or float) Time stamp of starting point in seconds.
  • stop – (int or float) Time stamp of ending point in seconds.
  • hop_size – (int) Hop size in samples. Ex: 128.

Waveform Widget

_images/widget-waveform.png
_images/waveform-uml.png
class widgets.waveformwidget.WaveformWidget[source]
add_section(time, label, title, color)[source]

Plots the section on waveform widget.

Parameters:
  • time – (int) Position in seconds.
  • label – (str) Label of the given seciton.
  • title – (str) Title of the given section.
  • color – (tuple) RGBa values of a color. Ex: (20, 170, 100, 80)
change_wf_region(x_start, x_end)[source]

Sets the position of the waveform region item on the waveform widget.

Parameters:
  • x_start – Start point of the region item in seconds.
  • x_end – End point of the region item in seconds.
get_waveform_region

Returns the current position of the waveform region item in seconds if the waveform region item exists.

Returns:xmin, xmax (float): Minimum and maximum values of waveform region item
plot_waveform(raw_audio)[source]

Plots the given raw audio.

Parameters:raw_audio – (list of numpy array) List of floats.
remove_sections()[source]

Removes the sections plotted on waveform widget.

update_wf_vline(playback_pos_sample)[source]

Updated the position of vertical line.

Parameters:playback_pos_sample – (int) Position of playback in samples.

Widget Utilities

widgets.widgetutilities.current_pitch(sample, pitch_plot)[source]

Returns the current pitch value in Hz. :param sample: (int) Index of sample.

Returns:(float) Pitch in Hz.
widgets.widgetutilities.cursor_pos_sample(pos, samplerate, hopsize)[source]

Returns the current index of sample.

Parameters:pos – (int or float) Playback position in seconds.
widgets.widgetutilities.downsample_plot(plot_array, ds_limit)[source]

Downsamples the given pitch array according to the given downsample limit.

Parameters:
  • plot_array – (numpy array) A sequence of pitch values [440.4, 442.3, 440.0, …]
  • ds_limit – (int) Maximum number of samples to be plotted.
Returns:

(numpy array) A sequence of pitch values


Extensions

Adaptive Synthesis for SymbTr Score Collection

License

The source code hosted in this repository is licenced under the terms of the GNU Affero General Public License (v3 or later). Any data (the audio recordings, music scores, features, figures, outputs etc.) are licenced under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Acknowledgements

Dunya-desktop is supported by the European Research Council under the European Union’s Seventh Framework Program, as part of the CompMusic project (ERC grant agreement 267583).

Indices and tables