Rockbox Technical Forums

Support and General Use => Audio Playback, Database and Playlists => Topic started by: doctafonk on August 24, 2006, 12:41:19 AM

Title: Fade on stop/pause - via Line-out
Post by: doctafonk on August 24, 2006, 12:41:19 AM
Hi All

Usually I use my iPod/rockbox with an external headphone amp via the line-out port. This doesnt seem to be compatible with the "Fade on stop/pause" feature.

If I have the feature switched on and then press pause, the music will keep playing for a second (or however long the fade time is) and then stop. It seems like it's trying to do the fade, but the fade itself isnt sent via the line-out.

Is this fixable? Should i report as a bug?

Thanks
Title: Re: Fade on stop/pause - via Line-out
Post by: Llorean on August 24, 2006, 12:44:34 AM
The line out plays at line-level. Fade works by decreasing the volume, which you may have noticed doesn't affect the Line Out port. It sounds like a bug, though I'm not sure how fixable this is (or more specifically, whether this can be fixed on targets where the line out is hard-locked at 0dB)
Title: Re: Fade on stop/pause - via Line-out
Post by: doctafonk on August 24, 2006, 01:00:38 AM
Thanks for the quick reply.

ah yes. I see your point. I guess Im stuck. I do really like the fade feature but I dont want to go through the hastle of turning it on and off depending on whether I use my amp or not. And waiting that 1 second for the pause while using the line-out is painfull :P

Anyway, no biggie
Title: Re: Fade on stop/pause - via Line-out
Post by: Llorean on August 24, 2006, 01:01:12 AM
You should report this though. It's at least fixable on the iPods.
Title: Re: Fade on stop/pause - via Line-out
Post by: doctafonk on August 24, 2006, 01:25:41 AM
ok thanks. I created it here. (http://www.rockbox.org/tracker/task/5877)

edit: Can I edit my bug report? I put some bbc code in there, but it doesnt like it and now I cant seem to remove it.
Title: Re: Fade on stop/pause - via Line-out
Post by: bascule on August 24, 2006, 02:40:04 AM
The line out plays at line-level. ...targets where the line out is hard-locked at 0dB)

So this is a hardware feature? Because my H120 Line-out level is affected by the volume control, which I've never liked, as that does not seem like a 'true' line-out to me.
Title: Re: Fade on stop/pause - via Line-out
Post by: Llorean on August 24, 2006, 02:45:39 AM
It's hardware dependent.

On the H100 and H300, the line out is stuck at the same level as the headphone out. If you set it to 0dB, it WILL be a true line out though.

On the iPods, they can be set independently. We've locked the line out at 0dB though theoretically it can be adjusted.

On other players, it will depend on how they're set up.
Title: Re: Fade on stop/pause - via Line-out
Post by: bascule on August 24, 2006, 02:54:19 AM
OK, thanks for that explanation. It's nice to learn something new every day :D
Title: Re: Fade on stop/pause - via Line-out
Post by: senab on August 25, 2006, 02:17:18 PM
Couldn't the fade-in/out be done as a DSP instead, therefore not requiring to change the gain level?

Just a thought.  ;)
Title: Re: Fade on stop/pause - via Line-out
Post by: soap on August 26, 2006, 11:02:14 AM
Would that not consume a large amout of CPU?
Title: Re: Fade on stop/pause - via Line-out
Post by: romero on September 24, 2006, 04:34:08 AM
Quote
It's hardware dependent.

On the H100 and H300, the line out is stuck at the same level as the headphone out. If you set it to 0dB, it WILL be a true line out though.

0dB is all the way up, right?

Thanks!

Damion
Title: Re: Fade on stop/pause - via Line-out
Post by: mnhnhyouh on September 24, 2006, 05:00:03 AM
Yep 0db is full volume.

Though my iPod goes to +6  ???

h
Title: Re: Fade on stop/pause - via Line-out
Post by: Llorean on September 24, 2006, 05:53:34 AM
0dB is the "line level". Anything above that can potentially clip (assuming that the file itself does not clip naturally).
Title: Re: Fade on stop/pause - via Line-out
Post by: rhymesgalore on September 20, 2007, 07:38:55 AM
You should report this though. It's at least fixable on the iPods.

Sorry to bump this old topic, but it's exactly about what i was gonna to ask.


I got a 5.5G 80Gb iPod, and the latest daily build, and fade in on start/pause doesn't work through the lineout.

Has this been fixed, as proposed in this thread?
The obvious answer would be of course no, but i'm asking just in case i messed my config up....
Title: Re: Fade on stop/pause - via Line-out
Post by: preglow on September 20, 2007, 07:58:07 AM
If you ask me, fade in/out should be implemented as a DSP process (where possible). This would help two things: the fade not working on all outputs, and the clicky fades you get on H1x0 and others thanks to the volume control being too coarse. This shouldn't steal much CPU power at all anyway.
Title: Re: Fade on stop/pause - via Line-out
Post by: brenthaag on October 11, 2008, 02:52:51 PM
I have the same problem/request.  I would like to point out that when you skip tracks (and the fade-in/fade-out is turned on), it will fade out the playing song and fade in the new song on the line out--at least it seems to on my iPod color.
Title: Re: Fade on stop/pause - via Line-out
Post by: karashata on October 11, 2008, 03:26:51 PM
I would like to point out that when you skip tracks (and the fade-in/fade-out is turned on), it will fade out the playing song and fade in the new song on the line out--at least it seems to on my iPod color.

You may want to check if you have crossfade on (set to either "Track Skip Only" or "Shuffle and Track Skip"), since that's what crossfade is supposed to do...
Title: Re: Fade on stop/pause - via Line-out
Post by: Falco98 on January 01, 2010, 02:50:27 AM
I would like to point out that when you skip tracks (and the fade-in/fade-out is turned on), it will fade out the playing song and fade in the new song on the line out--at least it seems to on my iPod color.

You may want to check if you have crossfade on (set to either "Track Skip Only" or "Shuffle and Track Skip"), since that's what crossfade is supposed to do...

I'm pretty sure that's exactly the point he was making.  In other words, there are no problems with fading the audio out for a crossfade, but it won't fade out when pausing.  Isn't that a rather simple principle?

I agree with this issue - I just got my 5.5g 80gig ipod and noticed this problem pretty much immediately.  Also I was wondering whether the fade-to-pause is really supposed to take what seems like 2 seconds, since on my iRiver 140 it was always nearly instantaneous.  But I digress:  why can't the fade-on-pause be handled in the same way as the fade out for crossfade (which, once again, works)?  I'm not familiar with the terminology, but it seems some others here were calling this "dsp". 

Also, it seems like it would be nice to be able to set the fade length in milliseconds, or something; i want a fade on pause to avoid a harsh cut-off, but I don't need a 2-second fadeout.
Title: Re: Fade on stop/pause - via Line-out
Post by: JdGordon on January 12, 2010, 07:54:46 PM
fade on pause/stop is currently hard coded and implementing using the output volume. crossfade is implemented using the DSP (digital signal proccessing... software which mangles the output).
If someone were to redo fade to use the DSP then it would work on the lineout and be the same as crossfade. noone has stepped up to do that.
Title: Re: Fade on stop/pause - via Line-out
Post by: saratoga on January 12, 2010, 07:56:04 PM
Using DSP for L/R balance would also be nice so that balance can be adjusted over line out.
Title: Re: Fade on stop/pause - via Line-out
Post by: JdGordon on January 12, 2010, 08:03:50 PM
so someone just needs to come up with a really fast DSP so we can do this stuff at the last possible moment before it goes out to the DAC
Title: Re: Fade on stop/pause - via Line-out
Post by: Multiplex on January 13, 2010, 07:48:23 AM
so someone just needs to come up with a really fast DSP so we can do this stuff at the last possible moment before it goes out to the DAC
I'm assuming that comment is for the fade on pause - L/R balance would be OK using the same mechanism as the other interactive DSP operations - or even the ones that have no special treatment (Replay Gain Pre-Amp for example)

I remember reading some of the code that deals with that and being HUGELY impressed - I've worked on 'professional' projects where the quality of the code was nowhere near as good as Rockbox!
Title: Re: Fade on stop/pause - via Line-out
Post by: Blue Dude on January 13, 2010, 11:58:07 PM
The problem with moving instantaneous user interface effects such as fade-on-pause, key clicks, volume changes, balance, etc. to the DSP is that the DSP is not at all instantaneous.  Depending on the size and mode of the PCM buffer, it can lag by several seconds.  Even setting low latency means an unacceptable 1/4 second or more delay.

Crossfade sounds smooth because it is uses a less granular fade interval than the volume control, but its fade effect is mixed directly into the output buffer, usually with a several second delay.  Quite a lot of trouble goes into making a fade happen in real time.  It's possible to do a real time pause fade in the same fashion, but it would be destructive, requiring a rebuffer every time it's done (effectively equivalent to stop/resume).  This isn't prohibitive, but it's one reason why it's not a trivial change.  It's just plain easier to step the volume down, pause the DMA in hardware, then step up than it is to operate directly on the output buffer, stop everything, and then resume.

Sounds like an interesting project, though...
Title: Re: Fade on stop/pause - via Line-out
Post by: Falco98 on February 14, 2010, 09:55:52 PM
I have checked the changelog (major changes, anyway) and there is no mention of this, but the issue seems to have been fixed in 3.5 -- i am running a 5.5g 80gb ipod, and now when playing thru its line-out in my girlfriend's car, it does fade out and in on stop and pause / resume.  I wish it were mentioned in a changelog somewhere, I'm curious as to what was done.