Friday, 6 March 2015

Rather than 'play some more' i went head-first into writing a better display/model/control thing for the synthesiser stuff.

Doesn't look much different on the surface since the stylesheet is much the same but pretty much everything is backed by controls and skins and observable properties.

I have a 'Workbench' control which is the main controller and it handles the human wiring process and so on. I abstracted the connection points as 'Sockets' in a way which allows me to add other non-JSyn objects such as the dials which just feed out their value to some input port. Not shown but you can also reconfigure input ports to change their name and bounds so that they connect properly to dials.

I added the ability to unplug and move the ends of a given wire which works quite nicely. If you grab a wire near one end and 'pull' it far enough it detaches and becomes a free end, which can either be attached to some other compatible socket or letting go just deletes that wire.

I/O next I guess? Always the pain ...

FWIW The circuit above makes a pretty basic "idling chopper" "fop-fop" sound.

Thursday, 5 March 2015

Connecting the dots (with wires)

Yesterday I hacked up a "workbench" gui for JSyn. I just started experimenting with auto-generating the gui based on the UnitGenerator interfaces, it's designed with this in mind so it is fairly simple.

Blocks are added by clicking on the workspace, wires are connected by dragging a line between the discs, blocks can be arbitrarily dragged around, wires or blocks are deleted with delete or backspace keys; typical basic graphical user interface stuff.

One of the more difficult problems was how to wire up the ports ...

The difficulty arises because one uses container classes to form grouped gui components and do the layout, and then you want to be able to bind a linkage between an inner component of the group and components working in a different local coordinate system.

A diagram of the layout hierarchy as it currently exists helps to explain (this is just a prototype so the layout is a bit shit).

     Ellipse    Label
        +----+----+
            HBox
             +
          EndPoint (Pane)
       - ----+---- -
            VBox
       - ----+---- -
         Generator (BorderPane)    Wire (Line)
       - ----+-----------------------+
           Pane

So the Line representing the wire needs to connect to the Ellipse level, but the Line is in the coordinate space of the lower Pane and the Ellipse is in the coordinate space of the HBox which is in the coordinate space of the EndPoint, which is ...

So I created a new set of properties socketX, socketY, which reside on each EndPoint which maintain the location of the centre of the Ellipse relative to the lower Pane. The calculation is straightforward and based on transforming to and from scene-relative coordinates. It gets updated whenever the EndPoint is moved (relative to the Generator, i.e. after layout), or when the Generator is moved (i.e. relative to the Pane). The Wire can then just bind to these locations using javafx properties. I've got each generator maintaining the endpoint updates relative to it's parent but i'll probably have to come up with something better.

There's still a problem to solve though; the user interface allows you to plug a wire in to one socket and then drag it to another socket (i.e. click and drag). Unfortunately javafx currently has no way of picking a widget - i.e. looking it up by location or by the mechanism the event system uses. At first I tried using drag and drop mechanisms but it interfered with other gui operations and I couldn't find a way to show the wire following the mouse pointer.

So unfortunately I have to maintain a separate list of all the EndPoints in a model which I then scan for a match during the drag gesture. But given that this allows me to use layouts and stylesheets and so on, this is acceptable.

Duty Cycle

I created a new square wave oscillator type for JSyn as i was surprised the one it comes with doesn't have a duty cycle (pulse with) parameter. It was one of the more useful features of the square wave oscillator on the SID chip and features heavily in C=64 music. I think it could be created using a sawtooth generator and a gate but this is easier to use and was simple to make.

The circuit above generates a rather grating undulating / phasing sound effect like a 'robot thinking', or with a lower frequency a (metallic) misfiring engine.

I guess i'll add more of the unitgenerators from JSyn and do some experimentation with the code I have. If it's interesting enough i will probably dig deeper into making it a real application; it will need a better system model and probably a way to create a control panel separate from the inner workings of a circuit, as well as oscilloscope and spectrum analyser blocks (JSyn has most of this but it's all Swing).

Tuesday, 3 March 2015

bang!

Been getting pretty bored of being stuck in the house. Enough so that I coded up a basic space invaders game for something to do. At this point almost everything is there apart from the mother ship going past and some other game state things or animations. I've tried to keep the ship movement and wave structure correct (something clones usually try to 'improve') based on the C=64 version.

I'm using javafx for the graphics (i.e. most sprites are just a Rectangle - the actual shape isn't terribly important for the mechanics, and saves copyright issues) but the barriers are WritableImage's and i do the hit detection and bomb erosion on separate image arrays that back them. Because of the way the hit detection works it would probably be easier just to do everything on a bitmap manually but I didn't feel like starting from scratch after starting with a scenegraph version.

Yesterday I added some sound effects. The invader explosion sound is a flat beep but the rest are more or less correct including the 4-note 'tune' which speeds up as the invader movement does. It doesn't sound right when there's only one left but otherwise it's close.

This lead me to play a bit with the java sound api ... which is somewhat better than I thought it was; e.g. it provides automatic mixing and so on. It also meant I had to do some sound synthesis for the tune and effects. So far i'm generating sample Clip objects from some synthesis code I wrote myself but today I looked into it deeper and found some existing synthesiser libraries that should let me generate some better sounds. But i'll need to play with them a fair bit before getting anywhere. Actually unless I find something i'll probably have to write some tools for it anyway which starts to make it a fairly significant effort.

Last time i played with synthesisers was with the SID around 1990 and I never got very far with that, so i'm starting from a point of somewhat ignorance here.

Friday, 20 February 2015

Care factor -1?

Well looks like my nice long break from work is coming to an end soon. Just as the weather picks up to a proper summery hot. I was starting to wonder if we'd get a proper summer this year, it's been a bit mixed. But i've been to the beach a few times in the last couple of weeks and the water's really nice - although most people just seem to go there to sit in the stinking hot sun and barely touch the water if at all (it's like 37 today, although somewhat cooler on the beach it's much hotter in the sun).

Garden kinda went to shit although i've got a row of sweet-corn which should be just about ready to go. Had some hot days but cold nights which seemed to burn the tomatoes and then they got hit with mould or something that killed the leaves off. Still getting a few fruit although grubs are showing up too often. Because they came in dribs and drabs and I wasn't ready I froze enough really nice ripe ones to make tomato sauce when I feel like doing it. Cucumbers were a complete bust. Beans weren't bad. Chillies are ok although i'm eating the lesser ones faster than they ripen. The habaneros are well infront at least and hopefully the ones in pots last a bit longer.

I did almost no hacking. A tiny bit on a web server thing, a little on a space invaders clone. Can't really get into it.

Played some games. Driveclub with it's patches is growing into the masterpiece I always knew it was although I got my first crash on the PS4 using it a couple of days ago. Nobody I know has a PS4 and i'm not in a club which kinda makes the challenges a bit less than they could be, but I go through the community challenges every few days and have a few laps of any that take my fancy. Although most are in the faster cars or longer tracks which I don't find particularly fun. Even won one on Oliver's Landing which is the track i've got closest to 'mastering' (it's the shortest track, and only in forward). I think the Canadian and Indian tracks are the best - prettiest and best track design and road surfaces. The game makes my 46" TV feel too small :( I've been sitting on the coffee table about 1m from the screen if i'm trying to be serious on a track and that makes a huge difference - it also makes the in-driver view work quite well although i'm more of a bonnet man myself. The network code is still a bit flakey - it really sounds like they had to throw it all away and start from scratch and that's going to take months to finish. I've got a small amount of experience with OLTP systems, it would be interesting to know what they did wrong but I guess i'll never know. I'm up to level 41 but only 100 stars into the tours, i feel like buying the season pass except that i doubt i'll get anywhere in them so it seems a little pointless. Although iv'e got two other disc games DC hasn't left the drive for some time. Actually I was poking around where it is and noticed that whole corner of the shelf was covered in spider web with resident daddy long-legs ... i guess i need to do a bit of a clean up.

The resogun update is pretty good although the ranks for the challenges are so insanely high I doubt i'll ever get to try many of them out. I think I will at some point buy the two expansions because the new modes looks like nice (and it's kind of cool the developers were around on the Amiga).

I've been 'buying' most of the PS+ games for months but only occasionally trying them out. The Swapper was a pretty cool play although the whole religious/soul stuff was a bit pointless (as ever). I think i burned through that in one sitting, and did a replay in about an hour - once you know how to solve the puzzles they're mostly pretty easy. I liked Transistor although one-way flirting with a disembodied man's voice is a little off-putting. I've not finished it yet. Thats another game I really have to sit right at the screen to see all the detail (god, wtf would anyone need a 4K TV when I can't even see this one). I tried Infamous: First Light the other day and I guess it was what I expected: infamous is not really for me. The mechanics mostly seem ok although I tend to just keep spamming the radar button otherwise you can't see anyone. I guess my main gripe is that the camera feels claustrophobic - all that pretty town and you spend most of the time looking at the minmap. The environments look pretty amazing though and it moves very smoothly, it seems to be triple buffered but the "frame pacing" is doing a really good job hiding the judder that would normally introduce. Rogue Legacy just seemed, well shit. Very much like many of those C64 ports of early spectrum platform games. Although I think I got further with that than Spelunky which I uninstalled part way through the tutorial levels - just too many controls for what is essentially a crappy oversized Rick Dangerous clone. There was some other digging/exploring game that I gave a bit more of a go of but I just didn't see the point so gave up: at least it was trying to be a bit interesting though.

Back on the PS3 I sunk a few days into Dragons Dogma; came across a pawn with insanely good armour which made the going a lot easier. I kinda got lost for about 20 hours as to where the main "plot" advancement bit was, but i got back on track and now the pawns keep making it obvious by prodding me for the next step. The game doesn't really open up until you hit level 40 ... and at that point just running across the open fields getting from a to b becomes a bit of a drag (even if you have those portal stones, you always seem to leave them in the wrong spot). But after 55 hours in the whole point is lost on me. The graphics on it can look really rough but at other times with the right time of day they can look spectacular, and the character models (particularly the faces) are pretty decent. Tried a few other small things but nothing that I can remember now. I've got a lot of other bigger games i've either not started/opened or barely touched, which I will probably never get around to (small things like "the last of us remastered" ...).

It just takes so much time to play games, and even if you've got a lot of it it seems too much because there's always something else you could be doing with that time instead. I find myself checking to see if anything is worth watching on TV of an evening before thinking about games and it quickly gets too late to start on something. During the day it seems a poor use of time - even if i all i do is fuck around on the computer anyway.

I've also been reading some god-awful "fantasy epic"; The Dragon's Path (well that was the first book). Hate almost all of the characters (except maybe the soldier guy who is about my age and just seems to have ended up where he is through circumstance rather than being a fuckwit/underage slut/completely insane lunatic), the storyline is annoying (medieval world bank/religions/ruling class bullshit), and the story telling mechanic employed isn't great. About the best thing about it is it keeps sending me to sleep, which is actually quite useful for me. Still, I've been trying to plough through it so i can find something better to read. I've got 1 1/3 books to go so I guess it'll be a good few weeks of getting to sleep easier yet :)

But I suppose the most annoying thing is i seem to have gotten gout, or something much like it. One day I had some strong coffee, some beer (while bottling homebrew), then went for a 30km ride on a warm/windy day, dropped by the pub and had 2 irresponsibly-quick jugs of beer, came home and polished off the day with crackers and salami for dinner. Then suddenly out of nowhere it felt like i'd broken my big toe - and i wasn't even sure if i actually had for a while. So then I was basically stuck in the house for 2 weeks playing games (sober!) until i finally got sick of it. It's not particularly painful now but it gets a bit swollen if i use it too much in a given day so i think it's just moved on to some sort of 'stress trauma' of the big toe. Feet have been shitty for a few years so maybe its related. Doctor didn't seem to think it was much to worry about at any rate but i'm cutting way back on the booze for now anyway. I was getting a little bored of that TBH so it wasn't a very hard change although I'd just finished bottling my 5th consecutive batch of homebrew (none of which contributed), so i'll have to see if i can drink it. Wasn't much of a birthday present though.

Wednesday, 28 January 2015

No madam, that is not a tablespoon.

I was looking for a decent can opener yesterday - still didn't decide, they're expensive or they're shit and the expensive ones might be shit anyway if they use the weak plastic bearing they use on the cheap ones - and remembered I haven't been able to find my measuring spoon set the last few times I needed it.

So i checked measuring spoons ... and NONE i found in the department stores or kitchen-shit shops were to Australian standard; they only had euro/uk 15ml tablespoons.

Whilst the teaspoon is the same size at 5ml, Australian tablespoons are 20ml.

It's just baffling. I didn't raise it with the staff because I wanted to check my memory was correct first (although i was quite certain as i'd had a somewhat robust discussion with my sister over the fact about a year ago!).

Obviously I could just use 4 teaspoons or some other mix but obviously I can also choose not to buy incorrect measures from a local retailer. Maybe the supermarket will have something correct; they still SOME Australian stuff and not just (dumped) EU brands.

Update: The only ones at the local foodland were actually correct. Although "curiously" the half tablespoon is 7.5ml rather than 10ml; but nobody seems to use dessertspoons anyway so i'm not sure what it's supposed to be.

Thursday, 22 January 2015

"HoloLens" - PR speak for LASER.

To create Project HoloLens’ images, light particles bounce around millions of times in the so-called light engine of the device. Then the photons enter the goggles’ two lenses, where they ricochet between layers of blue, green and red glass before they reach the back of your eye. “When you get the light to be at the exact angle,” Kipman tells me, “that’s where all the magic comes in.”

First part is clearly a LASER because that's how they work. Second part is? Prism? LCD panel? DLP thing?

It sounds interesting enough on it's own without having to fluff the language so badly. At first it sounded like it could be a hologram due to it using a LASER (coherent light) but it just sounds like a projected screen; common sense tells us that there's not enough processing power to render volumetrically at the required resolution to start with.

My guess is that they were worried that the public might be scared of the makers of Windows and the XBOX 360 RROD disaster making hardware that shines a LASER directly into their retina?

But yeah "light engine", FFS.

Tuesday, 20 January 2015

Yay, NBN is here at last.

Got the nbn hooked up on Friday - and fortunately i'm still in an area they're doing fibre to the home even if it is coming in over-head. Of course most of the country should be getting that too but the total fuckwits running the country decided to show their complete lack of intelligence and add a ton of future cost and grief by changing it to 'fibre to the node' so they can maintain 50 year old copper pairs until they need to go back to the original plan at double the expense, ... but i digress.

It was something i was kind of excited for a few years ago but then I kind of cooled on the idea since the internet is mostly just a pointless waste of time. But then again so is most human activity isn't it? The NBN is mostly just going to be used for ip-tv i'm sure.

The ADSL I had before wasn't too bad so for the most part there isn't much difference so far since most sites were bandwidth limited their end rather than mine but it should be more reliable during wet weather if nothing else (the old modem was getting flakey too and needed a weekly-or-so reboot). I guess the peak (i'm willing to pay for right now) is 2x download and much higher upload (10x or 20x, not sure what it was before) compared to my ADSL, which is better than a poke in the eye.

I am getting a fixed ip address this time and will be setting up a local webserver - mostly because I can and want to but also to play with some web software and move away from google's advertising-supported services. I'm going to try to write my own cms/server/thing based on some experiments I did a few years ago; but it could be a while before I get anywhere because i'm just not in any rush and the weather is too nice over summer (and it's a fairly large undertaking together with me being a bit rusty on the technologies involved).

I'm also going to try to run it on my beagleboard xm too just for kicks - after a bit of a search i found where i'd left it and it seems to be working fine. It should be fast enough for the "expected load".

I'm too lazy to take a picture of it right now but yesterday I finally worked out how to fit the beagleboard and a usb harddrive into a tidy & compact case. I have an old/dead 3.5" USB HDD enclosure made of extruded aluminium that I cut out and filed down some holes for the usb/network slots and had a portable 2.5" HDD I filed down a bit to slide into the other end (retaining all the shock mounting and external case). I have the connecting cable running externally but since it's already got a network cable coming out the same side it sort of "works" and is a lot neater than anything I could come up with when trying to shoehorn the cables into any other reasonably sized box (usb cables are so bulky in a confined area).

I didn't add any holes for the audio/video panel but there should be room for some right-angle plugs should I need it. I guess if i ever replace my burnt out amp I could set it up near that and use it for a radio too.