About Me

Michael Zucchi

 B.E. (Comp. Sys. Eng.)

  also known as Zed
  to his mates & enemies!

notzed at gmail >
fosstodon.org/@notzed >

Tags

android (44)
beagle (63)
biographical (104)
blogz (9)
business (1)
code (77)
compilerz (1)
cooking (31)
dez (7)
dusk (31)
esp32 (4)
extensionz (1)
ffts (3)
forth (3)
free software (4)
games (32)
gloat (2)
globalisation (1)
gnu (4)
graphics (16)
gsoc (4)
hacking (459)
haiku (2)
horticulture (10)
house (23)
hsa (6)
humour (7)
imagez (28)
java (231)
java ee (3)
javafx (49)
jjmpeg (81)
junk (3)
kobo (15)
libeze (7)
linux (5)
mediaz (27)
ml (15)
nativez (10)
opencl (120)
os (17)
panamaz (5)
parallella (97)
pdfz (8)
philosophy (26)
picfx (2)
players (1)
playerz (2)
politics (7)
ps3 (12)
puppybits (17)
rants (137)
readerz (8)
rez (1)
socles (36)
termz (3)
videoz (6)
vulkan (3)
wanki (3)
workshop (3)
zcl (4)
zedzone (26)
Monday, 16 March 2015, 08:52

metaprogramming make

I spent the last few days mucking about with writing some in-depth cookbook articles on using make to build java projects but only just came across this cool series of articles about metaprogramming make today. I haven't read it all yet but i wish i'd known about using $(info ) earlier.

As a quick preview the following is a roughly minimal example of the sort of GNU Makefile i've got working:

JAVA_PROGRAMS = thing

thing_JAVA_DIRS=src
thing_JAVAC_LIBS=lib/library-0.jar     # compile-time
thing_JAR_LIBS=lib/library-0.jar       # run-time & added to manifest
thing_MANIFEST=thing-manifest          # sets entry point or other

DIST_VERSION=-0.0
DIST_NAME=thing
DIST_EXTRA=Makefile java.make COPYING

include java.make

This provides jar, sources, javadoc, package (binary with bundled libs, source + doc jars), and dist targets automatically. All build stages go into 'build' and all final outputs go into 'bin'.

java.make is only about 100 lines of make code, mostly a template for all the targets.

I've also started on a junit.make which does some basic junit stuff but I don't really know much about using that and running it outside of some 'mega-tool' doesn't seem very common.

Tagged hacking, java.
Friday, 13 March 2015, 02:55

ahh shit, google code is being scrapped

Joy. I guess it's not making google enough money.

I'll make a copy of all my projects and then delete them. Probably sooner rather than later (probably immediately because i'd rather get it out of the way, i have a script going now). I'm keeping all the commit history for now although i never find it particularly useful. Links in old posts may break.

Some of them may or may not appear later somewhere else, or they may just sit on my hdd until i forget about them and delete them by accident or otherwise.

Wherever they end end up though it wont be in one of the other commercial services because i'm not interested in doing this again.

I need to do the same to this blog, ... but that can wait.

Update: So ... it seems someone did notice. Don't worry i've got a full backup of everything. In part I was pissed off with google and in part I wanted to make it immediately obvious it was going away to see if anyone actually noticed. Who could know from the years of feedback i've never received.

If you are interested in particular projects then add a comment about them anywhere on this blog. All comments are moderated so they wont appear till i let them through but there is no need to post more than once (i'll delete any nonsense or spam unless it makes you look like a bit of a wanker). I will see about enabling anonymous comments for the moment if they are not already on. I can then decide what to do depending on the interest.

I will not be using github or sourceforge nor the like.

In a follow-up post i'll see where i'm going with them as well as pondering the future location and shape of the blog itself. I've already written some stuff to take the blogger atom stuff, strip out the posts, download images, and fix the urls.

(in resp to Peter below) I knew the writing was on the wall when google code removed binary hosting: it's kinda useless for it's purpose without it. This is why all my new projects subsequent to that date are hosted differently.

Tagged android, beagle, code, dusk, games, gloat, hacking, imagez, jjmpeg, mediaz, pdfz, puppybits, readerz, socles.
Thursday, 12 March 2015, 03:13

glNext/Vulkan/SPIR/stuff

Decided it was time i had a look into 'the state of things' wrt these new apis. I've not been keeping up with OpenCL of late either so I guess I should refresh on that (oh that's right, c++ kernels, well fuck that shit).

Vulkan definitely looks interesting. I mean vulkan looks like a huge amount of boilerplate from what little is available so far (the GDC 2015 slides from khronos) but it all makes plenty of sense. Pity it's still work in progress so all I can do is read about snippets. One hopes JavaFX will use it as a backend in the future though, and maybe i'll do a ZVK to compliment ZCL myself (it's good way to learn about an api).

There's a bizarre thread on the khronos forums where one poster wants to scare away beginner programmers from Vulkan least they get confused by such wild concepts as memory allocation and asynchronous synchronisation. That's ... well that's just wrong. All that information hiding in OpenGL is what makes it such a pain to understand beyond trivial cases, particularly since fixed pipeline went away. If people are using C (as they must to use it) then malloc is hardly an insurmountable barrier. And asynchronous sync is the only technique which makes multi-threading code manageable and really should be the main technique for MT code taught in any software engineering course. To be honest I think it's all that learning about critical sections and mutexes which do all the damage and make multi-threading seem so complicated and they should be something unlearnt as quickly as possible (as a general MT sync technique that is, obviously they are needed if only to implement more useful primitives like queues and barriers).

Anyway we know how it will play out for beginners and learning professionals alike: we'll all just use google to find the first example of the boilerplate that compiles and then keep using that for years. If I was khronos I'd make sure it's their up to date examples and documentation that using google finds and not some shitty agglomeration site full of out-dated shit.

SPIR-V

SPIR looks a little "odd" to me at first glance, but i'm not a compiler writer so it probably should. To my mind i would describe it (a bit) like assembly language that has been pre-processed and annotated ready for an optimising compiler and then it's internal object representation flattened into a flat global space referenced by index. Rather than registers or addresses results are referenced by the instruction that produces them. It should make a frontend compiler fairly simple as the compiler doesn't need to deal with registers or stacks, and it makes a backend a bit simpler as some of the work is already done. And apparently it's not a file format, although it sure looks like one and i can't imagine it would make sense to anyone to create a different one to store the same information.

I wonder what this mean for HSA (or infact, any other compiler system using it's own virtual processor)? I've not looked into it so maybe something is already announced but if not i suspect SPIR is in it's future too. BRIG takes quite a different approach in that a specific register-based virtual machine is targeted and it's up to the frontend compiler to perform register optimisation and the backend isn't (supposed to be) much more than a machine code translator (which is still strictly speaking, a compiler). I just can't see hardware vendors keeping both maintained.

Oh my gods, it's full of compilers ...

One realisation I had when playing with the soft-GPU code on the parallella was that modern GPU drivers are mostly just compilers with a bit of memory and queue management bolted on the side. And similarly that modern GPUs are really just moderately wide vector CPUs with a little bit logic for fragment generation and texture lookup. of HSA itself is more about compiler writers than the end-user too.

It's just a bit of a personal bummer because although compilers are a bit interesting they're not enough interesting to me to spend the years required to get up to speed.

Tagged hacking.
Tuesday, 10 March 2015, 10:55

dun dit dun

Following on from the last post I did some i/o sutff - went with an s-expression based thing since it's a trivial parser and easy to use - then I rewrote the whole model and some of the ui again. Added zoom for instance. Then I played with it for a while but couldn't manage to create the sort of sounds I was trying to create. I couldn't find modules that did what I wanted to do and trying to construct them from primitives got messy and didn't work either.

I was starting to lose interest.

So then I wrote a whole new synthesiser from scratch followed by enough of a midi sequencer to get a midi of Lazy Jones working - and I think it sounded better than the bundled Java midi synthesiser (more hard/harsh just like the original). It uses a thread to render a frame of samples at a time based on a master clock and uses a simple 'runLater()' style mechanism to synchronise parameter updates on the various components so threading issues are just hidden.

I tried a few other files and none worked either at all or very well but after another day of hacking I've got fully polyphonic voices and adsr envelopes and so on and so forth. Most midi files apart from Lazy Jones still sound kinda shit because I don't have any real instruments or the midi processing units (and well, it's midi), but they do play with the right timing and tone (I think, hard to know since midi files usually sound a bit out to me). For efficiency I created a multi channel oscillator and envelope bank which works pretty well but limits the instruments to simple waveform + ADSR envelope.

Most of it was pretty straightforward considering i just did it off the top of my head but I found I had to do some filtering on the amplitude changes to avoid pops when using a sooth waveform. One problem I have is that square and sawtooth are just so much louder than triangle; some filtering seems to help but I guess that's just the way it is and it's up to the musician to compensate.

Probably wont get much farther than that but it was a fun few days. It can be made an interesting real-time problem and parts are paralellisable so if I was keen i'd probably try some epiphany code but i don't think i'm that keen and it's fairly light cpu wise anyway.

I guess I forgot about the space invaders sfx. If the latency is acceptable i might try just using my synthesiser as a real-time sound mechanism, maybe maybe.

Tagged games, hacking, java.
Friday, 06 March 2015, 10:18

Interactive synthesiser

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.

Tagged games, hacking, java, javafx.
Thursday, 05 March 2015, 00:50

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).

Tagged games, hacking, java, javafx.
Tuesday, 03 March 2015, 10:00

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.

Tagged games, hacking, javafx.
Friday, 20 February 2015, 07:18

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.

Tagged biographical.
Newer Posts | Older Posts
Copyright (C) 2019 Michael Zucchi, All Rights Reserved. Powered by gcc & me!