## Saturday, February 23, 2019

### Pseudo Random Numbers

If you aren't interested in random numbers just skip this post.
Keep in mind that there is content here and log it for later. At some point in the future random numbers will be a valuable commodity.

The reason I made that last statement is that privacy is increasingly important and that privacy depends on good and absolutely random numbers. So why am I blogging about pseudo random numbers? After all, they're not really random. There may be times when you may not have true random numbers available to you. If pseudo random numbers are all you have they'll be better than nothing. This post shows you how to create PRN's on a cheap calculator. The calculations can be done with pencil and paper but a calculator like the one above will be quicker. I recently bought a similar one in a charity shop for £3. An even cheaper non scientific calculator will work for this also.

If your curiosity has got you this far I'd recommend watching a really good video on YouTube. It's just under 15 minutes long. The calculation used for the Linear Congruential Generator wasn't explained in simple enough terms for me so that's what I plan to do here.

How would you interpret the equation in the video so as to resolve it on a calculator? Here's how.

First the equation:
(seed · a + c) mod m

Where seed = starting value, m = modulus, a = multiplier, c = increment.
The values in the video would make the equation as follows.

(4321 · 378 + 2310) mod 7829

On your calculator press the following keys:

4321 x 378 + 2310 =

The result will be 1635648. Write this down or just leave it on screen if your calculator lets you calculate an answer. We'll be using this figure for the mod part below.
Let's just say you've cleared your screen, key in:

1635648 ÷ 7829 =

The result is 208.922. Next subtract 208 from the last answer as follows:

208.922 - 208 =

All we did there is to subtract the number before the decimal point which in this case was 208. The result is now 0.922.
Take this answer and multiply it by your modulator which in our case is 7829.

0.922 x 7829 =

This number is now the new modulator. Just keep repeating the steps above until you have enough pseudo random numbers.

The numbers used above can be whatever you like but as mentioned in the video the higher the modulus the better.
I'll be covering other methods of obtaining pseudo random numbers soon and later methods for true random numbers. Pseudo random numbers are fairly easy to create and can also be used for creating true random numbers.
More on that another day.
If you've made it this far, well done.

## Thursday, February 21, 2019

### More Latex

I made a promise to myself to write this year.
The main object of that resolution was to get back to being creative. So far I've been doing alright. What I write doesn't matter. It could be music, fiction, non-fiction or just scribbles in a notebook. I'm covering all four so far and then some.

As mentioned last time I'm just getting into using LaTeX. It's basically a markup language which I'm very comfortable with having learned HTML in a text editor many moons ago. LaTeX is much more that HTML. It's the equivalent of HTML plus CSS with a bag of tricks thrown in.
I've just spent a few hours practising in the Atom editor, which in itself is a joy to use, and produced the layout for a work of non-fiction including a table of contents, chapters and footnotes. All I need to do now is add the content. Even before I've really started it's looking professional and that is encouragement enough.
It won't matter that it won't be published by someone like Penguin, I'll do it myself with a creative commons licence. My fiction will probably go the same way as my music has before. Like it or loath it, it's all free. I'll just be happy that my written words will look good and I'll leave readers to decide on the content.

What matters to me most is that I'm really enjoying my writing this year and that I have enough projects to bounce between. I like that when the ideas for one project dry up I can move on to something else until inspiration strikes that topic again. Talking of which, I've run out of things to say here.
At least until next time you know I'll be busy.

## Saturday, February 16, 2019

### Atomic Latex

I absolutely love text editors.
I'm easily distracted when it comes to the simple task of inputting text into a document. Linux offers a plethora of text editors. From Nano to Atom, I love them all.

It's not so long ago that I discovered Atom. I won't explain its capabilities here, you probably have better things to do with the rest of your life. What it is, is extensible. I use it for simple .txt files, python, markdown and now Latex.
Latex (check online for pronucciation) is a way of creating professional .pdf files. It uses a it's own syntax for layout but its power comes from the fact that it is ideal for mathematical and scientific papers. This is down to its ability to correctly render equations.
I'm not going to be writing anything so complicated soon but I will need the capability as I continue my search for some kind of accessible way to create random numbers or at least pseudo random numbers.
I have a calculator app that will let me enter Latex syntax equations. I'm looking into whether actual programmable calculators have the same option.

In the meantime I will learn the Latex syntax and try and produce something worth looking at while my mathematics education steers me to more complex calculations.
It's all good fun even if I don't understand completely what I'm doing.
My destination is a long way away but the journey of learning is what I intend to enjoy. Besides I only have to understand what is going to be useful to me and from this angle that isn't a lot.
However I do understand that looks are deceptive.

## Sunday, February 10, 2019

### A Lot Of Tonespace

Here's something I've been messing with all night.
It's free software called Tonespace and it's very interesting and extremely useful. It's main job is to play chords which it does very well. The way it plays the chords can be adjusted in a wide variety of ways. What I found so inspirational is the way it will randomly re-voice chords. Just choose the setting and it jumps around your selected chord and adds or moves appropriate notes within your chosen scale. That could make a simple 3 chord song sound very interesting and varied. It's particularly good if you MIDI it into a decent string or orchestral sound.
A lot of this evening was spent patching it into various other bits of audio kit. I'm still getting used to routing everything through Jack. Jack is kind of intuitive but sometimes things just won't play well together and a fair bit of trial and error goes on. Having said that, once you've worked out where you're going wrong and fixed it you can save your MIDI patch for next time.
I expect I'll be orchestrating a few more songs than I thought I would.

## Saturday, February 09, 2019

### Something Different Maybe

I'm probably one of the few remaining people still using Google+.
This blog used to get pushed to G+ but that has now been stopped. I've rarely published directly to G+ but I use it every day as a news aggregator for stories about crypto and Linux. I'll miss it.

It has made me wonder how long Blogger will be around. The Android app is terrible and I don't have a use for it because there are no user definable layout options. So what happens if Google decide to retire Blogger?
Strange as it may seem Github may be an option. If one has a Github account one may have a Github Pages site. It's a little more involved than Blogger and requires use of Jeykll to publish markdown pages as HTML. The markdown part is OK, I already use the Atom editor for my markdown which is in itself a Github product.
Initially I like most people had reservations about Github after it was bought by Microsoft but Microsoft seem to be moving in the right direction with open source and that is encouraging. Things could and probably will change, they always do.

For now I'm sticking with Blogger. I've been using it for years and I like it but I do think I'll be experimenting with Github Pages soon to see if it could be a viable solution if this blog's home goes south.

## Sunday, February 03, 2019

### Flesh To Bones

This is a step closer to the first of my new music.
It's the scratchpad before all this MIDI information gets sent to my QY100.
The basic elements of the composition above were created in Seq24 which in itself is a wonderful musician's playground. This phase in Qtractor is all about seeing if the elements work together well enough to form patterns that will create the backing track for further work.
My next step is to add all the elements to the QY100 and create the patterns. I'm going to try to save the MIDI file to my SmartMedia card and see if I can extract the bits I need. If that doesn't work I'll record each phrase one at a time. It's all still a learning curve but at least it's not too steep.
Onward.

## Saturday, February 02, 2019

### Hacking MIDI

It's been a long night.

I've been messing with the QY300 and associated peripherals for about 8 hours. The first job was to fit it with a virtual disk drive. It was advertised as plug and play which it certainly is. It's saving all the data into virtual drives so that I don't lose hours of work. The weird thing is that the drive isn't showing any files when I plug it into my Lubuntu laptop. In all fairness they are both using totally different file systems. That does't matter though because I've managed to get my laptop talking to the QY300 over USB to MIDI cables so it's all good.
The idea is to create new patterns on Seq24 and add them to the QY300 which will be the backing for my songs.
While I'm on the subject of QY's, the QY100's SmartMedia card is read perfectly well by Lubuntu so there's always the option of doubling songs back onto that before re-voicing with the Korg. It all sounds very complicated but it isn't really and bouncing MIDI files between devices (including my phone) gives me endless options for creating music. I have an OTG adaptor for my phone so I might try driving the QY300 with that tomorrow.
Now I know everything works it time to get down to the business of writing some music.
If only inspiration was as easy as MIDI!