Amarok / Manual / Różne / Moodbar

From KDE UserBase Wiki
Revision as of 06:00, 8 August 2018 by FuzzyBot (talk | contribs) (Updating to match new version of source page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Pasek nastroju

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.

Wymagania

  • 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.


Sposób użycia

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.

Instalacja

Pliki źródłowe
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.

Jeśli znajdziesz jakiekolwiek błędy, prosimy o raport na bugs.kde.org.

Pakiety Debiana

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.

Pakiety dla Ubuntu oraz Kubuntu

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.

Lub wklej poniższą linię w Firefoksie lub Konquerorze i wciśnij Enter.

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

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.

Paczki RPM

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
Pakiety openSUSE

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.

Jeśli potrzebujesz informacji na temat dodawania repozytoriów odwiedź openSUSE wiki.


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


Pakiety Mandrivy

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.

Więcej informacji na temat AUR oraz używania PKGBUILDów w 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.

Aby zainstalować port:

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

Aby dodać pakiet:

pkg_add -r gstreamer-plugins-moodbar

Skrypt do generowania plików Moodbara

Poniżej znajduje się prosty skrypt basha, który doda pliki .mood do całej Twojej kolekcji. Dodaje on pliki do każdego pliku o odpowiednim rozszerzeniu w obecnym katalogu oraz wszystkich podkatalogach, zatem najlepiej jest uruchomić go w głównym katalogu z muzyką.

#!/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

Skopiuj i wklej cały skrypt do pliku tekstowego o nazwie moodbar.sh w Twoim katalogu z muzyką i uruchom następujące komendy:

cd /path/to/music
 bash moodbar.sh

Gdyby powyższy sposób nie zadziałał, możesz spróbować:

chmod +x moodbar.sh
 ./moodbar.sh

Dla dużych kolekcji może to wymagać niezwykle długiego czasu! Pamiętaj, że paski nastroju nie pojawią się w Amaroku dopóki Amarok nie przeskanuje ponownie kolekcji. Utworzone pliki mood będą poprzedzone kropkami, lub będą plikami ukrytymi - pamiętaj o tym jeśli nie będziesz mógł znaleźć żadnego z nich.

Poniżej znajduje się oparta na powyższym skrypcie alternatywa dla procesorów wielordzeniowych:

#!/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


Rozwiązywanie problemów

  • 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.

Obsługiwane typy plików

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

Zrzuty ekranu

Pasek nastroju w suwaku postępu w Amaroku 2
Pasek nastroju w suwaku postępu w Amaroku 2