Become a member of the iLounge Forums. Register Now!
To start viewing messages, select the forum that you want to visit from the selection below.
If this is your first visit, be sure to check out the Forum FAQ and Forum Policy.

Topic: Technical explanation of the well-known resume play position bug: How Apple could fix

Reply Thread Tools Topic Search
 
Old 07-31-2005, 02:36 AM
#1
 
Freshman Lounger
 
Join Date: Apr 2005
Posts: 12
Technical explanation of the well-known resume play position bug: How Apple could fix

I kinda hoped myself that people would stop posting about this iPod shuffle bug because it's the only real weak point about the shuffle and I know that someday Apple will fix it with a firmware update, but I think that I have a decent explanation for it, and a hint to a solution for Apple engineers.

Maybe the original shuffle programmer left the company and now Apple is struggling to understand the source code... That's when reverse-engineering like I did can be useful

The common assumption from people is that this problem happens at random, and that pausing the tune before turning it off prevents the bug from happening.

In reality though, this bug is reproducible, and pausing before turning it off doesn't help it.

Try this with your iPod shuffle:

1- Turn it on, in sequential play mode. (It will also work if it's already on, but make sure to select and play a new song -while- in sequential mode)
2- Choose a song and play it, let's say it's song 42.
3- Turn it off while it plays, or you can pause before but it won't change anything
4- Turn it back on, switching directly to the random play mode. You don't have to be quick though.
5- Press play: surprise surprise! it's -not- song 42, the one playing when you turned it off, it's another song! Let's say it's song number 74.

If you were playing the beginning of song 42, you will notice that song 74 is also playing at the beginning...If tune 42was in the middle, the "wrong" resumed tune (74) will also start in the middle etc. So the playhead position inside a tune is always correctly saved, the track number is what is messed up when saving.

Furthermore, you can try the following, after having performed steps 1-5.
6- Switch back to sequential mode without turning off, while tune 74 is now playing.
7- Click the previous song button on the click wheel and a weird thing happens: it jumps from song 74 to song 42!
8- Click forward, and you get the next song in sequence: 43, as expected.

So the next time you encounter this bug, check if you are in shuffle mode, the answer is likely yes.

Now here is my own technical explanation, which I may forward to Apple engineers:

In the invisible iPod_Control/iTunes/ folder inside the shuffle, there is a small file named "iTunesPState". The PState is likely short for Play State, and it contains just that, the playing state info. According to ipodlinux.org, it contains seven 24-bits values, the first one is the volume level. The second value is the "shufflepos" which (most of the time) contains the current track number in the shuffle order. The third value, "trackpos", always contains the current track number in the normal sequential order.

These track values seems to be saved only when you change tracks or when you first resume or play a track after you turn it on.

The bug seems to be that the shufflepos value written when you are in the sequential order is wrong. In that case, instead of containing the matching shuffle order position for the current song, it contains exactly the same value as trackpos, which is the current track number in sequential order. When you resume play from a cold start and put it in shuffle mode, this value is read as a position in the pre-generated shuffle order list, which leads to the wrong song...

Let's say you have 10 songs on your iPod shuffle: At certain specific occasions like when you tripple click the play button when in shuffle mode, the random order list is created. It could look like that:
[9,2,5,6,1,8,10,3,4,7]

The sequential order could be represented as this:
[1,2,3,4,5,6,7,8,9,10]

Let's say you select tune 3 while in sequential mode, value 3 will be saved in the shufflepos variable, instead of 8 like it should be (song 3 is position 8 in this particular random order list). If you turn it off and back on but in the shuffle mode, when you resume, value 3 is read as a position in the random list and song 5 is played (song 5 is at position 3 in the random list).

The fix? Prevent the iPod Shuffle from writing the current normal order position in the shufflepos data when in sequential mode, and instead make it write the correct matching position in the random order.

Apple engineers, if for some crazy reason you read this, this is the only major bug in the iPod Shuffle and it's been since March since we didn't have a firmware update. The fix should be simple... no?

In any case, I certainly over-explained it

Last edited by vl-tone; 07-31-2005 at 07:00 AM.
vl-tone is offline  
Reply With Quote

Join the iLounge Community and the ad above will disappear.

Old 07-31-2005, 02:50 AM
#2
 
The Tie-Dye Alchemist
 
Join Date: Mar 2005
Location: Horsham, PA
Posts: 482

Good job though. I'm not gonna lie and say I read ALL of that. I read the first bit and had every question about the topic answered. Very inciteful post .



Peace, Love & All That Jazz
| 5G--60GB iPod | 2G--iPod Shuffle | 4G--16GB Nano |
.................~1576 Artists l ~ 2320 Albums..............
----------------------------------------------
30195 songs l 99.5 days l 151.82 gigs
kevmakara is offline  
Reply With Quote
Old 07-31-2005, 04:52 AM
#3
 
Freshman Lounger
 
Join Date: Apr 2005
Posts: 12

It's ok that you didn't read it all, since I mostly explained the same thing multiple times in many different ways, getting more technical at the end
vl-tone is offline  
Reply With Quote
Old 07-31-2005, 01:20 PM
#4
 
dnd
Senior Lounger
 
Join Date: Apr 2005
Posts: 150

Phew, luckly my life doesn't revolve around my Shuffle, so I don't give a ****...



1GB 1st gen Shuffle/ER-4P headphones
dnd is offline  
Reply With Quote
Old 08-01-2005, 02:22 AM
#5
 
Freshman Lounger
 
Join Date: Apr 2005
Posts: 12

Quote:
Originally posted by dnd
Phew, luckly my life doesn't revolve around my Shuffle, so I don't give a ****...
Hopefully mine either, I spent "only" 2 hours investigating this bug, in my whole life, it's insignificant....

But the question most people here in the iPod shuffle forum might have for you dnd is: If you don't give a ****, why did you spend time replying to my post? And while we're at it, why do you spend any time in this forum? To show us in your sig that you own an iPod shuffle?
vl-tone is offline  
Reply With Quote
Old 08-01-2005, 05:28 PM
#6
 
dnd
Senior Lounger
 
Join Date: Apr 2005
Posts: 150

RESULT!!!!

Nah, seriously, you can get 'bugs' even in audiophile equipment - my CYRUS stuff sometimes crashes and I have to power down to reset it - it's not worth worrying about...



1GB 1st gen Shuffle/ER-4P headphones

Last edited by dnd; 08-01-2005 at 05:33 PM.
dnd is offline  
Reply With Quote
Old 08-02-2005, 01:56 AM
#7
 
Freshman Lounger
 
Join Date: Apr 2005
Posts: 12

Quote:
Originally posted by dnd
RESULT!!!!

Nah, seriously, you can get 'bugs' even in audiophile equipment - my CYRUS stuff sometimes crashes and I have to power down to reset it - it's not worth worrying about...
You seem to think I'm trying to bash the shuffle or something like that... "au contraire" as they say. I own one, I'm very happy about it, and I don't mind that bug that much myself. I know a couple of people that bought or are thinking of buying one, mostly because of me

One of my friend, bought his shuffle very recently, he is sometimes very critical of Apple, and this kind of bug could annoy him enough that he won't buy the Mac mini he's thinking of getting, or an eventual full size iPod.

So the real problem is that many people that tried or own iPod shuffles now think that Apple is making a flaky product, because of a bug that could be fixed by changing two lines of code (but that they don't know, they think that it's an unfixable design flaw or flaky chips). This bug is now taboo... while there was many posts about this before on iPod support forums, somehow, most anyone posting about it now are almost flamed for it... And it's not like a random crash like it can happen on just about anything with a processor and a program in some particular context, it's a reproducible bug that happens every-time when using certain main features of the iPod shuffle.

I posted new information about the bug, most anything posted about it before was obscure and confusing. I nailed the bug and the precise context when it happens, and I'm sharing it with people that are interested. These people will now know that the shuffle isn't as flaky as they could think, and that there is simply a bug that Apple didn't find yet. Even the best programmers can sometimes search "around" a bug for a long time before finding it, even a simple one. Before posting my solution to Apple, I thought that here would be a good place to discuss with intelligent people interested in this bug too. (Boy I was wrong! )

One thing I forgot in my first post though, is a temporary way to avoid the bug that anyone can understand and use. Here it is:

When you turn on your iPod Shuffle, always put it in the sequential mode before pressing play for the first time. That way you are about 100% sure that it'll start at the saved position, in the same song. Do this only when once after turning it on. If you don't mind the bug, use your shuffle any way you want...
vl-tone is offline  
Reply With Quote
Old 08-03-2005, 05:50 PM
#8
 
Freshman Lounger
 
Join Date: May 2005
Posts: 23

vl-tone,

I (not surprisingly) have the same issue with my new 512MB Shuffle (pause, wait untill light stops flashing, turn off, wait 5 seconds, turn on, resumes at the wrong song).

You mentioned you may forward your fix idea to Apple tech support - have you done this?

I am interested to know if Apple have admitted the problem yet, and if so, when they expect to release new firmware to correct the problem.

Regards,

Ash

UPDATE:
So today I chatted with an Apple support rep online, who read this thread. He said the following about the issue:

Quote:
apple has not recongized this as a useability issue. if you have a song playing and pause it, and then turn [off] the iPod shuffle, it is going to shuffle the next song it plays.
I ignored the fact that when you resume from 'off' in either mode, it should resume to the same track, and asked 'if this was the intended behavior, why does it resume partway through the song?'

Quote:
this is an expected operation of the iPod shuffle, and to my knowledge apple has no plans to address this in future Software updates. now if you wish to bring the to the attention of our engineers the best thing for your to do is submitt an email from this website
So, basically (according to the person I dealt with), this is completely expected and intended operation. I'm glad it wasn't face-to-face support, as I don't think it would be possible to convey this with a straight face.

Last edited by ashtonaut; 08-04-2005 at 10:27 PM.
ashtonaut is offline  
Reply With Quote
Old 08-05-2005, 06:43 PM
#9
 
Freshman Lounger
 
Join Date: May 2005
Posts: 23

I had a spare ten minutes, so I confirmed that what vl-tone thought the problem was is in fact correct. Here's what I did:

Loaded the Shuffle with ten tracks. I then checked the iTunesShuffle file, and found the following order for 'shuffle' mode:

8,2,4,9,3,1,6,7,5,0

(note, obviously, that 0 is the first track, 1 the second, and so on...)

I then removed the Shuffle, and listened to the first two tracks (track 0 and track 1) in sequential mode. About 15 seconds into track 2, I switched the Shuffle off. When I checked the iTunesPState file, I found the following:

shufflepos = 2 <--- This should be 1, as vl-tone explained previously
trackpos = 2

I modified the iTunesPState file on the Shuffle so shufflepos = 1, and removed the Shuffle.

Not surprisingly, when I resumed straight to Shuffle mode, I was in the exact position I was when I turned it off (15 seconds into track 2).

I then skipped around a bit in sequential mode, returning to track 2. After 15 seconds, I switched the Shuffle off, waited a while, then resumed straight to Shuffle mode. This time however, I was 15 seconds into track 4 (i.e. the wrong track, correct time).

This doesn't get us anywhere closer to a fix because it still requires a firmware update, but, if Apple fix the firmware so it writes the correct shufflepos to iTunesPState, the problem will definitely be fixed...


Ash
ashtonaut is offline  
Reply With Quote
Old 08-07-2005, 03:51 AM
#10
 
Freshman Lounger
 
Join Date: Apr 2005
Posts: 12

ashtonaut, thank you to show that I'm not crazy

I didn't forwarded this to Apple yet, I'm trying to figure out what should I write to them... I'll do it through their bug fix form on their site, not through an online rep.

Still, it's very interesting that you got the rep to read this thread and comment it

I wonder if it's an "official" response or just a thing he cooked up with other reps on the moment.

Obviously, it cannot be the intended behavior, and it's clearly linked to a bug.

If you turn off the shuffle while playing a song that started to play in the shuffle mode, the shuffle will resume at the same song and time like it's described in Apple's own documentation. So in that case it's not even behaving like the rep said it should.

The bug only happens when you turn it off while playing in shuffle, then back on and start to play in the sequential mode. The problem is not that it's not the same song playing, but that the song is resumed at the same place it should have been in the song you were listening before turning it off.

I can accept that the shuffle mode would always start a random song like the rep claims, but it's not the case. Sometimes it does resume correctly in shuffle mode and sometimes it doesn't, and when the bug happens a pseudo-random song is resumed in the middle or some other semi-random place.

Clearly, starting at the exact time you were listening before turning it off but in another song cannot be the intended behavior and even more so since the shuffle mode doesn't even have this bug every time.

(Ok I think I've described this bug enough times...)

Edit: I just sent a bug report to Apple yesterday, with all the details. I didn't get an answer yet, but we're on the week-end and they say they don't necessarily reply to bug reports. Maybe my reply will come in the form of the long due iPod Shuffle firmware update 1.2

Last edited by vl-tone; 08-08-2005 at 01:20 AM.
vl-tone is offline  
Reply With Quote

Topic: Technical explanation of the well-known resume play position bug: How Apple could fix

Reply Thread Tools Topic Search

Become a member of the iLounge Forums. Register Now!
To start viewing messages, select the forum that you want to visit from the selection below.
If this is your first visit, be sure to check out the Forum FAQ and Forum Policy.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





View iLounge History. Read our old Forums Archive (2001-2003)
All times are GMT -4. The time now is 03:48 AM.


Shop for Accessories: Cases, speakers, chargers, etc.