Home Headphone Heights

Welcome to Headphone Heights, the place for all your ear bud discussion

How to have perfectly random playback on the Altmann Tera Player

Here is a copy of some posts over on Headfi about how to have perfectly random playback on the Tera. I am reposting it here in case this info also gets removed from Headfi: (Note: There is word that Charles has updated the algorithm used in more recent Tera players. You can probably check with him to see if your unit has the new algorithm. If a Tera is using the newer algorithm, then the instructions below become irrelevant. The new algorithm by itself should do a pretty good job of playing music randomly.)

Many of the older Tera players out there use an algorithm that does not create evenly distributed random playback. After a lot of experimentation some of us came up with a system that adjusts for the algorithm on these older Teras and creates perfectly even selection of songs in random play.

Here is a new set of rules that work at every level on the older Teras (root, artist and album) to create perfectly random selection of songs:

1-If there are 1-4 folders or tracks in a particular folder, then add exactly 4 empty folders to that folder, and use numbers (00001, 00002, 00003...00010, 00011, etc.) to name the empty folders so they come before all other folders/tracks (this rule for numbering empty folders applies to all of the following rules).

2-If there are 5-8 folders or tracks in a a particular folder, then add exactly 8 empty folders.

3-If there are 9-16 folders or tracks, then add exactly 16 empty folders

4-If there are 17-32 folders or tracks, then add exactly 32 empty folders

5-If there are 33-64 folders or tracks, then add exactly 64 empty folders

6-If you have more than 64 folders or tracks at any level, then it is best to rearrange your music so that you have 64 or less at each level. This is because Tera is limited to 128 folders/files so you cannot add 128 blank folders to a folder with 65-128 real folders.

NOTE: You can stop here. If you just apply the first 6 rules to every folder on your card including the root folder, then you will experience a huge improvement in the randomness on the Tera...probably 90% of the possible improvement. The last two rules are only important if you want perfectly random playback of every song on the card.

7-For perfect randomness, all folders at the same level of organization should be in the same range: i.e. all artist folders should have either 1-4, 5-8, 9-16, 16-32 or 32-64 real album folders, and all album folders should have either 1-4, 5-8, 9-16, 16-32, or 32-64 real songs. Do not combine ranges at the same level. It is OK to have different ranges at different levels: i.e the root folder can have 32-64 artist folders in it and then all artist folders can have 1-4 album folders in them and that will still work. I would suggest dividing the folders/tracks in any folders with unusually high numbers of folders/tracks to bring them down to the range you plan to use at that level. Again this rule only matters if you want the randomness to be perfectly distributed across all of the songs.

8-Exception to rule 7: If your folders on the same level have contents that cross two of the lower ranges, then you can just use the higher range's number of empty folders. For example, if you have album folders with a wide range of say 3-16 tracks, then just add 16 empty folders to all album folders, and all of the tracks will have the same odds of playing. Or if instead you happen to have just a few very large albums with more than 16 tracks, then again I would suggest you divide them into two or more smaller album folders with 16 or less tracks each to bring them more in range with the other albums on your card.

If you play with the spreadsheet here:
https://dl.dropboxusercontent.com/s/4ou0peka1tfk5no/Tera%20randomness.xls?token_hash=AAFBcsNmH6py0EGM_Rxw_CyzgJhjIYk6iJG5I79pjMwpIA&dl=1 (created by Suicidal_Orange), you will see that these rules always create a perfectly even selection of all of the "real" folders and also all of the "real" tracks at each level on your card. However, again I will point out that to have perfectly even randomness, you need to stay in the same range for all folders at each level: root, artist and album. You do not need to understand the mechanics, but if you follow the rules above and keep each level in the same range (i.e. all artist folders have say 1-4 real album folders and therefore 4 empty folders, and all album folders have say 9-16 real tracks and therefore 16 empty folders) then the randomness will be perfectly even throughout your card. Or just follow rules 1-6 and the randomness will be pretty much even across the whole card with only a few slight exceptions - the randomness will still be something like 90% better overall than it would be without adding empty folders at all.

A couple of extra notes:

1-The root folder can have any number of real artist folders (except above 64) as it does not have to be similar to another root folder, because obviously there is only one root folder. Once you add the correct number of blank folders to the root folder, then all artist folders will be selected evenly in randomness. (And it may be obvious, but if there is only one artist folder in the root, then no need to add any empties, but for 2 or more artist folders, follow the rules above.)

2-When using blank folders as place holders, they should be named/numbered as follows 00001,00002,00003...00010,00011,00012, etc, so that they are sure to be arranged before any other folders/tracks on the card. This works as long as none of your tracks have a name that starts with more than 3 numbers. Note that the Tera does not always see folder names in the order your computer sees them so a song that is named "03-name of song" may appear before a folder named 00004 on your computer but not on the Tera.

3-Having all of these blank folders in there does not seem to increase the time between tracks. The Tera seems to just keep very rapidly selecting until it finds a song, and it does not seem to take any longer than it used to between tracks (except maybe very occassionally, it will take a little longer to select a song).

4-The extra folders also do not seem to interfere with ordinary navigation. When you skip to the next artist folder or album folder using the navigation buttons, the Tera just skips to the next real folder. In other words, you never need to manually skip through 16 or 32 blank folders to get to the next one.

5- It speeds all of this up if you create 16 or 32 blank and properly numbered folders in a folder on your computer's desktop. Then you can copy and paste the blank folders as needed into each folder on your card. It would obviously take a lot longer to manually create 16 or 32 new folders one at a time in each folder on your card, and since you may need to add the same large number of empty folders to lots of folders, copy and paste is definitely the way to go.

6-I used to think the first folder had to have a song in it for the Tera to start playing, but with empty folders instead of short silent tracks (which I tried first) as place holders, the Tera just skips ahead to the first folder with a song in it.

7- Avoid having real tracks mixed with real folders at any level, as this will mean those tracks will be selected much more often than the tracks in one of the folders. Best to stick with the Artist/Album/Track system of organization like that in iTunes so that all the actual WAV file songs are in an album folder, and to avoid having WAVs in your root folder or in an artist folder.

I will report that with my card setup according to these rules, I am now hearing lots of songs I have not heard in a very long time. I have been skipping through a lot of music to see if I can see any patterns, and so far I can't sense any pattern or emphasis on certain music. I also have not experienced any repeats of songs that I have already heard that same day or the day before which used to happen often (up to 7 or 8 times in a single listening session) before I figured this stuff out. It really seems now like I have a card with 2500 songs on it, instead of seeming like a card with 200-300 very familiar songs on it. Of course the old familiar songs still come up, but I would say they are maybe one in ten of the songs I hear which is about right. After all, they are part of the random selection process along with all of the music I used to hear less often.

Maybe we can call these the Rube Goldberg Rules for Randomness. Let me know how they work for you. And a big thank you to Suicidal_Orange. It was his spreadsheet that allowed me to figure out an approach that works without having to have an exactly even number of songs or albums in all folders, or other awkward limitations.

The above is based on how the original Tera selects songs randomly. It uses a random number generator to come up with three 8-bit random numbers: one for the artist folder, one to select an album folder and one to select the particular track. The Tera can have up to 128 folders/tracks at each level: root, artist and album, but the random number generator creates random numbers between 0 and 255. So there is an algorithm that first checks if there is a match. But if there is no match because the number is higher than the actual number of tracks/folders, then it drops one bit which is roughly equal to dividing by 2. Then it checks again for a match, but if there is no match it keeps dividing by 2 until a match is made.

So if there are 16 tracks and the Tera creates a random number of say 88, there is no match. So it tries 44...still no match. Then 22....still no match. Finally 11 and there is a match and track 11 plays. The problem is that this tends to always select the higher numbers before the lower numbers as they catch the process before the division gets to the lower numbers. So the low numbered tracks only play when there is a direct match, i.e. when the original number is a match. The higher number folders/tracks are therefore selected up to 63 times more often than lower numbered tracks (usually 15-31 times more often). You can see this by playing with the spreadsheet linked to in the previous post which shows the distribution of random selections when there are a specific number of folders/tracks (just enter different numbers in the black box to see how this affects the results).

The rules above compensate for this tendency to select higher numbers by inserting blank folders in front of the existing tracks and folders, so that all of the real tracks and folders are now in the higher numbers that get selected more often.

Here is how it works in real life using my own 128 GB card as an example:

I currently have 16 real artist folders along with 16 empty artist folders in the root folder of my card. This means that according to the spreadsheet, each real artist folder is selected 15 out of 256 times or about 5.9% of the time. The 16 blank folders are in positions 1-16 so according to the spreadsheet, they each get selected 1 out of 256 times or about .39% of the time per empty folder. So the empty folders are selected about 6.2% of the time in total (16 x .39%). If I had 10 real artist folders, they would still each get selected 5.9% of the time for a total of 59% of the time, and the empties would be selected the other 41% of the time. When an empty artist folder is selected, it does not matter what album or track is selected, since there are no albums or tracks in the empty artist folders. It seems the Tera just starts over with another set of three 8-bit random numbers when that happens.

Then I have an average of 11 real album folders (varies between 8 and 13) in each artist folder along with 16 empty album folders. Again each real album folder gets selected 5.9% of the time when its parent artist folder is selected. So with an average of 11 folders, a real album folder gets selected about 65% of the time and one of the empty folder gets selected the other 35% of the time.

Then each real album folder has 12-16 real tracks (average 14) along with 16 empty folders. Same thing happens when a particular album folder is selected, there is a 5.9% chance that each particular song would be selected also. And on average about 17% of the time one of the empty folders I have in with the tracks gets selected instead and the Tera starts over.

You put this together and each individual track of approx 2500 songs on the card has a 5.9% x 5.9% x 5.9% chance of being selected or about a .02% chance of playing. Every time the Tera selects, then every song on the card has a fresh .02% chance of playing, just like every time on the roulette wheel the red is about 50% odds even if it has come up 10 times in a row previously.

With 2500 songs, this means an actual song is selected on the card about 50% of the time (2500 x.02%). The other 50% of the time the Tera ends up in an empty folder and has to try again. But on each new selection, even after an empty folder has been selected, then each and every song once more has an equal .02% chance of being selected on the new try. Thus perfect randomness in the actual playback. And of course perfect randomness is not like shuffle play where every track plays once before any repeats. Random means random on every selection and so any song could actually come up twice in a row, although at .02% the odds are very low. I used to hear the same song twice in a row often on my Tera, and even more often twice in one listening session. Now with the empty folders added to my card, I have not had that happen even once in several days.



Edits: 05/01/14 05/01/14

This post is made possible by the generous support of people like you and our sponsors:
  Amplified Parts  


Follow Ups Full Thread
Follow Ups

FAQ

Post a Message!

Forgot Password?
Moniker (Username):
Password (Optional):
  Remember my Moniker & Password  (What's this?)    Eat Me
E-Mail (Optional):
Subject:
Message:   (Posts are subject to Content Rules)
Optional Link URL:
Optional Link Title:
Optional Image URL:
Upload Image:
E-mail Replies:  Automagically notify you when someone responds.