Amarok/Manual/Various/Moodbar: Difference between revisions

From KDE UserBase Wiki
(copied from the Amarok wiki)
 
(added subpage anchor)
 
(61 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:Amarok]]
<languages/>
<translate>


=== The Moodbar === <!--T:1-->


{{Todo|add images or get those from the original article: [http://amarok.kde.org/wiki/Moodbar]}}
<!--T:2-->
The ''Moodbar'' shows you the "mood" of a track, which you can then use to figure out when something interesting happens in the song.


== The Moodbar ==
<!--T:3-->
In order for '''Amarok''' to display moodbars for your music, you will need the '''Moodbar''' program (see below for [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Source Downloads|downloads]] and binary packages). 


The moodbar officially returns as of Amarok 2.2.2! It shows you the "mood" of a track, which you can then use to figure out when something interesting happens in the song.
<!--T:4-->
The '''Moodbar''' package requires '''GStreamer''' and various plugins depending on the filetypes you use (see [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Supported Filetypes|Supported filetypes]]). You will ''not'' need the phonon-backend-gstreamer package to create .mood files.


In order for Amarok to analyze your music files to create moodbars, you will need the moodbar program (see below for [[#Source Downloads|downloads]] and binary packages).  The moodbar package requires gstreamer and various plugins depending on the filetypes you use (see moodbar [[#Supported Filetypes]]).  You will '''not''' need phonon-backend-gstreamer.
<!--T:5-->
 
There are two parts to the new '''Moodbar''' implementation: the '''Moodbar''' package, which contains a program that takes a music file and generates a .mood file, and support code in the '''Amarok''' source, which runs the binary and displays the Moodbar.  The '''Moodbar''' package depends on the ''GStreamer'' libraries.  Without the '''Moodbar''' package, '''Amarok''' cannot generate the moodbars for your music.  
The Moodbar of Amarok 2.2.2 has been entirely rewritten. There are two parts to the new moodbar implementation: the moodbar package, which contains a program that takes a music file and generates a .mood file, and support code in the Amarok source, which runs the binary and displays the moodbar.  The moodbar '''package''' depends on the GStreamer libraries.  Without the moodbar package, Amarok cannot generate the moodbars for your music.


The moodbar is as always originally due to Gavin Wood and Simon O'Keefe, who designed the algorithms; their original paper is [http://cratoo.de/amarok/ismir-crc.pdf here]. This reimplementation is by [[User:QBob|QBob]]. Thanks to [[User:gruen0|gruen0]] for good ideas, code, and maintaining the ebuild. Huge props go to [[User:Danglewtf|dangle]] for help troubleshooting.
<!--T:6-->
As an alternative, there is a new script which will create moodbar files for tracks in an '''Amarok''' playlist; this is an exception to the above. The script needs nothing but '''Amarok''' to work, but it only creates the .mood files as they are played in the '''Playlist'''.


=== Summary of Requirements ===
<!--T:7-->
The '''Moodbar''' is due to the work of Gavin Wood and Simon O'Keefe, who designed the algorithms; their original paper is [http://cratoo.de/amarok/ismir-crc.pdf here].


* A version of Amarok with a "Use moods" option in the General section of the configuration screen. This means 1.4.4 or higher in the 1.4 series or 2.2.2 or higher in the 2.x series. You should tick this after you have met the other requirements.
</translate><span id="Summary of Requirements"></span> <translate>


* The Moodbar binary, in your PATH ( it should be listed upon running "which moodbar" from a console) -- Remember to configure the moodbar package with './configure --prefix=`pkg-config --variable=prefix gstreamer-0.10`'
==== Summary of Requirements ==== <!--T:8-->


* The GStreamer 0.10 library and [[#Supported Filetypes|plugins for the formats you want moodbar to be able to analyse]]
<!--T:9-->
* The '''Moodbar''' binary, in your PATH (it should be listed upon running {{Input|1=which moodbar}}from a console) &mdash; Remember to configure the '''Moodbar''' package with proper path, e.g. build and install with commands {{Input|1=./autogen.sh --prefix=`pkg-config --variable=prefix gstreamer-1.0` && make && sudo make install}}


* The "Fastest Fourier Transform In The West" (http://www.fftw.org) FFTW library version 3.0 or above (at least single-precision floating point version - libfftw3f) -- Remember to configure the FFTW package with './configure --enable-single'
<!--T:10-->
* The GStreamer 1.0 library and [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Supported Filetypes|plugins]] for the formats you want '''Moodbar''' to be able to analyse. (An earlier GStreamer 0.10 based version is also still available for some distributions)


=== Usage ===
<!--T:11-->
* The ''Fastest Fourier Transform In The West'' ([http://www.fftw.org fftw.org])  FFTW library version 3.0 or above (at least single-precision floating point version - libfftw3f) &mdash; If your platform does not provide this for you or you need to compile your own version, remember to configure the  FFTW package with {{Input|1=./configure --enable-single}}


Currently moodbars files will have to be generated manually. To do this for your entire collection, use the [[#Moodbar File Generation Script]] described below.
<!--T:12-->
* A version of '''Amarok''' with a <menuchoice>Use moods</menuchoice> option in the <menuchoice>General</menuchoice> section of the configuration screen. This means 1.4.4 or higher in the 1.4 series or 2.2.2 or higher in the 2.x series.


To enable the display of moodbars in Amarok, activate it in the configuration (Settings -> Configure Amarok -> General -> Show Moodbar in Progress Slider in 2.2.2). Moodbars should now appear in the track sliders in the player window and the playlist window; there will also be a "mood" field that you may add to your playlist layouts.
<!--T:13-->
{{Info|Systems with package managers should automatically install the GStreamer plugins and FFTW along with the Moodbar package if available; this information is provided mostly for people who want or need to compile from source or manually install packages, or where the distribution specific instructions are outdated and no updated moodbar package is yet available.}}


===Installation===
==== Usage ==== <!--T:14-->


==== Source Downloads ====
<!--T:15-->
Currently .mood files ''must'' be generated manually. '''Amarok''' cannot do it for you. To do this for your entire collection, use the [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Moodbar File Generation Script|Moodbar File Generation Script]] described below.


* Latest release: [http://pwsp.net/~qbob/moodbar-0.1.2.tar.gz moodbar-0.1.2.tar.gz] -- this is the moodbar source package, which contains the moodbar program (which generates .mood files from music files), and a GStreamer plugin that does the work.  The moodbar package  needs GStreamer 0.10.* installed, plus the 0.10.* version of [[#Supported Filetypes|various plugins]].  Be sure to install the moodbar package into the '''same prefix''' as GStreamer -- follow the instructions in the INSTALL file.
<!--T:16-->
To enable the display of moodbars in '''Amarok''', activate it in the configuration: <menuchoice>Settings -> Configure Amarok -> General -> Show Moodbar in Progress Slider</menuchoice>. Moodbars should now appear in the track sliders in the player window and '''Playlist'''; there will also be a mood field that you may add to your playlist layouts.


Please find [[User:QBob|QBob]] or [[User:gruen0|gruen0]] on IRC and send us a screenshot! If you find any bugs, please submit a bug report at [http://bugs.kde.org http://bugs.kde.org].
====Installation==== <!--T:17-->


==== Debian packages ====
</translate><span id="Source Downloads"></span><translate>


A package for moodbar is now available in Debian unstable. Simply run apt-get install moodbar. You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support.
===== Source Downloads ===== <!--T:18-->


==== (K)ubuntu packages ====
<!--T:19-->
:Latest release: [https://github.com/Mazhoon/moodbar/archive/v0.1.4.tar.gz moodbar-0.1.4.tar.gz] &mdash; this is the Moodbar source package, which contains the '''Moodbar''' program (which generates .mood files from music files), and a GStreamer plugin that does the work. The Moodbar package  needs GStreamer 1.0.* installed, plus the 1.0.* version of [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Supported Filetypes|various plugins]]. Be sure to install the Moodbar package into the ''same prefix'' as GStreamer &mdash; follow the instructions in [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Summary_of_Requirements | the summary of requirements chapter]]. The 0.1.4 is a a fork of original 0.1.2 sources, updated to use GStreamer 1.0. The old 0.1.2 sources are not reliably available online any more, but packages might be still available for some distributions.


A package for moodbar is available in the official package repository, just ensure the universe section is activated (which should be default anyway). Just install the package 'moodbar' with your prefered package manager (Adept, Synaptic). You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support.
<!--T:20-->
If you find any bugs, please submit a bug report at [http://bugs.kde.org bugs.kde.org].


Or, to install, paste this into firefox or konqueror and hit enter.
===== Debian packages ===== <!--T:21-->


apt://moodbar,gstreamer0.10-plugins-ugly,gstreamer0.10-plugins-good,gstreamer0.10-plugins-bad?section=universe?refresh=yep
<!--T:22-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
A package for Moodbar is now available in Debian unstable. Simply run {{Input|1=apt-get install moodbar}}. You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support.


==== Gentoo ebuilds ====
===== Kubuntu and Ubuntu packages ===== <!--T:23-->


Moodbar is available in Portage, simply emerge moodbar. Unofficial ebuilds are no longer required.
<!--T:24-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
A package for Moodbar is available in the official package repository; just ensure the universe section is activated (which should be default anyway). Just install the package moodbar with your preferred package manager ('''Kpackagekit''', '''Aptitude''', '''Adept''', '''Synaptic'''). You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support.


==== RPM builds ====
<!--T:25-->
Or, to install, paste this into '''Firefox''' or '''Konqueror''' and hit <keycap>Enter</keycap>.


If you are a rpm-based distro user, you can build a .rpm using `rpmbuild` with latest
<!--T:26-->
[http://cvs.pld-linux.org/cgi-bin/cvsweb/SPECS/gstreamer-plugins-moodbar.spec gstreamer-plugins-moodbar.spec]. The binary package will be soon available for [http://pld-linux.org PLD-linux] distro.
{{Input|1=apt://moodbar,gstreamer0.10-plugins-ugly,gstreamer0.10-plugins-good,gstreamer0.10-plugins-bad?section=universe?refresh=yep}}


Contact [[User:vip|vip]] for help with building rpm.
===== Gentoo ebuilds ===== <!--T:27-->


==== Fedora ====
<!--T:28-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
Moodbar is available in Portage, simply {{Input|1=emerge moodbar}} Unofficial ebuilds are no longer required.


In Fedora 7 and higher (up to 12 as of this writing) moodbar is available in the default repositories. Simply install it with your PackageKit GUI or with the following yum command:
===== RPM builds ===== <!--T:29-->


yum install moodbar
<!--T:30-->
 
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated}}
==== openSUSE packages ====
If you are a rpm-based distro user, you can build a .rpm using rpmbuild with latest
 
[http://cvs.pld-linux.org/cgi-bin/cvsweb/SPECS/gstreamer-plugins-moodbar.spec gstreamer-plugins-moodbar.spec]. The binary package will be soon available for [http://pld-linux.org PLD-linux] distro.
openSUSE 11.0 and later, automatically install the following packages
 
*gstreamer-0_10-fluendo-mp3
*gstreamer-0_10-plugins-base
 
Also, if your songs contain ID3 tags, you must install
 
*gstreamer-0_10-plugins-good


Moodbar Installation
===== Fedora ===== <!--T:31-->


1-Click Install for openSUSE 11.* - just choose your version and installation procedure will do the rest:
<!--T:32-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
In Fedora 7 and higher (up to 16 as of this writing) Moodbar is available in the default repositories. Simply install it with your PackageKit GUI or with the following yum command:


[http://software.opensuse.org/ymp/home:dstoecker/openSUSE_11.2/moodbar.ymp openSUSE 11.2]
<!--T:33-->
{{Input|1=yum install moodbar}}


[http://software.opensuse.org/ymp/home:dstoecker/openSUSE_11.1/moodbar.ymp openSUSE 11.1]
===== openSUSE packages ===== <!--T:34-->


[http://software.opensuse.org/ymp/home:dstoecker/openSUSE_11.0/moodbar.ymp openSUSE 11.0]


<!--T:35-->
GStreamer 1.0 based version 0.1.4 is available in KDE:Extra repository for openSUSE Leap 42.3 and later. An earlier GStreamer 0.10 based version 0.1.2 is also still available in the main repository for some openSUSE versions.


If you are using openSUSE 10.3 you can use the packages available in the repository located at http://software.opensuse.org/download/home:/d7/
<!--T:40-->
For details on how to add repositories, see the [http://en.opensuse.org/SDB:Add_package_repositories openSUSE wiki].


To install, add the correct repository for your version of openSUSE to YaST (eg. if you are using openSUSE 10.2, add http://software.opensuse.org/download/home:/d7/openSUSE_10.2/ to the Install Sources in YaST) then make sure the following packages are installed:
* gstreamer-0_10-plugins-good
* gstreamer-0_10-plugins-ugly
* gstreamer-0_10-plugins-moodbar
* mad


For details on how to add repositories, see the [http://en.opensuse.org/Add_Package_Repositories_to_YaST openSUSE wiki].
<!--T:38-->
1-Click Install for openSUSE - just choose your version and installation procedure will do the rest:
* [https://software.opensuse.org/ymp/KDE:Extra/KDE_Frameworks5_openSUSE_Tumbleweed/moodbar.ymp openSUSE Tumbleweed]
* [https://software.opensuse.org/ymp/KDE:Extra/openSUSE_Leap_15.0/moodbar.ymp openSUSE Leap 15.0]
* [https://software.opensuse.org/ymp/KDE:Extra/openSUSE_Leap_42.3/moodbar.ymp openSUSE Leap 42.3]


If you are using the Smart software management tool, add the channel by entering the following at the command line, remember to change the URL to match your version of openSUSE: "smart channel --add http://software.opensuse.org/download/home:/d7/openSUSE_10.2/home:d7.repo". Then enter "smart update home:d7". You can now install the required packages by "smart install gstreamer10-plugins-moodbar". Dependencies are resolved automatically.


==== Mandriva packages ====
===== Mandriva packages ===== <!--T:42-->


<!--T:43-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
First of all, you need to add PLF repositories, so visit [http://easyurpmi.zarb.org easyurpmi.zarb.org] and add them to your repositories list.
First of all, you need to add PLF repositories, so visit [http://easyurpmi.zarb.org easyurpmi.zarb.org] and add them to your repositories list.
Then simply install the following packages:
Then simply install the following packages:


<!--T:44-->
* gstreamer0.10-moodbar
* gstreamer0.10-moodbar
* gstreamer0.10-plugins-ugly
* gstreamer0.10-plugins-ugly
Line 111: Line 131:
* gstreamer0.10-plugins-bad
* gstreamer0.10-plugins-bad


==== FreeBSD ====
===== Arch Linux ===== <!--T:45-->


There is a port [http://www.freshports.org/audio/gstreamer-plugins-moodbar audio/gstreamer-plugins-moodbar].
<!--T:46-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
There is a PKGBUILD for Moodbar in the [http://aur.archlinux.org Arch User Repository (AUR)] available [http://aur.archlinux.org/packages.php?ID=6552 here].


To install the port: ''cd /usr/ports/audio/gstreamer-plugins-moodbar/ && make install clean''
<!--T:47-->
For more information about the AUR and working with PKGBUILDs, see the [http://wiki.archlinux.org/index.php/AUR_User_Guidelines AUR User Guidelines].


To add the package: ''pkg_add -r gstreamer-plugins-moodbar''
===== FreeBSD ===== <!--T:48-->


=== Moodbar File Generation Script ===
<!--T:49-->
{{Note|This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.}}
There is a port: [http://www.freshports.org/audio/gstreamer-plugins-moodbar audio/gstreamer-plugins-moodbar here].


There was a handy ruby utility here for creating and managing moodbar files. Unfortunately, the old download link is dead and I was unable to find a copy elsewhere. So, until a better solution comes along, here is a simple bash script that will add .mood files to your entire collection. It adds mood files for all files matching the extensions in the current directory and all subdirectories, so it's best run from the base of your music directory.  Now, without further ado:
<!--T:50-->
To install the port: {{Input|1=cd /usr/ports/audio/gstreamer-plugins-moodbar/ && make install clean}}
To add the package: {{Input|1=pkg_add -r gstreamer-plugins-moodbar}}


  <code>#!/bin/bash
</translate><span id="Moodbar File Generation Script"></span><translate>
 
==== Moodbar File Generation Script ==== <!--T:51-->
 
<!--T:52-->
Here is a simple bash script that will add .mood files to your entire collection. It adds mood files for all files matching the extensions in the current directory and all subdirectories, so it's best run from the base of your music directory.
</translate>
 
{{Input|1=
  <syntaxhighlight lang="bash" line>#!/bin/bash
  DIR=${1:-.}
  DIR=${1:-.}
  LAST=~/.moodbar-lastreadsong
  LAST=~/.moodbar-lastreadsong
Line 130: Line 166:
  control_c()        # run if user hits control-c
  control_c()        # run if user hits control-c
  {
  {
   echo "$1" > "$LAST"
   echo "" > "$LAST"
   echo "Exiting..."
   echo "Exiting..."
   exit
   exit
Line 151: Line 187:
  exec 9<&-
  exec 9<&-
   
   
  exit $C_RET</code>
  exit $C_RET</syntaxhighlight>}}


<translate>
<!--T:53-->
Copy and paste the above into a text file named moodbar.sh in your music directory and run the following commands:
Copy and paste the above into a text file named moodbar.sh in your music directory and run the following commands:
 
<!--}}-->{{Input|1=
  cd /path/to/music
  cd /path/to/music
  sh moodbar.sh
  bash moodbar.sh
}}<!--{{-->


<!--T:54-->
Alternatively if the above does not work, you may try:
Alternatively if the above does not work, you may try:
 
<!--}}-->{{Input|1=
  chmod +x moodbar.sh
  chmod +x moodbar.sh
  ./moodbar.sh
  ./moodbar.sh
}}<!--{{-->


This may take a very long time for large collections! Note that the moodbars will not appear in Amarok until Amarok rescans the collection. The generated mood files will be dotfiles (ie, prefixed with a full stop), or hidden files - so keep this in mind if you can't find any generated mood files.
<!--T:55-->
This may take a very long time for large collections! Note that the moodbars will not appear in '''Amarok''' until '''Amarok''' rescans the collection. The generated <tt>mood</tt> files will be dotfiles (i.e., prefixed with a full stop), or hidden files - so keep this in mind if you can't find any generated mood files.


<!--T:56-->
Based on the above script, an alternative for multicore CPUs:
Based on the above script, an alternative for multicore CPUs:
  <code>#!/bin/bash
</translate>
 
{{Input|1=
  <syntaxhighlight lang="bash" line>#!/bin/bash
  NUMCPU="$(grep ^processor /proc/cpuinfo | wc -l)"
  NUMCPU="$(grep ^processor /proc/cpuinfo | wc -l)"
   
   
  find . -type f -regextype posix-awk -iregex '.*\.(mp3|ogg|flac|wma)' | while read i ; do
  find . -type f -regextype posix-awk -iregex '.*\.(mp3|ogg|flac|wma)' | while read i ; do
   
   
        if [ `jobs -p | wc -l` -ge $NUMCPU ] ; then
        while [ `jobs -p | wc -l` -ge $NUMCPU ] ; do
                 wait
                 sleep 0.1
         fi
         done
   
   
         TEMP="${i%.*}.mood"
         TEMP="${i%.*}.mood"
Line 180: Line 226:
                 moodbar -o "$OUTF" "$i" &
                 moodbar -o "$OUTF" "$i" &
         fi
         fi
  done
  done</syntaxhighlight>}}
</code>
 
<translate>


TODO: would it be possible to use hidden files (with leading dot) for this, because it would not clubber dir listings that much? [[User:Blueyed|Blueyed]] 18:31, 19 March 2010 (UTC)
==== Troubleshooting ==== <!--T:58-->


TODO: I think this would be a great thing for an Amarok script: the script would look into the playlist and generate the moodbar information/file for the upcoming file(s).
<!--T:59-->
However, it seems that Amarok must get told to forget about any loaded meta info, before playing the file / after creating the file. [[User:Blueyed|Blueyed]] 18:31, 19 March 2010 (UTC)
* If the '''Moodbar''' executable gives you a ''bus error'', that almost always means it can't decode (or can't find) your file.  Take a look at the [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Supported Filetypes|supported file types]] below for ideas on which GStreamer plugins to install.  You can also try the command below to test whether GStreamer can decode your file:{{Input|1=gst-launch-1.0 filesrc location=[file] ! decodebin ! fakesink}}


TODO: A copy of that old Ruby Script is found here: http://forum.kde.org/viewtopic.php?f=119&t=84811  - Unfortunately I don't have the Python nor Amarok knowledge to port this to 2.2.2, but it would be great, if it would come back (I loved the feature to store the .mood files outside my collection - I dont want them to clutter all my mp3 folders)
<!--T:67-->
* If you are using the ffmpeg plugin to decode mp3s, you may also receive mysterious bus errors. The solution is to stop using the ffmpeg plugin, as it is extremely buggy &mdash; use mad instead.


=== Troubleshooting ===
<!--T:68-->
* If the '''Moodbar''' executable tells you that it can't find an element &mdash; i.e., it gives an error message like {{Output|1=Could not create element of type fftwspectrum, please install it.}}&mdash; that usually means that you either don't have the required plugins installed (see the plugin list [[Special:myLanguage/Amarok/Manual/Various/Moodbar#Supported Filetypes|here]]), or that you didn't install the Moodbar package in the same prefix as GStreamer. If libmoodbar.so and libgstdecodebin.so are not in the same directory, then Moodbar is not installed in the same prefix as GStreamer.  Please read the INSTALL file for instructions on how to configure the moodbar package correctly. Alternatively, ''if you know what you're doing,'' it may be easier for you to take a look at the <tt>GST_PLUGIN_PATH</tt> environment variable.


* If the moodbar executable gives you a "bus error", that almost always means it can't decode (or can't find) your file.  Take a look at the [[#Supported Filetypes|supported file types]] below for ideas on which GStreamer plugins to install.  You can also try the command below to test whether GStreamer can decode your file:
<!--T:69-->
      gst-launch filesrc location=[file] ! decodebin ! fakesink
* If you're wondering why the '''Moodbar''' isn't working, either not working at all or not working for a particular file, run the command below, where [file] is a music file:{{Input|1=moodbar -o test.mood [file]}} To generate a test image preview, one can use the commandː{{Input|1=gst-launch-1.0 filesrc location=[file] ! decodebin ! audioconvert ! fftwspectrum ! moodbar height=50 max-width=300 ! pngenc ! filesink location=mood.png}}


* If you are using the ffmpeg plugin to decode mp3s, you may also receive mysterious bus errors. The solution is to stop using the ffmpeg plugin, as it is extremely buggy -- use mad instead.
<!--T:70-->
* If you have multiple versions of GStreamer installed, make sure all of the required plugins are installed ''for version 1.0.*'' -- different versions ''cannot'' use each other's plugins.


* If the moodbar executable tells you that it can't find an element -- i.e, it gives an error message like "<tt>Could not create element of type fftwspectrum, please install it.</tt>" -- that usually means that you either don't have the required plugins installed (see the plugin list [[#Supported Filetypes|here]]), or that you didn't install the moodbar package in the same prefix as GStreamer.  If libmoodbar.so and libgstdecodebin.so are not in the same directory, then moodbar is not installed in the same prefix as GStreamer.  Please read the INSTALL file for instructions on how to configure the moodbar package correctly.  Alternatively, ''if you know what you're doing,'' it may be easier for you to take a look at the <tt>GST_PLUGIN_PATH</tt> environment variable.
</translate><span id="Supported Filetypes"></span><translate>


* If you're wondering why the moodbar isn't working, either not working at all or not working for a particular file, run the command below, where [file] is a music file:
==== Supported Filetypes ==== <!--T:60-->
      moodbar -o test.mood [file]


* If you have multiple versions of GStreamer installed, make sure all of the required plugins are installed '''for version 0.10.*''' -- different versions ''cannot'' use each other's plugins.
<!--T:61-->
You will need various Gstreamer plugins to enable '''Moodbar''' to analyze your files. Here is a list of the plugins you will need; make sure to install the ''1.0.* version'' of each plugin:


* In Gentoo, the plugin [http://bugs.gentoo.org/show_bug.cgi?id=153671 gst-plugins-mad-0.10.3 appears to be broken], which results in a Moodbar which cannot analyze your MP3 files. Emerge gst-plugins-mad-0.10.4 instead to make it work.
<!--T:62-->
{| border="1" cellpadding="5" <!--}-->
! Filetype !! Required Plugin !! Note</translate>
|-
<translate>
<!--T:71-->
| All || gstreamer-1.0.*, gst-plugins-base, gst-plugins-good</translate>
|-
<translate>
<!--T:72-->
| mp3 || gst-plugins-mad (in gst-plugins-ugly) || ffmpeg plugin has problems; ''do not use'' for mp3</translate>
|-
<translate>
<!--T:73-->
| ogg || gst-plugins-vorbis, gst-plugins-ogg</translate>
|-
<translate>
<!--T:74-->
| flac || gst-plugins-flac</translate>
|-
<translate>
<!--T:75-->
| mp4 || gst-plugins-faad, gst-plugins-bad</translate>
|-
<translate>
<!--T:76-->
| musepack || gst-plugins-musepack</translate>
|-
<translate>
<!--T:77-->
| wma || gst-plugins-ffmpeg
|} <!--{-->


=== Supported Filetypes ===
==== Screenshots ==== <!--T:63-->


You will need various gstreamer plugins to enable moodbar to analyze your files. Here is a list of the plugins you will need; make sure to install the '''0.10.* version''' of each plugin:
<!--T:64-->
[[Image:Amarok2_moodbar.png|600px|center|Moodbar in progress slider in Amarok 2]]


; (everything): gstreamer-0.10.*, gst-plugins-base, ''and'' gst-plugins-good
; mp3: gst-plugins-mad (in gst-plugins-ugly) -- the ffmpeg plugin has problems, so ''do not use it'' for mp3s
; ogg: gst-plugins-vorbis ''and'' gst-plugins-ogg
; flac: gst-plugins-flac
; mp4: gst-plugins-faad ''and'' gst-plugins-bad
; musepack: gst-plugins-musepack
; wma: gst-plugins-ffmpeg


''Please correct this list or ping [[User:gruen0|gruen0]] if you find this list is incorrect.''
<!--T:65-->
{{Prevnext2
| prevpage=Special:myLanguage/Amarok/Manual/Various | nextpage=Special:myLanguage/Amarok/Manual/Various/ReplayGain
| prevtext=Various | nexttext=Replay Gain
| index=Special:myLanguage/Amarok/Manual | indextext=Back to Menu
}}


=== Screenshots ===
<!--T:66-->
* [[:image:Amarok2_moodbar.png|Moodbar in progress slider in Amarok 2]]
[[Category:Amarok2.8]]
[[Category:Multimedia]]
[[Category:Tutorials]]
</translate>

Latest revision as of 13:20, 6 August 2018

The Moodbar

The Moodbar shows you the "mood" of a track, which you can then use to figure out when something interesting happens in the song.

In order for Amarok to display moodbars for your music, you will need the Moodbar program (see below for downloads and binary packages).

The Moodbar package requires GStreamer and various plugins depending on the filetypes you use (see Supported filetypes). You will not need the phonon-backend-gstreamer package to create .mood files.

There are two parts to the new Moodbar implementation: the Moodbar package, which contains a program that takes a music file and generates a .mood file, and support code in the Amarok source, which runs the binary and displays the Moodbar. The Moodbar package depends on the GStreamer libraries. Without the Moodbar package, Amarok cannot generate the moodbars for your music.

As an alternative, there is a new script which will create moodbar files for tracks in an Amarok playlist; this is an exception to the above. The script needs nothing but Amarok to work, but it only creates the .mood files as they are played in the Playlist.

The Moodbar is due to the work of Gavin Wood and Simon O'Keefe, who designed the algorithms; their original paper is here.

Summary of Requirements

  • The Moodbar binary, in your PATH (it should be listed upon running
    which moodbar
    from a console) — Remember to configure the Moodbar package with proper path, e.g. build and install with commands
    ./autogen.sh --prefix=`pkg-config --variable=prefix gstreamer-1.0` && make && sudo make install
  • The GStreamer 1.0 library and plugins for the formats you want Moodbar to be able to analyse. (An earlier GStreamer 0.10 based version is also still available for some distributions)
  • The Fastest Fourier Transform In The West (fftw.org) FFTW library version 3.0 or above (at least single-precision floating point version - libfftw3f) — If your platform does not provide this for you or you need to compile your own version, remember to configure the FFTW package with
    ./configure --enable-single
  • A version of Amarok with a Use moods option in the General section of the configuration screen. This means 1.4.4 or higher in the 1.4 series or 2.2.2 or higher in the 2.x series.

Information

Systems with package managers should automatically install the GStreamer plugins and FFTW along with the Moodbar package if available; this information is provided mostly for people who want or need to compile from source or manually install packages, or where the distribution specific instructions are outdated and no updated moodbar package is yet available.


Usage

Currently .mood files must be generated manually. Amarok cannot do it for you. To do this for your entire collection, use the Moodbar File Generation Script described below.

To enable the display of moodbars in Amarok, activate it in the configuration: Settings -> Configure Amarok -> General -> Show Moodbar in Progress Slider. Moodbars should now appear in the track sliders in the player window and Playlist; there will also be a mood field that you may add to your playlist layouts.

Installation

Source Downloads
Latest release: moodbar-0.1.4.tar.gz — this is the Moodbar source package, which contains the Moodbar program (which generates .mood files from music files), and a GStreamer plugin that does the work. The Moodbar package needs GStreamer 1.0.* installed, plus the 1.0.* version of various plugins. Be sure to install the Moodbar package into the same prefix as GStreamer — follow the instructions in  the summary of requirements chapter. The 0.1.4 is a a fork of original 0.1.2 sources, updated to use GStreamer 1.0. The old 0.1.2 sources are not reliably available online any more, but packages might be still available for some distributions.

If you find any bugs, please submit a bug report at bugs.kde.org.

Debian packages

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

A package for Moodbar is now available in Debian unstable. Simply run

apt-get install moodbar

. You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support.

Kubuntu and Ubuntu packages

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

A package for Moodbar is available in the official package repository; just ensure the universe section is activated (which should be default anyway). Just install the package moodbar with your preferred package manager (Kpackagekit, Aptitude, Adept, Synaptic). You will likely also want to install gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-good, and gstreamer0.10-plugins-bad for format support.

Or, to install, paste this into Firefox or Konqueror and hit Enter.

apt://moodbar,gstreamer0.10-plugins-ugly,gstreamer0.10-plugins-good,gstreamer0.10-plugins-bad?section=universe?refresh=yep
Gentoo ebuilds

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

Moodbar is available in Portage, simply

emerge moodbar

Unofficial ebuilds are no longer required.

RPM builds

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated

If you are a rpm-based distro user, you can build a .rpm using rpmbuild with latest gstreamer-plugins-moodbar.spec. The binary package will be soon available for PLD-linux distro.

Fedora

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

In Fedora 7 and higher (up to 16 as of this writing) Moodbar is available in the default repositories. Simply install it with your PackageKit GUI or with the following yum command:

yum install moodbar
openSUSE packages

GStreamer 1.0 based version 0.1.4 is available in KDE:Extra repository for openSUSE Leap 42.3 and later. An earlier GStreamer 0.10 based version 0.1.2 is also still available in the main repository for some openSUSE versions.

For details on how to add repositories, see the openSUSE wiki.


1-Click Install for openSUSE - just choose your version and installation procedure will do the rest:


Mandriva packages

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

First of all, you need to add PLF repositories, so visit easyurpmi.zarb.org and add them to your repositories list. Then simply install the following packages:

  • gstreamer0.10-moodbar
  • gstreamer0.10-plugins-ugly
  • gstreamer0.10-plugins-good
  • gstreamer0.10-plugins-bad
Arch Linux

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

There is a PKGBUILD for Moodbar in the Arch User Repository (AUR) available here.

For more information about the AUR and working with PKGBUILDs, see the AUR User Guidelines.

FreeBSD

Note

This section contains old instructions for the GStreamer 0.10 based moodbar version 0.1.2, they might be outdated.

There is a port: audio/gstreamer-plugins-moodbar here.

To install the port:

cd /usr/ports/audio/gstreamer-plugins-moodbar/ && make install clean

To add the package:

pkg_add -r gstreamer-plugins-moodbar

Moodbar File Generation Script

Here is a simple bash script that will add .mood files to your entire collection. It adds mood files for all files matching the extensions in the current directory and all subdirectories, so it's best run from the base of your music directory.

#!/bin/bash
 DIR=${1:-.}
 LAST=~/.moodbar-lastreadsong
 C_RET=0
 
 control_c()        # run if user hits control-c
 {
   echo "" > "$LAST"
   echo "Exiting..."
   exit
 }
 
 if [ -e "$LAST" ]; then
   read filetodelete < "$LAST"
   rm "$filetodelete" "$LAST"
 fi
 exec 9< <(find "$DIR" -type f -regextype posix-awk -iregex '.*\.(mp3|ogg|flac|wma)') # you may need to add m4a and mp4
 while read i
 do
   TEMP="${i%.*}.mood"
   OUTF=`echo "$TEMP" | sed 's#\(.*\)/\([^,]*\)#\1/.\2#'`
   trap 'control_c "$OUTF"' INT
   if [ ! -e "$OUTF" ] || [ "$i" -nt "$OUTF" ]; then
     moodbar -o "$OUTF" "$i" || { C_RET=1; echo "An error occurred!" >&2; }
   fi
 done <&9
 exec 9<&-
 
 exit $C_RET

Copy and paste the above into a text file named moodbar.sh in your music directory and run the following commands:

cd /path/to/music
 bash moodbar.sh

Alternatively if the above does not work, you may try:

chmod +x moodbar.sh
 ./moodbar.sh

This may take a very long time for large collections! Note that the moodbars will not appear in Amarok until Amarok rescans the collection. The generated mood files will be dotfiles (i.e., prefixed with a full stop), or hidden files - so keep this in mind if you can't find any generated mood files.

Based on the above script, an alternative for multicore CPUs:

#!/bin/bash
 NUMCPU="$(grep ^processor /proc/cpuinfo | wc -l)"
 
 find . -type f -regextype posix-awk -iregex '.*\.(mp3|ogg|flac|wma)' | while read i ; do
 
        while [ `jobs -p | wc -l` -ge $NUMCPU ] ; do
                sleep 0.1
        done
 
        TEMP="${i%.*}.mood"
        OUTF=`echo "$TEMP" | sed 's#\(.*\)/\([^,]*\)#\1/.\2#'`
        if [ ! -e "$OUTF" ] ; then
                moodbar -o "$OUTF" "$i" &
        fi
 done


Troubleshooting

  • If the Moodbar executable gives you a bus error, that almost always means it can't decode (or can't find) your file. Take a look at the supported file types below for ideas on which GStreamer plugins to install. You can also try the command below to test whether GStreamer can decode your file:
    gst-launch-1.0 filesrc location=[file] ! decodebin ! fakesink
  • If you are using the ffmpeg plugin to decode mp3s, you may also receive mysterious bus errors. The solution is to stop using the ffmpeg plugin, as it is extremely buggy — use mad instead.
  • If the Moodbar executable tells you that it can't find an element — i.e., it gives an error message like
    Could not create element of type fftwspectrum, please install it.
    — that usually means that you either don't have the required plugins installed (see the plugin list here), or that you didn't install the Moodbar package in the same prefix as GStreamer. If libmoodbar.so and libgstdecodebin.so are not in the same directory, then Moodbar is not installed in the same prefix as GStreamer. Please read the INSTALL file for instructions on how to configure the moodbar package correctly. Alternatively, if you know what you're doing, it may be easier for you to take a look at the GST_PLUGIN_PATH environment variable.
  • If you're wondering why the Moodbar isn't working, either not working at all or not working for a particular file, run the command below, where [file] is a music file:
    moodbar -o test.mood [file]
    To generate a test image preview, one can use the commandː
    gst-launch-1.0 filesrc location=[file] ! decodebin ! audioconvert ! fftwspectrum ! moodbar height=50 max-width=300 ! pngenc ! filesink location=mood.png
  • If you have multiple versions of GStreamer installed, make sure all of the required plugins are installed for version 1.0.* -- different versions cannot use each other's plugins.

Supported Filetypes

You will need various Gstreamer plugins to enable Moodbar to analyze your files. Here is a list of the plugins you will need; make sure to install the 1.0.* version of each plugin:

Filetype Required Plugin Note
All gstreamer-1.0.*, gst-plugins-base, gst-plugins-good
mp3 gst-plugins-mad (in gst-plugins-ugly) ffmpeg plugin has problems; do not use for mp3
ogg gst-plugins-vorbis, gst-plugins-ogg
flac gst-plugins-flac
mp4 gst-plugins-faad, gst-plugins-bad
musepack gst-plugins-musepack
wma gst-plugins-ffmpeg

Screenshots

Moodbar in progress slider in Amarok 2
Moodbar in progress slider in Amarok 2