Bug 77766 - Don't fade between tracks in a playlist
Summary: Don't fade between tracks in a playlist
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 84085 93568 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-16 14:55 UTC by Niels
Modified: 2008-06-06 17:31 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels 2004-03-16 14:55:04 UTC
Version:            (using KDE KDE 3.2.1)
Installed from:    Gentoo Packages

Amarok can fade between tracks, controlled from "transition behavior" in the settings. This is a great feature when I click random tracks in Konqueror. But not so great when listening to a playlist of tracks from a cd, when those tracks are not meant to be faded into each other.

An obvious solution is to disable to crossfading completely, but it's nice to have in some situations. I suggest a new setting: "crossfade single files, but not playlist entries".
Comment 1 Max Howell 2004-03-16 15:35:26 UTC
I thought of this sometime ago also. I'll see what I can do at some point.
Comment 2 Marcelo Vanzin 2004-06-10 21:21:01 UTC
I'd like to add some comments for this wish: something that would be really nice is not only not to use cross-fade for albums, but to have seamless transitions between tracks.

It's pretty common for songs to run into the next song when playing a CD. I can see how this would be kinda hard to implement in a player that uses files, though.

Also, I've been fiddling with the settings to try to achieve something similar to this, and I've found some annoyances:

- It seems that amarok cuts the 1st second of the song when I tell it to start playing. Juk (on the same machine) does not show this behavior, nor any other player I've tried.

- When using cross-fade, the cross-fading works, but a noticeable pause is added  when the cross-fade period is over. Let's say I've set it to cross-fade 2 seconds to the next song; between seconds 2 and 3 of the new song there's a noticeable pause in the playing.

- When changing the cross-fade / no cross fade settings, amarok changes the volume of my sound card...

Well, not all of them are related to this buglist entry, but... :-)
Comment 3 Max Howell 2004-06-27 23:56:10 UTC
*** Bug 84085 has been marked as a duplicate of this bug. ***
Comment 4 Gilles Schintgen 2004-07-25 00:06:47 UTC
Wouldn't it be cool to have some features of the xmms crossfade plugin?
It has the possibility to detect if two songs are already mixed and can disable automatically fading (and I think it does it by actually analyzing the output stream). It also has a gap-killer which kills silence at the beginning or end of a track and it even avoids clicks when changing songs by doing the change when both tracks have a zero sample value. It's quite advanced. But it has two major drawbacks: I can't get it to work with arts (so I would have to use alsa directly which sucks) and I don't like the xmms UI. But this plugin is definitely great. Please try it and see for yourself.
http://www.mynetcologne.de/~nc-eisenlpe2/xmms-crossfade/index.htm
Perhaps its code for detecting consecutive tracks could be interesting to have a look at.
Comment 5 Christian Muehlhaeuser 2004-08-26 06:26:31 UTC
CVS commit by muesli: 

* Fix: Don't crossfade, if we're playing the very next tack of the same
album.

CCMAIL: 77766-done@bugs.kde.org


  M +7 -3      enginecontroller.cpp   1.64


--- kdeextragear-1/amarok/src/enginecontroller.cpp  #1.63:1.64
@@ -259,4 +259,7 @@ void EngineController::play( const MetaB
     if( m_engine->load( url ) )
     {
+        //disable crossfading if we're going to play the next track of the same album
+        bool dontCrossfade = ( bundle.track().toInt() == m_bundle.track().toInt() + 1 ) && ( bundle.album() == m_bundle.album() );
+        
         //assign bundle now so that it is available when the engine
         //emits stateChanged( Playing )
@@ -266,4 +269,5 @@ void EngineController::play( const MetaB
         {
             m_xFadeThisTrack = AmarokConfig::crossfade() &&
+                              !dontCrossfade &&  
                 m_engine->hasXFade() &&
                 !m_engine->isStream() &&


Comment 6 Sebastian Schubert 2004-11-13 22:37:48 UTC
Does that mean that two tracks play perfectly gapless? I tried two flac files with no cross-fading and there was a gap. No gap would be great (like the plugin for XMMS mentioned above does).
Thanks for the work!
Comment 7 Max Howell 2004-11-22 07:10:46 UTC
*** Bug 93568 has been marked as a duplicate of this bug. ***
Comment 8 Sven Krohlas 2004-11-22 07:25:51 UTC
Is this really fixed?
For me Amarok does crossfading between tracks in the playlist, especially between tracks from the same album.
Comment 9 Mark Kretschmann 2004-11-22 07:35:05 UTC
No, to the say truth, it's not fixed. This code was removed again.

But as I have explained to you in private mail, Sven, this function does not make much sense without the availability of true gapless play.
Comment 10 Sven Krohlas 2004-11-22 07:48:22 UTC
Ok, that confused me...
My search for "gapless" found that feature request for gapless play bugs are duped against this one.
So could someone please reopen this as a request for gapless play and playing without crossfading of following songs from the same album? Thanks :)
Comment 11 Reid Kleckner 2005-01-07 01:24:36 UTC
It seems that tracks mesh well under xine-lib but not gstreamer.  I think this ought to be reopened, I have CVS as of December sometime.
Comment 12 Nicolas Dietrich 2005-02-08 00:07:06 UTC
Yeah, please reopen the bug - it's not fixed yet! (And I prefer a small gap over a crossfade which doesn't belong there!)
Comment 13 Max Howell 2005-02-08 00:17:48 UTC
As requested.
Comment 14 Andras Georgy Bekes 2005-02-28 22:12:17 UTC
Gap killing and different behavior for playlist playing and single files may be difficult to implement. I'd like to have different crossfading behavior between  automatic and manual songchange. These are the cases which are independently configurable in the xmms-crossfade plugin: "Start of playback", "automatic songchange", "manual songchange", "manual stop", "end of playlist", "seeking", "pause". This would satisfy everybody's needs.
Comment 15 Thomas Bettler 2005-04-28 21:40:22 UTC
Ah, look, that's just exactly what I wanted to post a bug for. So I vote for implementing the above proposition! (#14)

My idea was two different settings: crossfade ordinary playing / crossfade on selecting next. But that one is even nicer!
Comment 16 Neil Skrypuch 2005-05-10 16:39:57 UTC
I would also like to see true gapless playback in amaroK, it's the one major feature that's missing. amaroK is very nice otherwise, but without gapless playback I can't use it without going crazy. I'd be happy to hack on this feature if someone pointed me in the right direction.
Comment 17 Mark Kretschmann 2005-05-10 16:55:35 UTC
On Tuesday 10 May 2005 16:39, Neil Skrypuch wrote:
> ------- Additional Comments From ns03ja brocku ca  2005-05-10 16:39 -------
> I would also like to see true gapless playback in amaroK, it's the one
> major feature that's missing. amaroK is very nice otherwise, but without
> gapless playback I can't use it without going crazy. I'd be happy to hack
> on this feature if someone pointed me in the right direction.


Help is more than welcome, but I'm afraid this will require a very deep 
understanding of the underlying multimedia backend, for example GStreamer. 
You're invited to look at the engine, it's fairly well documented.
Comment 18 Michael Pujos 2005-10-14 17:01:42 UTC
here's a mail I sent to the xine-devel mailing list and the reply concerning gapless. I suppose the situation in the same with GStreamer. It's a shame the two major engines do not support gapless (yet), this is a rather important feature. XMMS2 and lamip support gapless for gapless friendly formats (ie not mp3). They use their own engine/plugins to talk to codec libs


> What would be needed for a music player using the xine engine to  
> implement true gapless playback of ogg files (in the case of a CD  
> gapless album like a mixed CD). When I mean true gapless, this has  
> nothing to do with crossfading.ogg format support gapless while mp3  
> does not but it can be somewhat done with hacks.
>
> My question is if it must be implemented by xine-lib or at the  
> application level ? My guess is application level but I'd like your  
> opinion.

This definitely needs support from xine-lib to work. But this support  
is not there yet.


Comment 19 Neil Skrypuch 2005-12-22 22:16:42 UTC
It appears that xine-lib now has support for gapless playback, see the release notes here: https://sourceforge.net/project/shownotes.php?release_id=371103

Of particular interest is this part: "Another often requested feature is the gapless playback, that is, switching streams without adding a gap/pause between then. The 'gap' can be very annoying when listening mp3s copied from the same CD. The new gapless playback feature, however, requires support from UI (cvs versions of kaffeine, gxine and xine-ui are known to have
implemented it)."
Comment 20 Ian Monroe 2005-12-23 02:34:36 UTC
Thanks for the pointer Neil. Looking at the xine.h file, the only thing about gapless is one #define of a parameter:
#define XINE_PARAM_GAPLESS_SWITCH         32 /* next stream only gapless swi*/ 

Maybe you just have to set that switch and it will start being gapless? I'll look into this tonight or tomorrow. If it works, it would be worth it to backport to 1.3.
Comment 21 Ian Monroe 2005-12-23 16:18:58 UTC
http://websvn.kde.org/trunk/extragear/multimedia/kaffeine/src/player-parts/kaffeine-part/kxinewidget.cpp?rev=476119&view=rev

It isn't a simple switch :), but it doesn't look too bad to implement. Still trying to see if there isn't any actual documentation on how to use it.
Comment 22 Ian Monroe 2005-12-23 18:49:19 UTC
SVN commit 490917 by ianmonroe:

For xine-lib 1.1.1 and greater, xine engine has gapless play. amaroK is now "The Wall"
compatible.
*Should still compile for older xines.
*Wondering how gapless this is for people with older hardware.
Uses some Kaffeine code.
CCMAIL: hftom@free.fr
CCMAIL: amarok-devel@lists.sf.net
BUGS: 77766


 M  +2 -0      ChangeLog
 M  +22 -5     src/engine/xine/xine-engine.cpp


--- trunk/extragear/multimedia/amarok/ChangeLog #490916:490917
@@ -5,6 +5,8 @@

 VERSION 1.4:
  FEATURES:
+    * For xine-lib 1.1.1 and greater, xine engine has gapless play. amaroK is now "The Wall"
+      compatible. (BR 77766)
    * Option for selecting external web browser in amaroK. No longer requires
      KDE-Base. (BR 106015)
    * Switchable Wikipedia locale. (BR 104383)
--- trunk/extragear/multimedia/amarok/src/engine/xine/xine-engine.cpp #490916:490917
@@ -1,5 +1,7 @@
 /***************************************************************************
- *   Copyright (C) 2004,5 Max Howell <max.howell@methylblue.com>           *
+ *   Copyright (C) 2005 Christophe Thommeret <hftom@free.fr>               *
+ *             (C) 2005   Ian Monroe <ian@monroe.nu>                       *
+ *             (C) 2004,5 Max Howell <max.howell@methylblue.com>           *
 *             (C) 2003,4 J. Kofler <kaffeine@gmx.net>                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
@@ -193,7 +195,13 @@
   xine_set_param( m_stream, XINE_PARAM_METRONOM_PREBUFFER, 6000 );
   xine_set_param( m_stream, XINE_PARAM_IGNORE_VIDEO, 1 );
   #endif
-
+#ifdef XINE_PARAM_EARLY_FINISHED_EVENT
+    if ( xine_check_version(1,1,1) ) {
+        // enable gapless playback
+        debug() << "gapless playback enabled." << endl;
+        xine_set_param(m_stream, XINE_PARAM_EARLY_FINISHED_EVENT, 1 );
+    }
+#endif
   return true;
 }

@@ -225,7 +233,13 @@

      return true;
   }
-
+   else
+   {
+      #ifdef XINE_PARAM_GAPLESS_SWITCH
+        if ( xine_check_version(1,1,1) )
+            xine_set_param( m_stream, XINE_PARAM_GAPLESS_SWITCH, 0);
+      #endif
+   }
   //s_fader will delete itself

   return false;
@@ -552,7 +566,7 @@

    switch( e->type() )
    {
-    case 3000:
+    case 3000: //XINE_EVENT_UI_PLAYBACK_FINISHED
        emit trackEnded();
        break;

@@ -644,7 +658,10 @@
        break;

    case XINE_EVENT_UI_PLAYBACK_FINISHED:
-
+        #ifdef XINE_PARAM_GAPLESS_SWITCH
+            if ( xine_check_version(1,1,1) )
+                xine_set_param( xe->m_stream, XINE_PARAM_GAPLESS_SWITCH, 1);
+        #endif
        //emit signal from GUI thread
        QApplication::postEvent( xe, new QCustomEvent(3000) );
        break;
Comment 23 Andrew Gaydenko 2005-12-28 17:54:56 UTC
For me a playing back is not gapless: next track begins when a seek slider is still at the end of prev track, after a couple of seconds (at the moment the slider changes positions to 0:0) a gap takes place. 

I use ~x86 synced Gentoo. xine has 1.1.1 version.


Must I supply some additional info?
Comment 24 Mark Kretschmann 2005-12-28 18:15:13 UTC
On Wednesday 28 December 2005 17:54, Andrew Gaydenko wrote:
> I use ~x86 synced Gentoo. xine has 1.1.1 version.


Gapless playback has been implemented in 1.4-SVN.
Comment 25 Andrew Gaydenko 2005-12-28 18:21:37 UTC
I mean current SVN version.
Comment 26 Andrew Gaydenko 2005-12-28 18:22:58 UTC
Probably I must to add I use FLAC files.
Comment 27 Andrew Gaydenko 2006-01-10 18:12:29 UTC
OK, I don't know how to prove the bug still exists :-) The only way I have found is here:

  http://gaydenko.com/mix/amarok/gapless/

There is four parts of splitted musical fragment and a file which was recorded with microphone during these fragments playing back. Of course, it is for current SVN. The problem isn't FLAC-related: I have tried wav-files too.

With hope to resolve the issue,
Andrew Gaydenko
Comment 28 Andrew Gaydenko 2006-01-18 03:13:19 UTC
Hm... It is interesting :-), during a week nobody looked at supplied the bug illustration (I mean microphone-recording of splitted fragments playing back).
Comment 29 Ian Monroe 2006-01-18 04:06:16 UTC
There is something weird going on. In your mic-recording and when I listened to the FLACs myself, I heard pops between tracks, which is something I never hear. There very well could be an issue in regards to FLAC. Which it would be a xine-lib problem really. 
Comment 30 Andrew Gaydenko 2006-01-18 12:58:43 UTC
Ian,

In msg #27 I have reported, wav files were tested too with the same effect :-)
Comment 31 Damjan Georgievski 2006-03-04 20:42:28 UTC
So, lets get back to the original wish list..

That is, songs in the playlist are ussually ment ot be played in succession. Thus gapless helps here. 

But on manual intervention (Next, Previous Track, double click on another song in the playlist) it would be nice to crossfade the songs to 'ease' the transition. Is this in 1.4?
Comment 32 Mark Kretschmann 2006-03-04 21:00:05 UTC
Yes, it is. We have an option "Fade on manual track change only" in 1.4.
Comment 33 Andras Georgy Bekes 2006-03-06 20:55:32 UTC
I repeat myself:

I'd like to have different crossfading behavior between automatic and manual songchange. These are the cases which are independently configurable in the xmms-crossfade plugin:
- "start of playback"
- "automatic songchange"
- "manual songchange"
- "manual stop"
- "end of playlist"
- "seeking"
- "pause"

amarok is still behind XMMS without these...

Can we reopen this bug or should I file a new one?
Comment 34 Andrew Gaydenko 2006-03-27 10:06:56 UTC
I'm not C/CPP developer, nevertheless I have tried to scan current SVN tree to find all 'XINE_PARAM_EARLY_FINISHED_EVENT' and 'XINE_PARAM_GAPLESS_SWITCH' occurences. They are found in xine-engine.cpp file only, and in '#ifdef's only. So, the question is: where must these params be defined to make xine work really gapless?
Comment 35 Andrew Gaydenko 2006-04-06 16:33:32 UTC
I have tried xine CVS short 20060328 with the same result as before (see #27).
Comment 36 Jan Holthuis 2008-06-06 17:31:18 UTC
I propose to add a Checkbox in the "Edit metadata"-Dialog when you are editing an album, which is called "Gapless Album" or  something like that. That would be very similar to iTunes, but it would be a great feature when listening to albums which are already mixed.

If this box is checked, the behaviour should be the following:

Gapless Album, some track (e.g. track 1) → Gapless Album, follow-up-track (e.g. track 2)
----→ No crossfading, but gapless play

Gapless Album, some track → Gapless Album, but not follow-up-track
----→ Crossfading, because the album is not properly mixed anymore

Gapless Album, Track 1 → Non-Gapless Album, some track
----→ Crossfading

Non-Gapless Album, some track → Non-Gapless Album, some other track
----→ Crossfading