Computational Music and Sound Archiving¶
The Computational Music and Sound Archiving system provides high-level audio feature extraction facilities for multi-viewpoint music similarity analysis.
Music similarity is hard to analyse. A viewpoint highlights certain aspects of musical perception. Asking for similarity regarding pitch requires another viewpoint than asking for rhythm similarity.
COMSAR combines pre-selected low-level audio features to Track objects, which represent a viewpoint.
Installation¶
Installation from PyPi¶
comsar is available on PyPi. Simply run the following command in your favorite terminal emulator:
pip install comsar
Installation from source¶
Installation from source is done in two steps:
If you do not have git installed, simply navigate to the source code repository, click on the green “Code” button and then select “Download ZIP”. Otherwise, clone the source code with git:
git clone https://github.com/ifsm/comsar
Once the code is downloaded, change to the comsar root directory and advise Python to install the pacakge:
cd path/to/comsar python3 -m pip install .
Basic usage¶
In order to compute audio features regarding a certain track, you just have to
create an instance of your desired track object and then call its
extract()
method with the path to an audio file. Considre the following
example:
from comsar.tracks import TimbreTrack
tt = TimbreTrack()
res = tt.extract('path/to/my_audio.wav')
res.to_pickle('my_features.pkl')
The first line imports the desired Track object, in this case a
TimbreTrack
. The third line creates a TimbreTrack
instance
with the name tt
. The fourth line calls the extract
method of
tt
and passes it the path to an actual audio file. comsar then
processes the audio file and makes the results available under the name
res
. The fifths line eventually saves the results to disc.
Track sytem¶
PitchTrack¶
RhythmTrack¶
TimbreTrack¶
-
class
comsar.tracks.
TimbreTrack
(stft_params: Optional[apollon.signal.container.StftParams] = None, corr_dim_params: Optional[apollon.signal.container.CorrDimParams] = None)¶ High-level interface for timbre feature extraction.
-
__init__
(stft_params: Optional[apollon.signal.container.StftParams] = None, corr_dim_params: Optional[apollon.signal.container.CorrDimParams] = None) → None¶ - Parameters
stft_params – Parameter for STFT.
corr_dim_params – Parameter set for correlation dimension.
-
extract
(path) → pandas.core.frame.DataFrame¶ Run TimbreTrack on audio file.
- Parameters
path – Path to audio file.
- Returns
Extracted features.
-
property
n_features
¶ Returns: Number of features on
TimbreTrack
.
-
FormTrack¶
Implementation of the FormTrack is planed.
Open source¶
comsar is an open source project. It is published under the permissive BSD 3-Clause License. You may change and republish the code for any personal or commercial project. The comsar source code is available on GitHub.