Akai MPK Mk2 mini – Ableton DrumRack – pitch issue

Ableton Live 9 displays the MIDI note of each of the pads on the Drum Rack in the status bar when hovering the mouse over it. For the Kit-Core 808 Drum Rack instrument for example, the ‘Kick 808’ maps to the C1 note, the ‘Clap 808’ to D#1 note.

I mapped the pads (bank A/B) of my Akai MPK Mk2 mini MIDI controller to the midi notes shows in the Ableton Drum Rack.

Problem

For some reason when pressing the pads, they were off by 1 octave. Triggering pads that were not visible and had no sounds loaded on them.

Workaround

Drag the ‘+ 12.adv’ MIDI Effect from the ‘Pitch’ category onto the section just in front of the Drum Rack, so it will transpose the incoming midi notes by +1 octave (12 semitones).

Pro Tools First – Error 13001

If you encounter error 13001 during startup of Pro Tools First, this is likely due to the program having insufficient privileges by default after installation.

To remedy; enable the executable to run as administrator.

  1. Navigate to the installation directory (e.g. C:\Program Files\Avid\Pro Tools First)
  2. Right-click on ProToolsFirst.exe > Properties
  3. Tick the ‘Run this program as an administrator’ setting.
  4. Press OK and start the program

UK Election Map – Voting Distribution (2017 Update)

2017 update since my previous post:

UK General Election – Voting Distribution Map 2005/2010/2015

2017 UK General Election Map – Voting Distribution

Now available via Wikimedia: 2017UKElectionMap_votes.svg

Source

Map Image source code in GIT

git clone https://github.com/eelcodevlieger/mapimage.git

Main class: com.knocksfornometer.mapimage.Main

Input Files: src\main\resources

Output Files: target\map

Spotify – Not Responding

Today the following warning appeared when I tried to start Spotify.

spotify-not-responding

To fix (until it is patched properly) you can run the application in compatibility mode (see screenshots below).

  1. Right-click on the Spotify application icon
  2. Properties
  3. Compatibility tab
  4. Select ‘Run this program in compatibility mode for: Windows Vista (Service Pack 2)
spotify-properties-dialog
‘Run this program in compatibility mode for: Windows Vista (Service Pack 2)’
spotify-properties
Spotify – Properties Dialog

UK Election Map – Voting Distribution

Idea

Generate a map of the UK showing the general election voting distribution of 2005, 2010 and 2015. Existing election result maps did not really show the subtlety in voting, this is due to the first-past-the-post voting system (winner-takes-all).

Result

2005 - 2010 - 2015 UKElectionMap_votes

Legend
Legend

Now published on Wikipedia UK_General_Election_2010#Voting_distribution_per_constituency and UK General_Election_2015#Voting_distribution_per_constituency

The Plan

  1. Gather election data (number of votes per constituency per party & turnout percentage)
  2. Produce textures
    – One per constituency
    – Number of pixels per party (pixel colour) proportional to vote count
  3. Find a programmatically usable map of the UK and its constituencies
  4. Link constituencies in the data to the constituencies on the map
  5. Alter map to apply this custom texture per constituency

Java Program

I spent a good while trying to ‘debug’ missing data for one constituency in Northern Ireland, which turned out to be a lake (Lough Neagh)

The program does the following (see below for the source);

  • Read in a map of the UK in SVG format
  • For each election year
    • Read in election data
    • Look up party colours (no vote = BLACK)
    • For each constituency
      • Calculate a voting distribution
      • Generate a ‘voting distribution’ image
    • Link the constituencies in the image map with the generated images
    • Write the updated SVG file

Input

Data

Year Source
2005 Electoral Commission – Electoral Data
2010 Electoral Commission – Electoral Data
2015 Electoral Commission – Electoral Data (Currently provisional data – final data to be published in July)
2015 Guardian – Election Live Results

Image

I used these Creative Commons images from Wikipedia as a base. The image format is SVG, which is an XML formatted vector graphics image. This allows for programatic access to the image description data.

2015 UK Election Map
2005 UK Election Map – Results by Constituency
2015 UK Election Map
2015 UK Election Map – Results by Constituency

Read in and Writing to a Map of the UK in SVG

As the SVG image format is XML, we can use the standard XML tools in Java, in this case DOM + XPath.

XPath

Adding an XML Namespace

Processing Excel Spreadsheet

Add Apache POIthe Java API for Microsoft Documents – to the Maven pom.xml:

ElectoralCommission-Excel_Screenshot
Screenshot of the election data spreadsheet format

Example using Apache POI to iterate over the first cell of each row

 2005 UK General Election

A number of constituency changes were made before 2010 – meaning that not all 2005 data could be applied to the 2015 UK constituency map. The 2005 UK constituency map did not have the required meta data to link the data to the SVG image, so I included a lookup file using the table data on the 2005 UK constituency map page.

Textures

Pixels represent the party colour and appear in frequency proportional to the votes.

textures

 Source

Map Image source code in GIT

Main class: com.knocksfornometer.mapimage.Main

Input Files: src\main\resources

Output Files: target\map

Java 8

Convert map key and output result to separate map.

 JSON property file as String lookup map

I wanted to use some JSON as property files and looked for a Java JSON library.  Gson turned out to be a joy to work with!

Add to Maven pom.xml:

Source JSON:

Load String to String Map from a JSON file:

I also used it to parse the data from the Guardian website. You create a plain Java object (POJO) with a default constructor, that represents the data. In this case I had to specify a date format, as the source JSON used a format different from the default.

If a JSON field name starts with a number (invalid for Java fields), you can add an annotation to link the fields, like: