Amarok/Manual/Diverse/Stemningslinje

From KDE UserBase Wiki
Revision as of 13:10, 6 August 2018 by Claus chr (talk | contribs)

Stemningslinjen

Stemningslinjen viser dig et spors "stemning", som du kan bruge til at finde ud af, om der sker noget interessant i nummeret.

Amarok skal bruge programmet Moodbar for at kunne lave stemningslinjer for din musik (se nedenfor om downloads og binære pakker).

Pakken Moodbar skal bruge GStreamer og diverse plugins afhængigt af, hvilke filtyper du bruger (se Understøttede filtyper). Du har ikke brug for pakken phonon-backend-gstreamer for at lave .mood-filer.

Den nye implementering af Stemningslinjen består af to dele: dels pakken Moodbar, som indeholder et program, som tager en musikfil og genererer en .mood-fil, dels understøttelse i Amarok selv, som viser stemningslinjen. Pakken Moodbar afhænger af GStreamer-bibliotekerne. Uden pakken Moodbar kan Amarok ikke generere stemningslinjer for din musik.

Som et alternativ er der et nyt script, som kan lave moodbar-filer for spor i en af Amaroks spillelister. Dette er en undtagelse til ovenstående. Scriptet skal blot bruge Amarok for at virke, men laver kun .mood-filer når de spilles i Spillelisten.

Stemningslinjen skyldes Gavin Woods and Simon O'Keefes arbejde. De designede algoritmerne; deres oprindelige artikel er her.

Oversigt over forudsætningerne

  • Programmet Moodbar skal findes i din PATH (det skal blive fundet, hvis du kører
    which moodbar
    i en konsol) — husk at konfigurere pakken Moodbar med den korrekte sti. Du kan fx bygge og installere med kommandoerne
    ./configure --prefix=`pkg-config --variable=prefix gstreamer-0.10`
  • 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)
  • Biblioteket FFTW (Den hurtigste Fouriertransformation i vesten, fftw.org) i version 3.0 eller derover (mindst en udgave med single-precision flydende-tal - libfftw3f) — hvis din platform ikke giver dig dette, eller hvis du er nødt til at kompilere din egen version, så husk at konfigurere pakken FFTW med
    ./configure --enable-single
  • En udgave af Amarok med tilvalget Vis stemningslinje i fremgangslinjen i afsnittet Generelt i indstillingsdialogen, det vil sige version 1.4.4 eller højere i 1.4-serien eller 2.2.2 eller højere i 2.x-serien.

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.


Brug

I øjeblikket skal .mood-filerne genereres manuelt. Amarok kan ikke gøre det for dig. For at gøre det for hele din musiksamling kan du bruge scriptet til at generere stemningslinjer, som beskrevet nedenfor.

For at muliggøre visning af stemningslinjer i Amarok skal det aktiveres i indstillingerne: Indststillinger -> Indstil Amarok... -> Generelt -> Vis stemningslinje i fremgangslinjen. Nu skulle stemningslinjer dukke op i skyderen for sporet i afspillervinduet og i Spillelisten. Der er også en stemningslinje, som du kan føje til dit spillelistelayout.

Installation

Download kildekoden
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.

Hvis du opdager programfejl, så indrapportér dem venligst til bugs.kde.org.

Pakker til Debian

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.

Pakker til Kubuntu og Ubuntu

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.

Du kan også kopiere følgende ind i adresselinjen i Firefox eller Konqueror og taste 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.

Bygning af RPM pakker

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
Pakker til 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.

Detaljer om, hvordan du tilføjer arkiver kan du finde i openSUSE's wiki.


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


Pakker til Mandriva

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.

Find mere information om AUR og hvordan PKGBUILD'er virker i 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.

For at installere port'en skriv

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

For at tilføje pakken skriv

pkg_add -r gstreamer-plugins-moodbar

Script til at generere .mood-filer

Her er et simpelt bash-script, som føjer .mood-filer til hele din samling. Det tilføjer en .mood-fil for enhver fil, som matcher filendelserne i den aktuelle mappe og alle dens undermapper, så det er lettest at køre scriptet fra roden af dit musikbibliotek.

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

Kopier ovenstående og sæt det ind i en tekstfil ved navn moodbar.sh i din musikmappe og kør så følgende:

cd /path/to/music
 bash moodbar.sh

Hvis ovenstående ikke virker, så kan du i stedet prøve med

chmod +x moodbar.sh
 ./moodbar.sh

Dette kan tage lang tid, hvis din samling er stor! Bemærk, at stemningslinjer ikke vil dukke op i Amarok før Amarok genscanner samlingen. De genererede mood-filer vil være skjulte filer (dvs. deres navn starter med et punktum) - husk det, hvis du ikke kan finde de genererede mood-filer.

Her er et alternativt script til multicore-CPU'er baseret på ovenstående:

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


Problemløsning

  • 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
  • Hvis du bruger plugin'et ffmpeg til af decode mp3'er, så kan du også få mystiske bus-fejl. Løsningen er at holde op med at bruge plugin'et ffmpeg, da det har mange fejl — brug mad i stedet.
  • Hvis programmet Moodbar fortæller dig, at det ikke kan finde et element — hvis det fx giver dig en fejlmeddelelse som denne:
    Could not create element of type fftwspectrum, please install it.
    — så betyder det i reglen at du enten ikke har installeret det nødvendige plugin (se listen med plugins) eller at du ikke installerede pakken Moodbar i samme prefiks som GStreamer. Hvis libmoodbar.so og libgstdecodebin.so ikke ligger i samme mappe, så er Moodbar ikke installeret i samme prefiks som GStreamer. Find instruktioner om, hvordan man konfigurerer pakken moodbar korrekt i filen INSTALL . Det kan også være lettere at bruge miljøvariablen GST_PLUGIN_PATH hvis du ved hvad du gør.
  • 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.

Understøttede filtyper

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 Nødvendigt plugin Note
All gstreamer-1.0.*, gst-plugins-base, gst-plugins-good
mp3 gst-plugins-mad (i gst-plugins-ugly) plugin'et ffmpeg har problemer; brug det ikke til 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

Skærmbilleder

Stemningslinjen i fremgangsskyderen i Amarok 2
Stemningslinjen i fremgangsskyderen i Amarok 2