Categories
photography

Spouting music into The Void

This tweet by Ron S. of Anode Records encapsulates well how it often feels to share your music online. For me it’s borderline embarrassing to announce to the world your own creative work. And the way it goes is that you build it up… and spend days (sometimes weeks) fussing over details and over-listening until you have pretty much no idea if it’s any good or not any more.

So after all that, and even though you primarily make music for your own enjoyment, it would seem a shame to just leave it on your own hard drive forever, never to be heard by anyone else. And if you’re me (which I am) then you know full well that it’s amateur dad-techno which probably has niche appeal to a handful of your also-40+ cohorts. But… well maybe those people would like to hear it. It would be great to get a bit of feedback too. Is it any good? Do you like some bits? Does this have any merit at all? So you send it privately to ten or so friends and family. Be honest, tell me if it sucks. Anything!

But you don’t hear back for a few days so whatever… out goes the Tweet and a Facebook post. May as well throw it out there.

But then still nothing. No interactions or responses. Awkward.

So you then worry that everyone thinks it’s so terrible that they don’t know what to say. So you look at the stats and, no, that seems not to be the case because because, well, twitter gives you tweet analytics:

  • Impressions: 179
  • Likes: 1 (thanks bro)
  • Retweets: 1 (my other account)
  • Link clicks: 1

And Facebook:

  • 3 people reached
  • 0 engagements

So one person clicked through and listened to the track on SoundCloud. In 36 hours. The tweet is now well buried.

The reality seems to be that it’s pretty difficult to get people to hear what you’ve recorded. Is nobody interested in this sort of music any more? Or are they just busy? (probably this) Is it because there’s a zillion hours of free music uploaded every minute? Or is it the algorithm making it essentially hidden? (could be) Is social media just a bad way of sharing music unless you’re Calvin Harris with 12.6M followers?

If the problem was just that the music is crap I would expect a lot of clicks but no likes. But there are near zero clicks. Nobody is hearing it to begin with.

This, in part, led me to giving up for 18 months. What’s the point? But then I missed doing it and got quite low because I wasn’t doing anything creative in my life (work is mostly technical these days).

So it’s 2020 and I’m starting up again. And it’s not at the standard I would like yet. So the answer is to make more and more stuff. But then to be more selective. Fail lots and get better. I’ll continue to share it because why not. But like Ron, above, I won’t expect any of these tweets to blow up anytime soon.

p.s. Ron S’s Planet Z tracks are pretty great. And thanks to anyone who did spare a few minutes to listen to my new tracks (thanks Tom, Ben + Daniel!) And thanks Dad for buying a copy on Bandcamp 🙂

Categories
geek mathematics tech

Noughts and Crosses

TLDR: play it here

Between Christmas and New Year this year, as every year, the Royal Institute Christmas Lectures took place. This year they were presented by Hannah Fry and the title was ‘Secrets and lies: The hidden power of maths’ (here on BBC iPlayer).

Our boy is now seven so we were keen to sit him down to watch the lectures. I remember being at school and struggling a bit with the “why” of maths. Understanding how maths is applied in the real world can really bring it to life. This year’s lectures did exactly that and he loved them!

In one of the lectures Matt Parker demonstrated a machine called MENACE created by Matt Scroggs (a copy of Donald Michie’s 1961 MENACE). MENACE is built out of matchboxes and can effectively play noughts and crosses:

Matt also made this this JavaScript version of MENACE.

I found this totally fascinating and decided to make my own version, basically as a learning exercise. It had never previously occurred to me that building reinforcement-based machine learning code might be something within the reach of my capabilities.

My version

Play it here – Hint: when you first load it you are playing a complete beginner. Click the green button to load a pre-trained computer player.

It is built in AngularJS which is a framework I know well, so I could quickly put together the basic game mechanic. AngularJS provides a code-light way of binding data to an interface.

The first (and easiest) part was to make a noughts and crosses game engine. This is fairly straightforward because it’s such a simple game. Initially the game was just for two human players.

The second (and more interesting) part of the task was to make the computer player itself. The computer player is separate from the game program, and is notified by a window event when it is its turn to go. The game controller has a public method so the computer can ask it for the board configuration, and another method for the computer to make its turn (also used by the human player).

The computer player is in not programmed to play noughts and crosses, it has to learn how to play it from scratch. The only thing it gets told is where it can go, so it doesn’t try to go in places that are already taken.

The computer player deals quite abstractly with a flat array of positions that it calls the ‘stateArray’. For basic play it doesn’t even need to “know” that these are arranged in a square. The process is:

  • Get the state array from the game controller
  • Find which places are free
  • If it’s the first time it’s seen this configuration: Generate an object representing an equal chance of going in each free position. Otherwise: Fetch from memory the existing object representing this configuration.
  • Pick a position at random from a pool of choices where the number of each choice in the pool is determined by the weightings (so for the first time it sees any given configuration there are an equal number of choices for each position).
  • Make its move
  • Remember where it moved and what the board configuration was at the time
  • At the end of the game, for each move made, create or update a permanent record of the configuration at that time updating the weighting according to whether it won, lost or drew the game. In other words if it won it will be much more likely to make that move again. If it lost it will be less likely to make that move again (and eventually the chance will be zero) and if it drew it will be just slightly more likely to repeat the move.

Rotations

All of the above can be done without the computer player needing any sense of it being a square board. However an extra level of complexity was required for it to work like MENACE – namely rotations (technically rotations and flips). So in addition to the above I added a rotations handling service. This needs to know the board width and height. Essentially it turns that flat state array into a two dimensional array (rows and columns). These 2D boards can then be rotated or flipped. For any given board configuration the rotations service works out all the equivalent rotations that are unique on the fly. So for some configurations there would be no equivalents (e.g. a blank board, or only one item in the middle). It mirrors and flips the board so there are up to eight equivalents for any board layout (see this Google sheet).

The mirrors service itself took me about a day to grapple with, it’s complicated because we need to:

  • Get all rotations of the current board
  • Search our history for the ‘keys’ of those rotations (to see if we have seen any of those rotations before)
  • On finding a match get the move weighting of that match.
  • ‘Unrotate’ the matched move weighting object (reverse the process) so it aligns to the ‘real’ board
  • Pick a move using the unrotated weighting and make our move
  • Finally re-rotate our actual move position so we can update the chance of going there again in the context of the rotated version in the history

This mirrors service itself ran to 250 lines of code. There are probably ways to do this more simply, perhaps by people more adept at maths! I got there eventually but this was by far the most complicated party of the work and took a day to write (this file and the integration with it back inside the computer player module).

I made the rotations module separate from the computer player to keep things flexible. It does not have the board dimensions hard-coded, so it could be used for other games too.

Summary

Take a look at the source code here on Github

This was great fun to build. Noughts and Crosses is of course a very trivial game with only a few hundred possible board configurations (and even fewer due to the rotations) but even so building a computer player that learns how to play it was surprisingly complicated.

I am now wondering if I can repurpose the computer player to learn how to play a simplified version of Pontoon (i.e. should it stick or twist for any given hand?). And I am also thinking about a way of building a player for Connect 4.

Connect 4 has many more places and possible configurations so it might require a different approach but I will see where I get to. The key differences are:

  • In Connect 4 you can only pick a column to move in, not a row (pieces always fall to the bottom and do not float)
  • In Connect 4 we can’t rotate the board as it is bound in one orientation by gravity. However we could most definitely half the configurations (and must do to speed up learning) by flipping horizontally.
  • The number of possibly configurations is vastly greater than in noughts and crosses so we might not be able to store every possible state, in part due to memory limitations and in part due to this being inefficient. Given that we only need to worry about rows, columns or diagonals of length 4 it might be sufficient to only consider configurations within 4×4 squares regardless of where they are on the board. This should reduce the amount of unique patterns to store. I will report back once I get going with it.

Anyway let me know what you think. Or if you have any ideas on how to simplify or improve the code let get in touch and / or make a pull request.

Categories
ade music

Mid-late 90s techno records for sale

I may come to regret this, say, if an electromagnetic pulse from space wipes out all of humankind’s digital storage. But I’m selling most of my vinyl records.

You can find them for sale here on Discogs.

Categories
ade music

Firstperson playlist on Spotify

For anyone with:

  1. A Spotify account
  2. 1.5 hours to kill
  3. No other music to listen to…

…well you’re in luck because here’s a playlist of all my Firstperson stuff on Spotify:

Follow firstperson on Spotify:



Categories
ade music

Nested Worlds EP released TODAY

It’s release day! My ‘Nested Worlds’ EP is now available from your favourite download stores:

Direct from the label (cut out the middle-man!)
anoderecords1.bandcamp.com/album/nested-worlds

iTunes or Apple Music:
itunes.apple.com/gb/album/nested-worlds/1331012464

Amazon Music
www.amazon.co.uk/gp/product/B078SJXZ84/ref=dm_ws_sp_ps_dp

Beatport:
www.beatport.com/release/nested-worlds-ep/2189111

Juno:
www.junodownload.com/products/firstperson-nested-worlds-ep/3643675-02/

Spotify:
open.spotify.com/album/4i92WYuSm9ebN9UEu0dWiI?si=ot1f7x0ITIe7lzEdSLhA7Q

Thanks for your support! Ade

Categories
ade music

Nested Worlds EP available to pre-order

My EP ‘Nested Worlds’ on Anode Records is now available to pre-order from the following outlets. It will be released on 26 January.

Listen to previews here on SoundCloud:

Categories
ade music

new music – hardware series

I have finally completed my series of ten tracks. They are all intentionally club-style techno tracks made in a retro 90s-inspired style, using a collection of hardware (i.e. not on the computer) to see what I could do and what I could learn from the process.

Four of them have been selected to be released by Anode Records (see here and here) based in St. Louis, Missouri which is a great honour. The four track EP will come out some time in the new year.

I’m now working on a set of more refined ambient and / or dubby re-works of these tracks – reprocessing and reusing some of the recorded elements. I expect to get some of those completed in the next two months, studio time allowing. Studio time is quite sporadic due to this being my spare-time hobby, and having a lot of work on at the moment and of course a family who presumably want to see me from time to time 🙂

You can find more of my music on Bandcamp or SoundCloud.