Phillip Trelford's Array

POKE 36879,255

Fable DJ Drops

This post is part of the F# Advent Calendar in English 2020 series organized by Sergey Tihon on behalf of the F# Programming Language community.

Earlier in the year I picked up a Revo radio for the DAB+ and stayed for the Internet Radio stations, that open up the world of radio, and am now tuning in using an old Raspberry Pi running Pi Music Box connected to the stereo system.

I’ve been enjoying quite a lot of Dub Reggae particularly King Dub Radio which is produced by King Dub Records based out of Marseille, France. Unfortunately it appears to be overloaded right now, so here’s another great station Real Roots Radio coming out of the UK:


To enjoy the rest of this post please crank up your volume and press play on the Internet Radio.

Fable

This month saw the official release of Fable 3 Nagareyama, Alfonso’s F# to JavaScript compiler. Fable itself has been around for a long time, and it’s been my pleasure to contribute a few games samples over the years.

Yesterday I set up and started a new project, which was very easy with only a few command line commands required to create a new project, which sits waiting for you to make changes, a bit like CodePen but running locally.

Web Audio API

The Fable Browser packages provide typed access to most of the browser Web APIs, however unfortunately the Web Audio API is not there yet, but I did find bindings in a massive file in the Fable Import project from Fable 2, which I copied and pasted from and fortunately it just worked!

The Web Audio API lets you generate sounds or play samples, and apply effects, in fact everything you need to augment your Dub, check out the Zongo Dub Siren to enjoy some real-time generated siren effects over your dub music. This is something I’d like to go deeper on in a later post.

DJ Drops

Another common part of Reggae, Dub and Dance Hall music is DJ Drops over the sound. To get some authentic Jamaican drops I commissioned Neil Hype via Fiverr, to produce 4 unique DJ Drops for your enjoyment.

Putting it all together

Follow the link to http://trelford.com/dub select a radio station and hit play, and hit the buttons to play seasonal drops.

Source code: http://trelford.com/dub/FableDub.zip

F#unctional Londoners Meetup activity

This post is part of the F# Advent Calendar in English 2017 series organized by Sergey Tihon.

A while back I used the Meetup API to build a timeline of F# Meetup events across the globe

The timeline (circa May 2016): http://trelford.com/timeline/ 

You can find the source code in this Gist: https://gist.github.com/ptrelford/75fdf3f4c5dc9254736d88d35551c116

For this post I thought it would be fun to use the same Meetup API to focus in on the activity of the F#unctional Londoners Meetup group with an F# script.

The Meetup API returns a JSON response, making it an ideal place to use the FSharp.Data JSON Type Provider:

#r "../packages/FSharp.Data.2.4.3/lib/net45/FSharp.Data.dll"

 

let [<Literal>] auth= "&sig_id=10286388&status=past%2Cupcoming&sig=19c35f766e5b7a8cc163d2711749d8510a91de33"

let [<Literal>] url="https://api.meetup.com/fsharplondon/events?desc=true&photo-host=public&page=200"+auth

 

type Events = FSharp.Data.JsonProvider< url >

let events = Events.GetSamples()

 

This gives us types (and intellisense) over the JSON data, so I can make simple queries like the number of events per year:

let eventsbyYear =

    events

    |> Seq.countBy (fun e-> e.LocalDate.Year.ToString())

    |> Seq.sortBy fst

 

Which returns:

Year Meetups
2010 7
2011 9
2012 11
2013 28
2014 30
2015 26
2016 17
2017 12

 

Next it would be interesting to get a plot, which can be easily achieved using XPlot:

#r "../packages/Google.DataTable.Net.Wrapper.3.1.2.0/lib/Google.DataTable.Net.Wrapper.dll"

#r "../packages/XPlot.GoogleCharts.1.4.2/lib/net45/XPlot.GoogleCharts.dll"

open XPlot.GoogleCharts

 

let years = eventsbyYear |> Chart.Bar |> Chart.WithTitle "F#unctional Londoners Meetups"

years.Show()

Here’s the nice bar chart result:

image

And for more detail down to the day we can use a Google Calendar chart:

let options = Options(title = "F#unctional Londoners Meetups", height = 1200)

let activity=

    [for e in events -> e.LocalDate, 1] |> Chart.Calendar |> Chart.WithOptions options

activity.Show()

 

The white squares indicate a meetup event:

image

Looking at the data, we can see there’s been a meetup almost every month since the group started back in 2010, and back in April 2016 we managed 5 events in just one month!

We can also see that there’s been slightly less meetups over the last year and a half. This roughly coincides with the fact that I stopped working in London in early 2016. To this end, if somebody who is interested in F# AND lives or works in London would like to get involved in organizing the group, then please do get in touch.

That said the show will still go on (just a little less frequently), and we have a meetup scheduled this week on Thursday 7th December with Jorge Gueorguiev Garcia on Functional Calisthenics, so please do register and come along.

Silverlight Resurrection

Silverlight, once hailed by Microsoft evangelists, is now dead, crucified by the side of Flash by Jobs when he brought down his tablets from mountain view, and then buried by Sinofsky under his surfaces. But is it really dead? Silverlight certainly seems dead in the browser with Google cutting off support in Chrome followed by Microsoft in Edge. Yet Silverlight still lives on in Windows Phone and Windows Store (formerly Windows Runtime, formerly Metro).

Resurrection

Back in 2010 and 2011 I made a series of mini games written in F# with Silverlight and hosted on this blog along with some online arcade sites likes GameJolt and SilverArcade. Rather than let them slide into the sands of time never to be played again I thought I’d have a go at resurrecting them for Windows Phone.

Search for a stable… environment

I started by attempting to create a Windows Phone project in my shiny new installation of Visual Studio 2015 Community, but failed at the first hurdle. To run the Windows Phone emulator you need the Professional version of Windows and silly old me had installed the Standard edition when I rebuilt my Windows partition after a fatal blue screen in the new year.

Then I moved on and tried trusty Visual Studio 2013 but hit the same hurdle. Not to be deterred I went back another year to Visual Studio 2012 but hit a new obstacle, where the 2012 tools don’t work if you have 2013 installed.

Back to the Future

No problem, I span up a virtual machine in Oracle’s Virtual Box with ye old faithful Windows 7 and Visual Studio 2010 installed, and after pushing on VS2010 SP1 and the Windows Phone tools, then some obligatory rebooting and service patches, I was up and running and had a game ported and playing on the emulator. I used a Windows Phone project template from Dan Mohl, which requires an empty C# host project because CLR stands for Common C# Language Runtime apparently. My only remaining issue was that running the phone emulator within a VM was painful. My next step was to purchase dedicated hardware in the form of a refurbished Thinkpad (circa 2010) from Morgan Computers and I finally had a stable environment with an emulator for porting the apps and games over (although no option to deploy to a device as the Zune software is no longer supported).

Lenovo /IBM X201 Intel i5-520M 2.4GHz 12.1

Across the Universe

Microsoft are currently touting the Universal Windows Platform as the future, letting you easily deploy your apps between Windows 10 Phone, Store and other platforms. That said with Visual Studio 2010 I can target the entire Windows Phone range from 7 up to 10, note that number 9 went missing somewhere along the way.

Also note the Windows Phone 7 market currently appears to be almost as “large” as Windows 10 Mobile.

Alien Resurrection

The first game I ported over was Invadurz, a homage to a classic 80s arcade game. It’s available in the Windows Store and I’ve recently upgraded it with low-latency sound effect support via XNA.

Screenshot

And despite the screen shot being the wrong way round a few people have even downloaded it Smile

image

With a simple and stable porting system in place I quickly submitted another 4 apps and games, all available free in the store:

Submission

With some experience under my belt I recently headed down to London to the Windows App London meetup (previously the Windows Phone user group) for the Submit it! hackathon, and during the day I managed 5 submissions:

and won an Easter Egg from Tesco for my efforts!

Second Coming

Just as in the bible, a second coming is in the offing. XNA is dead, long live MonoGame.

I’m currently working on moving the Windows Phone submissions lock stock and barrel over to XNA which should give me a route to full cross platform resurrection via MonoGame with deployment to Android, iOS and beyond…

CNUG6LkWwAAlpuJ.png (433×242)

and many more users, or at least that’s the theory.