Pages

Sunday, 23 December 2012

Beautifying the Windows 8 start screen

Windows 8 is great.  Following the initial "where have all the options gone?!" shock I quickly settled down with snapping windows to the side, context sensitive menus and easily sourcing apps from the store.  However, I'm a stickler for a tidy computer and the one thing that's really been niggling away at me is the appearance of the start screen once you get a few non-store programs linked on there.  Whilst apps installed via the (love it or hate it) shiny new store interface generally come with Metro (sorry, Modern UI) tiles, any programs installed in the traditional manner get lumped with a plain tile with the default logo in the middle.  This somewhat undermines the beauty and simplicity of the Windows 8 interface.  

The Windows 8 start screen is a massive departure from the list-layout of bygone operating systems, with a fresh look that's clearly been designed with touch devices in mind.  However, ugly tiles for user-installed programs detract from the overall aesthetic appeal.

Enter OblyTile, a free tool for creating Windows 8 tiles provided you have an appropriate image and the program path.  While any bitmap or vector graphics suite can be used to make the tile icons I stuck with my tried and tested favourite, Inkscape.  This free (GNU General Public License) software has all the features expected of a commercial vector graphics suite like Adobe Illustrator or CorelDraw, but without the pocket emptying side-effects.

Windows 8 tiles are characterised by simple, white icons on monochrome backgrounds, with Microsoft opting for a handfull of bright colours, but it's up to you if you stick with this theme. In most cases I found it possible to create icons from simple overlaying of circles and rectangles onto template icons I found online. Also, off-setting icons slightly above the tile mid-point gave a more pleasing look. One nice feature of OblyTile is the ability to add program arguments, so in the case of the shutdown button I was able to specify the shutdown mode (anyone who's typed "shutdown" into command line will know there are plenty of options to choose from).

After a couple of hours of drawing and hunting for the relevant program files, my start menu looks much more like I had imagined it would when drooling over pre-release screenshots of Windows 8.  As with many products, the final thing you get in your hands never seems as slick or shiny as in the adverts, but at least in the case of the Windows 8 start screen you can go some way to rectifying this.



With custom tiles courtesy of OblyTile and a bit of trial and error in Inkscape the patchwork beauty of the Windows 8 start screen is restored.

Below is a collection of the icons I've created for my start screen.  They're all in 256 x 256 resolution and feel free to download them.  You can also find my Inkscape file here.  Like a good scientist, I've also included a list of sources for the icons where relevant and noted any key points for each tile below.

   
Blender (template icon from 
blender.org)
GIMP (template icon from 
iconarchive.com)
   
Google Chrome (template icon from 
news.cnet.com)
Inkscape (Icon from 
commons.wikimedia.org)
   
MATLAB (template icon from 
en.wikipedia.org)
Media Center (template icon from 
blog.gadgethelpline.com)
   
Paint (template icon from 
iconspedia.com)
Screensaver (Note - .scr screensaver files
located in "
C:\Windows\System32")
   
Shutdown (Note - executable path located at
"C:\Windows\System32\shutdown.exe", use
argument "-p" for immediate shutdown)
Spotify (template icon from 
digitalbookworld.com)
   
Steam VLC Player
   
Microsoft Excel Microsoft PowerPoint
Microsoft Word

Saturday, 22 December 2012

Ghosts in the machine: hiding images in sound

I've been aware for some time that it is possible to generate wave-forms such that images appear when they're passed through a spectrum analyser (I use the free software, Sonic Visualiser). This techniques, known as steganography, has famously been used by such artists as Aphex Twin, Venetian Snares and Nine Inch Nails (examples here). However, it wasn't until I was involved in a conversation with Jorg of Straftanz that I put much thought to it, assuming it was some sort of complex musical witchcraft. As the evening moved on I found myself thinking more and more how I would go about this task and in the end gave in to my curiosity and sat down with MATLAB to give it a try. The results were surprising  both in the ease with which this was possible, but also to the quality of the images that could be extracted from the sounds.

The principle is simple, an image is divided up, so that one axis represents time, the other represents the frequency of the sound at each given time and the intensity of each pixel determines the amplitude of the corresponding frequency. The frequencies that each row of the image correspond to can be set to anything, but I chose 50Hz to 5000Hz and a sampling frequency of 44000Hz (well above double the highest frequency to prevent aliasing). The duration of the sound can also be varied, but the longer it is, the higher the image resolution.


The sound is generated in segments, with the first segment (maybe 0.2 seconds depending on the size of the image and how long the final file should be) corresponding to the first column of the image. Each pixel in that column corresponds to a predefined frequency within the range specified by the user and the amplitude of that particular frequency is determined by the intensity of the pixel. Summing each of of the waves (one for each pixel) in a column creates a waveform, which will recreate the first column of the image when passed through the spectrum analyser. 

Simply by repeating this for each of the columns in turn and adding the generated waveform (as a function of time) from each onto the end of the existing waveform, a sound is generated, which hides in it the target image.  So here it is, one I made earlier. It's the first image I had to hand and happens to be one of my favourite albums - Mezzanine by Massive Attack.





And here's what it's meant to look like.




While messing around with the parameters I also found it was possible to generate some rather pretty effects by setting the amplitudes excessively high and clipping the waveform.



Finally, the completed code:

function [final_sound] = im2sound(filename, ext, f_sample, f_low, ...
f_high, amp_mod, sample_t)

%INPUTS:
%'filename' - Name of the image to be encoded (not including extension
%ext' - Extension of the image (not including "." at the beginning). 
%'f_sample' - Sampling frequency (Hz)
%'f_low' - Lowest frequency (Hz) (e.g. 40)
%'f_high' - Highest frequency (Hz) (e.g. 6000)
%'amp_mod' - Multiplication factor for the amplitude. Decrease until 
%image is clear. Too high and the waveform clips. Too low and the image 
%is very dark (e.g. 0.00002)
%'sample_t' - Duration of the sample in seconds. Longer samples have
%better quality (e.g. 10)

%OUTPUTS:
%'final_sound' - the final sound containing the image. This is
%automatically saved to a .wav file with the original image filename


%INITIALISING VARIABLES:
%The waveform at each time point. This is reset at the beginning of each
%time point
temp_sound = 0; 
%The final waveform
final_sound = 0; 


%MAIN BODY
%Loading the sample image and calculating the image size
raw_im = imread(strcat(filename,'.',ext));
size_raw_im = size(raw_im);

%Making a frequency table for the height of the image. Each row of the
%image is assigned a particular frequency from the corresponding row of 
%this table. The frequencies are linearly distributed between the highest and
%lowest user-definied frequencies. "f_step" is the increment between each
%adjacent frequency
f_step = (f_high - f_low)/size_raw_im(1,1);
f_table = (f_high:-f_step:f_low);

%The final sound will dwell on each column of the image for a specific
%time. This time is defined by "t_start" and "t_end". It depends on how
%long the user determined the sound-clip should be and how wide (how many
%columns) the image is. 
t_step = (sample_t/size_raw_im(1,2));

%Initial values for the start and end times. These will be increased at
%the end of each loop iteration (when the script moves onto the next column
%of the image).
t_start = 0;
t_end = t_step;

%The loop which generates the sound file. At each iteration it generates a
%segment of the final sound file, which is temporarily saved to 
%"temp_sound". This segment is built up of frequencies from that
%particular column of the image.
for j = 1:size_raw_im(1,2)
%Initialising the variable (the sound for each frequency (row) is added
%to the existing sound)
temp_sound = 0;

%Setting the time in matrix format
t = t_start:1/f_sample:(t_end);

%For each iteration of this loop, the script goes down the current
%column of the image and generates a waveform of the frequency
%specified in "f_table". The amplitude of the waveform is determined
%by the pixel intensity. This generated waveform is added to all the
%previously generated waveforms in that particular column
for i = size_raw_im(1,1):-1:1
temp_sound = temp_sound+ sin(2*pi*t*f_table(i))*...
double(raw_im(i,j))*amp_mod;

end

%At the end of each column the segment of sound generated is added to
%the end of the existing sound file ("final_sound").
final_sound = cat(2,final_sound,temp_sound);

%The temporary sound is cleared ready for the start of the next column
clear temp_sound

%Moving to the next time frame
t_start = t_start + t_step;
t_end = t_end + t_step;

end

%This saves "final_sound" to the '.wav' file of the same name as the input
%file
wavwrite(final_sound, f_sample, strcat(filename, '.wav'));

Hello World

It's now three minutes past midday on 22nd December 2012, which means once again the World forgot to end when it was meant to.  As such, it seems like a pretty good opportunity to start something new; a blog maybe?

First things first, a quick background.  As the blog name suggests, I'm Stephen Cross.  For the past 7 years I've been studying at the University of York; first for a Masters degree in physics and followed by an ongoing biophysics PhD.  I won't go into the details of my research here, but more information can be found on my LinkedIn page (http://uk.linkedin.com/in/sjcross/).

We got our first computer when I was 14.  The specifications I remember are comical by today's standards (to be honest, they were pretty amusing at the time), but even back then the 120 MHz Intel Pentium processor and 1 GB hard-drive seemed to have unlimited potential for creativity.  Twelve years and a fair few computers later I've experimented with everything from MS Paint to Inkscape, Maple to Java and Audacity to Reaper.  While there is still a near-infinite wealth of software still to discover, I thought I'd write down some of my experiences for anyone who may be interested.  I'll be honest where I had problems and how (if) I solved them, so this might even be of use to someone, someday!

Please feel free to ask questions or suggest alternative ways I could approach problems.  I'll try to respond to all comments.