My Rambling Thoughts

Telling apart real and fake 256 kbps audio files

Just because an audio file is 256 kbps does not mean it is actually so. It could have been upscaled from 128 kbps.

Can we tell? Yes! Through a spectrogram: a visual representation of the frequency (y-axis) by time (x-axis).

SoX (Sound eXchange) can generate a spectrogram, but it does not accept MP4 nor AAC files. We use ffmpeg to convert them to WAV files first.

ffmpeg -i video.mp4 -vn audio.wav
sox audio.wav -n spectrogram

View the generated spectrogram.png. A 128 kbps MP3/AAC file is usually cut-off at 16 kHz, 18 kHz for 192 kbps and no cut-off for 256 kbps.

YouTube upscales audio to fit the video resolution (192 kbps @ 720p), but it does not tell you so.

My #1 beef with Android

One word: permission.

Android defines a list of protected resources on a device, such as the contacts or the camera, and apps need to declare they need access to them — the so-called permissions.

Sounds great. However, you are given just one chance to take it or leave it — when you install the app. It is all or none.

Many apps want access to the identity, the phone, the contacts, the location and the Internet. You do not know when or how they use the info.

XPrivacy fills the gap. (It requires a rooted phone.)

You can set each permission to grant, deny or ask. When you set it to 'deny', it feeds the app fake data. Obviously, it is an issue for the app if it uses the data to identify/track you. :-D

It could have been easier to use, though. There are just too many permissions, even when grouped. But broadly speaking, you want to restrict access to the above mentioned categories.

How much usable storage?

The Samsung S4 made the news when it was released last year due to its low usable storage — merely 8.56 GiB out of 16 GB (yes, I am deliberately mixing up the units). It is still the reigning champion.

Phones and tablets are routinely marketed with 8 GB, 16 GB, 32 GB, 64 GB, or even 128 GB flash storage now. But they never mention the usable storage — how much space is left over for your own data.

DeviceAvail%age
Nexus 412 GiB75%
Nexus 512.28 GiB77%
S211.5 GiB72%
S311.35 GiB71%
S48.56 GiB54%
S510.7 GiB67%
Note11.5 GiB72%
Note 210.36 GiB65%
Note 324 GiB75%
Note 424.66 GiB77%

Samsung has elected to use 32 GB flash starting with Note 3. The user has over 24 GiB of usable storage. But, does its customized TouchWiz UI need to take up almost 8 GB?

The best you can hope for is the Nexus 5, with 12.28 GiB left. Even stock Android uses 3.72 GB. Where does the space go to?

The first thing to note is that it is 16 GB (10^9), not 16 GiB (2^30). 16 GB = 14.9 GiB only. So, Android actually uses 2.62 GiB "only". Of it, 1 GiB is for the system (not all of it used; some spare for future expansion), 700 MiB for app cache and the rest for boot, recovery, modem and other things.

A short wishlist:

  • The usable storage should be mentioned upfront, or it should be at least 85% of the advertised size.
  • The user should be offered a choice between features, performance and usable storage, say from 60% to 90%. It would be great if the user could do this using an external utility.
  • OS should use SI units for storage throughout to avoid confusion.

Glass meets concrete; 0-1

By a stroke of misfortune, I dropped my Samsung S3 phone on hard concrete ground and it landed flat on its glass surface.

My phone is 2.5 years old. Time for a new phone?

My upper limit for phones is S$500. The Samsung Note 4 costs S$974 new; the same as a decent notebook. I think the price is crazy — much of it is premium. Consider that in just one year, the Note 3 costs S$640 and in two years, the Note 2 costs just S$480.

My options:

  • Buy a Samsung S4 for S$485
  • Buy a LG Nexus 5 (32 GB) for S$580
  • Buy a Blackberry Z30 for ~S$610 (US$400 + shipping)

I'm willing to go over the limit, but just a little. For example, I'll rather get the 32 GB LG Nexus 5 because that is all the data storage it has. In typical Google fashion, it does not have a SD card slot.

And for the Blackberry Z30, I don't mind paying a bit more for security and control over privacy. Unfortunately, it is not available locally, and it is very expensive to ship from the US.

The Z30 runs the BB 10 OS, but it can run Android apps — many of them, anyway. It is still a hassle, so the security aspect must be good enough to be worth it.

However, it turns out that Blackberry uses the same permission system for Android apps: they need to be granted upfront, and once given, that is it. To me, this defeats the purpose of using the Z30.

Anyway, I found out I could replace the glass for a mere S$55. My phone is still good enough, thus my choice is clear. However, I will be making some I-should-have-done-it-a-long-time-ago changes to make it work the way I want it to.

Update: it always pays to ask clearly. S$55 is 3rd party glass. It costs S$80 to replace the original glass and LCD at the same time. And since my cover is cracked from several drops, the shop offers to replace it for S$20, waiving S$40 labour charge. So, it costs S$100 in total.

Data on EEPROM

This is as close to the metal as possible: using a 128 kB EEPROM as non-volatile storage. No file system in-between. No sectors. Just raw bytes.

Reading

The EEPROM is divided into two banks of 64 kB. It is possible to read up to 64 kB within one bank in one read transaction.

Writing

Writes are done in 128-bytes pages. It is only possible to write to one page in one write transaction. An entire page is always updated — even if we write just one byte.

The actual writing is done after all the data is transferred. The EEPROM does not respond during this "blackout" period (timed at 4.4ms).

Write cycles

Each page has a rated 1,000,000 write cycles. Reads are infinite. The limited write cycles presents an interesting question. Is one million sufficient?

If we write to the same page every second, it works out to be just 11.6 days. If every minute, then just under 2 years.

If we use the EEPROM to store logs, we are unlikely to hit this limit for most pages. If an entry is 8 bytes, we only hit each page 16 times (128 / 8) for every 16,384 entries — before we roll around and overwrite the earlier entries.

We can minimize the write cycles by buffering the full 128 bytes before writing. The tradeoff is that we may lose the last few entries (up to 16) on sudden power loss.

We are likely to run into the write cycle limit for the header, where we store the next-record-to-write index. That page is written on every update. It is the weak link.

Wear leveling

The answer is wear leveling. The idea is to spread the write across several pages so that we do not "wear out" one particular page.

If we use 8 pages, then the header is good for 8 million writes. This is sufficient if we write every minute, but is still insufficient if we write every second (just 92.8 days).

If we write very often, we have three options:

  • use more pages for wear leveling (wastes space)
  • write the header less often (risks data loss)
  • use a headerless approach (takes time on startup)

Bash me if you can

A security flaw was discovered in bash after 20 years. It can be exploited to run arbitrary commands — that the user process is allowed to run — over the network once certain conditions are met, hence it is very severe.

Test case:

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

The first patch, issued within days, was not 100% effective. Test case 2:

foo='() { echo not patched; }' bash -c foo

This reveals the three eternal truths of programming:

  • It is almost impossible to be bug-free
  • Parser is hard to get right
  • Backward compatibility can introduce bugs

To be somewhat fair, everyone just assumed that such an old and commonly used program such as bash has all its bugs shaken out over the years.

It is not a bad assumption, but it can fail if two conditions are met:

  • The code was not adequately tested (not surprisingly if it has many paths)
  • The code was left alone over the years due to its complexity and it works

Star Wars like you never saw it before

Not Episode IV, not A New Hope

Star Wars was released in 1977. It was revolutionary.

Unfortunately, George Lucas considered it unfinished — he could not film the picture he wanted due to technical and financial constraints. He finally achieved his vision 20 years later in the God-awful 1997 Special Edition. And he refused to release the original version, claiming that the original print was lost / unusable.

Many fans were upset. Finally, after so many years, with multiple sources available and affordable digital technology, fans could do what George Lucas claimed was impossible: to reconstruct the Star Wars from 1977. Search for Harmy's Star Wars: Despecialized Edition v2.5 - Video Sources Documentary on YouTube.

A fan named Harmy released his Harmy's STAR WARS Despecialized Edition HD v2.5 in Oct 2013. It is a whopping 17.8 GB 720p file with 21 audio tracks! Even taking away all the audio tracks but one, the file would still be some 14 GB. Given the show is 2 hours long, it works out to be 15.9 Mbps.

Another disappointment is the resolution. It is merely 1280x720 — with black bars! This is due to the movie's aspect ratio. The real vertical resolution is just 540 pixels.

But that is just nitpicking. The video is gorgeous and detailed. Finally, I get to see the state-of-the-art special effects in 1977. And it is impressive! In contrast, the CGI effects added in 1997 are very amateurish.

As is my usual practice, I reduced it to 360p (really 854x360), denoised it and kept one audio stream at 128 kbps. It was just 1.05 GB.

New adventure awaits

game

New games from my last buying spree:

  • Bohnanza
  • Curse of the Mummy
  • Dominion
  • Forbidden Desert
  • Forbidden Island
  • Galaxy Trucker
  • Ghost Chase
  • Space Alert
  • The Resistance: Avalon

Now that the dust has settled, I'm disappointed I got only nine new games. In contrast, I got way too many expansions and anniversary editions.

Many of these new games are of the same genre too, either cooperative, cooperative with traitor element or one-vs-others.

A quick run-through.

(Note: some games are in US$ because I bought them from Amazon.)

Bohnanza (1997) [US$14.41]

The noisy trading game from 1997. It has held up very well. The box says 2 to 7 players, but I think it really works when there are 5 to 7 players — the more people, the easier to trade! (And noiser! :lol:)

There are two things to watch out for.

First, the hand management and trading rules must be followed properly, or the game will be broken!

Hand management: the players cannot change the order of the cards on their hand.

Trading: only the active player may trade. The traded beans may not be re-traded and must be planted after the trading phase.

Second, the English Rio Grande version is already "expanded" with 154 cards. The original game has only 104 cards, making for a much quicker and tighter game for 3-4 player games.

To restore the original game, remove Cocoa (4), Coffee (24) and Wax (22) beans.

You'll know you are playing it correctly if it feels like you are in a market.

Curse of the Mummy (2008) [S$58]

The German edition

This is a one-vs-others chaser game. A mummy is going after treasure hunters who are plundering treasures in his pyramid.

The innovative part is its vertical magnetic board. The mummy player plays on one side and the treasure hunters on the other.

The movement is also pretty elegant. The treasure hunters start with five die. They may re-roll as many times as they like, but if a dice shows a mummy, it may not be used any more.

When it is the mummy's turn, he can move based on his die and the number of mummies on the treasure hunter's die. Also, the treasure hunters will eventually need to "reset the die" — allowing all five die to be used again — but not before the mummy take an "interrupting" turn.

The treasure hunters have to collect five treasures based on the cards they are dealt. They can see the mummy as he moves, thanks to the dual-sided magnet mummy token.

The mummy player can only "see" the treasure hunters when they pick up the treasures, because they have to reveal the corresponding treasure card.

This is not a true cooperative game because the first treasure hunter to collect five treasures is the sole winner. On the other hand, if the mummy threatens to win — by taking a number of lives; each treasure hunter has three lives — the treasure hunters may want to cooperate so that one of them may win.

There are only two issues with the game. First, it just went out of print. Second, the board is too small at 36 x 26 cm. It would have been perfect at 36 x 52 cm.

Dominion (2008) [US$29.75]

The wonder hit of 2008. I have always resisted getting it, because there is no way I'm going to pay so much for just decks of cards.

Well, after 6 years, I decided I will buy the base game and one expansion. Dominion has tons of expansions. I have not decided which one I will get.

Forbidden Island (2010) [S$32.50]

From the designer of Pandemic, comes Pandemic-lite! Pandemic is already a light cooperative game, but Forbidden Island is an even lighter game. And that is a good thing. I would say it captures 75% of Pandemic's mechanic, but plays in half the time. Plus, it is cheap (US$16.74 on Amazon) and comes in an attractive tin-case.

A team of adventurers are in a do-or-die mission to retrieve four treasures on an island and get off before it sinks, tile by tile.

Note: you might not want to play this near water. You might develop a phobia of water after this game.

The island is made up of 24 tiles with 24 corresponding Flood cards. When a Flood card is revealed, the corresponding island tile becomes flooded. The second time the card comes up, the tile has "sunk". The adventurers basically spend most of their time shoring up tiles (flip flooded tiles to normal).

The four treasures are on eight separate tiles (you just need to collect one of each type). It goes without saying that those tiles must not be sunken, at least not before the treasure is collected.

The adventurers have to collect four treasure cards of the same type before they can claim the treasure. They can pass their cards to other adventurers provided they are on the same tile.

Every adventurer has a special power, some more useful than others.

On his turn, a player can perform up to three actions: move, shore up tiles, pass cards or obtain treasure. After that, he draws two treasure cards.

Some treasure cards are Water Rise events. They work like the Epidemic events in Pandemic: rise in water level and the revealed Flood cards are shuffled and placed on top of the Flood deck. This ensures the previously revealed Flood cards remain as "hotspots".

One thing I like is that the game does not end when you got all the treasures. All players must make it to the exit tile and lift off (by playing a special card) in order to win. Yes, all the players must survive. No heroic sacrifice is allowed!

The game is meant to be played in 30 minutes. If you are taking longer, you are playing it wrong — it is meant to be played sub-optimally. The island is sinking, it does not wait for you! :lol:

What is there not to like? The island tiles are beautiful, but they do not serve any purpose other than to mark the players' starting positions and treasure spots. They can be labelled A to X and it won't make any difference.

And then there is the fact that there are two tiles with the same type of treasures. This is to prevent those tiles from being super-critical; you can safely lose one of them. But it does break the immersion.

Other than these, it is a great game!

Forbidden Desert (2013) [US$18.31]

This is a more advanced Forbidden Island, but still lighter than Pandemic.

This is a better game than Forbidden Island, but there are two flaws with it. First, it may be slightly too difficult for casual gamers. Second, it plays too similarly to Forbidden Island, so it does not make sense to own both. Well, I have to buy it so that you don't make that mistake. :-P

Otherwise, it is an excellent game, especially for the price and attractive tin-case.

Note: this is best played in a sandy place.

Forbidden Desert is quite thematic. As its name imply, the action now takes place in a desert.

A team of adventurers is excavating an ancient buried city to recover a legendary flying machine, its parts scattered throughout, that will allow them to escape — their transport helicopter has crashed — before they get buried in the sand, swept away by the sandstorm or die of thirst.

24 tiles are laid out in a 5x5 grid, with one empty space denoting the storm.

On his turn, a player can perform up to four actions: move, remove sand, excavate (flip tile over; only on clear tiles) or pick up part (the tile must be excavated first).

After that, the Storm cards are turned over and the storm "moves" accordingly, leaving sand in its wake. Some Storm cards are Storm Picks Up events, where the storm intensity increases (by drawing more Storm cards per turn).

Tiles are never lost, but they become impassable when there are two or more sand markers on them. The game is over if the sand markers — 48 of them — run out.

Eight of the tiles reveal the location of the parts to the flying machine, two per part. Both are needed to pinpoint the row and column. Once identified, the part is placed there and a player needs to go there to pick it up. This has a very Indiana Jones feel to it.

After all four parts are collected, the players must make their way to the Launch Pad tile — that must be excavated and passable — to blast off!

Twelve tiles contain a gear. The player takes a card from the Equipment deck. These go a long way in helping the players survive.

Three tiles have a water symbol on the top. Two of them are wells, one a mirage. All players on that tile will add two water to their canteen when the tile is excavated.

Three tiles are tunnels that allow players to move through them and take shelter from the sun. Unsheltered players need to drink when a Sun Beats Down event is drawn from the Storm deck. If a player has no more water, he dies of thirst.

Forbidden Desert is great! None of its mechanics feel forced and out-of-place. The shifting storm, the sand build-up, the need for water, all these really make it feel like you are in a desert.

Galaxy Trucker (2007) [S$95]

This game has the funniest rulebook of all time. Bonus: it is also a good game.

In the first phase, players scramble to build their spaceship out of a common "junk pile". This is free-for-all. The spaceship is a compromise between crew cabins, cargo holds, cannons, shields, among others; there is no time nor space for a perfectly built ship. At the end of this phase, parts that do not connect properly to the rest of the ship — most likely due to oversight in the rush — fall off.

You want to be the first to complete because it gives you first dips in the second phase. Of course, you encounter all events — good and bad — first.

In the second phase, the players move their spaceships through space, obtaining cargo, fighting pirates, fending off meteors and generally watching their ships come apart. You win if you arrive at the destination with $1 profit — imagine that!

This game is meant to be played sub-optimally, and best mixed with humor. Serious people and perfectionists might want to stay away.

Con: the game is very expensive and has a somewhat steep learning curve. You know it is difficult when the rules book guides you through a tutorial game.

Ghost Chase (2001) [US$32.44]

This is a one-vs-others chaser game. It is a simplified Scotland Yard. Unlike that game, Ghost Chase is meant to be played light-hearted.

A bunch of "meddling kids" are trying to catch a ghost in a haunted castle of 54 rooms. They must do it before dawn (18-20 turns), or the ghost wins.

The kids can only move through doors and stairs, but the ghost can float to adjacent rooms through walls. The ghost may not stay in the same room or revisit a room, special cards aside, limiting his routes as time passes. He loses if he is unable to move due to poor planning or being trapped.

The ghost is only visible every 4 to 6 turns. To help the kids, he will reveal his last trail when he becomes visible.

This game is pretty atmospheric and is best played at Halloween. Dim the lights, light candles and play spooky music!

It is also suitable for young children as young as 4, though the rules have to be simplified.

Space Alert (2008) [US$40.79]

The players have to work together to survive 10 minutes in their spacecraft in hostile space. In space, no one can hear you scream!

This game does the impossible: a real-time multimedia cooperative game! And each game is only 20 minutes: 10 minutes to play and 10 minutes to "resolve".

How? By using a soundtrack that reveals the events. The players have to react to the events as they occur.

This cooperative game really breaks out of the cooperative mold. You cannot play it solo, nor can there be a dominant player.

This game is meant to be played sub-optimally. If played correctly, you will feel like you are in a space thriller movie. So many things are happening, communications get mixed up and things don't go as planned.

I would love to play this game, but this game has a very steep learning curve. And you do need the same "crew" every time to gain experience together.

The Resistance: Avalon (2012) [US$15.41]

Werewolf simplified. Werewolf is a nice party game for a large group (8 to 24 people!), but it suffers from two flaws: it requires a moderator and the "dead" people are out of the game. The Resistance: Avalon and its predecessor The Resistance solve these issues. On the other hand, they only work with 5 to 10 players. But that is good enough for me.

I would have preferred The Resistance for its sci-fi setting, but The Resistance: Avalon introduces optional roles that can help prevent the game from falling into a logic puzzle.

The Resistance is a game where a rebel organization is carrying out resistance missions. Unfortunately, there are hidden spies who are working together to sabotage the missions. The question is, who? Can the rebels find them before it is too late? Can you trust someone who says he is not a spy? :lol:

This game is best played with players who don't mind bluffing — in a game, of course — and can maintain a poker face. :-D

In each round, a leader tries to assemble a small team of 2 to 3 players to go on a mission. Everyone votes to see if the team is good to go. The real rebels do not want spies on the mission, of course. On the other hand, the spies want to get on the missions to sabotage them, but they need to do it covertly. If their cover is blown, they will never get chosen on future missions.

After the team is decided, they then go on the mission where they play success/fail cards to determine the outcome of the mission. The mission fails as long as there is one fail card. A big tip: real rebels will never play a fail card. :lol:

Everyone then need to analyze the result to make sure future missions are or remain successful.

The Resistance: Avalon plays the same, except with roles. The first and most straightforward is Merlin. He is a good guy who knows who the spies are, but the spies do not know who he is.

In the course of the game, Merlin will try to hint to the other good guys who the spies are without revealing his identity, because at the end of the game, the bad guys win if they correctly guess who Merlin is.

This leads to another level of meta-gaming where Merlin tries his best to hide his identity and other good guys try to impersonate as him. Also, the good guys don't know to fully trust Merlin because a spy can impersonate as him too.

Expansionitis

game

I do not have a fast and hard rule on buying expansions. If I like a game, logically I would buy its expansions too. But that is not always true for a few reasons:

  • it is still largely the same game
  • the game becomes more complicated and longer
  • expansions are expensive (often 2/3 the price of the base game)
  • it is hard to separate the base game

Thus, sometimes I just put my foot down and say, "the base game is good enough!"

The exception is when I decide to "collect-them-all" for completeness sake, although I may not play with them.

Carcassonne

Carcassonne has a ton of expansions since it came out in 2000.

Ever since I got the game in 2006 and even now, I still maintain that only the first two expansions, Inns and Cathedrals and Traders and Builders, are worth getting. And even the second one is debatable.

Note: this is assuming the River "expansion" is included in the base game.

Adding more expansions only add more rules and run time. I like the simplicity of the original game.

Pandemic

I have always resisted getting the expansions because I thought the base game was "just right". But in my recent buying spree, I got the new base game and its two expansions. Yes, that means now I have two base games. I still sometimes question if I spent the money wisely; that was US$85.66 I could have bought other games with.

Power Grid

Power Grid's expansions are either the power plant deck or new maps. They make sense. I would love to get them all just for completeness sake, provided they are cheap. Unfortunately, Amazon does not sell the latest maps themselves, so I'm unable to get free shipping.

I have five expansion maps already and am missing the newest three (Quebec / Baden-Wurttemberg, Northern Europe / United Kingdom & Ireland, Australia & Indian Subcontinent).

Will I go on collecting new maps? I will set my bar slightly higher after this.

Race for the Galaxy

Race for the Galaxy was designed with the first two expansions in mind. The base game itself was biased towards one strategy. Using the expansions allow other strategies.

Currently, I have all four expansions for completeness sake. I'm a sucker when it comes to cards with variable powers.

Talisman 2nd edition

I have finished collecting this in 2005. I got all the expansions except for Dragons. Not going to get it.

This is a done deal. :lol:

Talisman 4th edition

Originally, I planned to get all the expansions, but my interest fizzled out in 2010, so I only got the first three, including Dungeons. I am planning to get the City expansion and call it a day.

Ticket to Ride (USA)

Like Carcassonne, I always like my TtR simple. Hence, no expansions and variants. I do have the 1910 expansion, but it is hardly an expansion.

But I made an exception during my recent buying spree and got the first two maps out of the four current ones. I think I'll stop at that.