Mc2 Progress #4
The time comes to stop mucking around with software and start building the hardware. I'm no where near as good with the hardware things. Software is easy and fine... so how much did I break it? Turns out a fair bit. Lets take a look.

First I started with an Inkscape file that described all the positions of the components and specifically the places where I have to drill or cut. I printed it out in A3 and glued it down to the top surface of the chassis.

I started drilling out the holes and all the switch / neopixel holes went fine. Then came the LED rings and the paper started tearing everywhere.

So I left the LED ring holes for a while and worked on the screen rectangle. I bought this tool called a "nibbler" to cut the hole. You drill a hole in the area to be removed, and insert the nibbler into the hole and start cutting. It can cut in a curve so I used that to align to the border.

Then I came back and finished all the LED ring holes. However my accuracy was terrible and I don't feel all those holes are good enough.

I've decided that this chassis is a bit of a write off. I have since gone and bought a new chassis (they are about $60 AUD inc shipping so not too bad). And now I'm looking for someone that can do CNC drilling.

Moving on I tried test mounting some of the components, starting with the screen and Pi.

Seems to fit quite nicely. So I tried to bend the holes in to accommodate the countersunk machine screws that I had bought. That bent the metal around the hole too much and deformed the chassis around the screen area. In hind sight I should've used a large drill bit instead of mechanical force. So because of the deformations in the metal when I tightened up the screws around the screen I heard a faint cracking sound. Yup I broke the screen just a little.

That's just fantastic! :( Another thing I have to re-order. Similar price too... bah. There is some good news thought... the screen still works:

Although I haven't had a chance to test the touch screen part.

The PCBs and Neopixels need to be mounted behind the front of the chassis, so I went and bought some rectangles of 3mm perspex:

The switches go through the perspex and keep it in place. I've started soldering some 3 wire ribbon cable between the Neopixels, not shown in this photo. It's slow and tedious work :( And the various glue electronics to interface the Pi with the buttons, encoders, expression pedal ports and neopixels is all mounted to that as well.

Tags: mc2 | (0) Comments | Add Comment

Why are my videos encoding at a snails pace?
I'm currently rendering out composites for a music video and it's crawling along. Vegas is taking 40+ minutes for a 8 minute 1080p video? That doesn't sound right. My CPU is a i5-3570K and the machine has 16GiB of RAM (5 in use right now). So I started looking at the CPU to see if it's running OK. First stop CPU-Z:

2ghz? What? Where is my 3.8ghz the CPU is capable of? Hmpf. Well better check the temps then.

Oh... oh dear. Well... I er... guess I need to replace that stock cooler then huh. Off the shops, will update with results.

Edit: So I cleaned out the fan, it was clogged with dust. Reapplied thermal grease and reinstalled the heatsink/fan. I think it might've come loose and not have been making proper contact with the CPU?

In any case:

At least now I'm getting decent speed. The render time is down to 21 minutes or so. I wonder if I can overclock with a decent cooler?

Tags: hardware | (0) Comments | Add Comment

MC2 Progress #3
The last week or so has been spent a twisty maze of fonts, colour spaces, CPU endianess and cross platform C++. Anyway I won't regail you with all the fun I've had but I will show you some screenshots.

Firstly because I have RGB LEDs for each Instant Access switch, I need a way for the user to select a colour:

It remains to be seen how easy it is to use on the real hardware. But colour selection works either by hitting one of the palette entries or pushing the Red, Green and Blue sliders around.

Also for entering details like the CC number and other textual information I probably need a touch screen keyboard:

This is roughly copied off my Android phone's touch keyboard. Without Swype unfortunately ;)

The screen to select a scene change for an IA button:

And the page where the user picks an Axefx block:

Tags: mc2 | (0) Comments | Add Comment

MC2 Progress #2
This week I've been working on the screen layouts. A fair bit of mucking around with CSS and resource file formats was required to get it all working but here is what it looks like now:

Working from the hand drawn ideas I had last week I'm mocking all the dialogs up in the graphical editor:

Also in the mean time I'm working out if I can hide the boot time of the Raspberry Pi behind a custom splash screen. A static image is easily doable but something with a progress spinner might be a bit tricky.

Tags: mc2 | (0) Comments | Add Comment

Removing Suggested Tiles from Firefox New Tab Page
So in recent builds of Firefox new tabs have collected "suggested" site tiles. Now being marketed to and having my meta-data sold to the highest bidder is why I moved back to Firefox from Chrome about a year ago, so the appearance of "marketing" in Firefox's UI is quite concerning.

Of course you probably want to know how to turn those suggested site tiles off right? Well see that little gear icon in the top right hand corner:

Unselect the "Include suggested sites" and you're good.

Tags: firefox | (0) Comments | Add Comment

MC2 Build
So the other day I was at rehearsal and the MC1 that built started to have some issues with the External control knobs (along the top). They were jumping all over the place and making it annoying to use. I did get around to pulling all the circuitry around those pots off and doing it properly later. But it occurred to me that I'm using gear that I have no backup for. There is no 2nd controller to swap out if this one dies at a gig.
And because I'd rather custom build one out of parts I [mostly] have lying around that means building the MC2.
For starters the MC1 uses a tiny micro-controller with no USB or network or any modern connectivity at all. I have an old XP computer JUST to reflash the damn thing (needs a REAL parallel port). For any new system I wanted an easy way to do software development and ethernet/USB connectivity. And because I had a Raspberry Pi already I settled on that as a platform to run everything. I already had a little touchscreen to go with it and some RGB led rings with encoders that I built for a different project that I never got around to. So with all those parts just lying around I got to making some bits to glue it all together. Here's a family photo:

1) The Raspberry Pi. This is the "old" B rev 2 version... which has the slower processor.
2) The touchscreen. This interfaces with the SDL api using the Linux framebuffer. Touch events show up as mouse clicks. It's all quite straight forward to be honest. The only gotcha is you HAVE to set the video mode back to text if you crash... otherwise you're stuck in video mode without a working console.
3) LED rings + encoders: These I built for someone else but was too slack to finish that project. They basically are an extension of the Mayhew LED ring except that I'm running Red/Green/Blue LEDs instead of just one colour. It also is designed to fit in a 1U rack box, so they are nice and compact. I'll have 3 pairs of these across the top of the box, giving me 6 independent continuous controllers. Just like the old MC1 box, but importantly I'll be able to update their "position" using software when the preset changes.
4) Neopixel chain: Each foot switch on the controller will have an associated LED. I settled on the Neopixels because they wouldn't require a lot of support circuitry and there is now a software library to make them work on the Raspberry Pi. Which I've used successfully on a bread board.
5) MIDI in and out ports. This is a direct implementation of the circuit used in the MC1. All I really have to do is connect it up to the Raspberry Pi's UART pins and then program the right frequency. *fingers crossed*
6) This is a bunch of extra GPIO (general purpose input/output) for connecting the foot switches and encoders up to. It runs on the I2C bus from the Pi so it's easy to chain lots of things and address them in software. (I love software solutions).
7) Some analog inputs for the expression pedals. I'll be able to have up to 4 connected at once.
8) This is the break out board for the expression pedals. It connects to (7) via a 4 wire bus and basically sets up the right voltages for the 3 pins on the socket. It allows me to detect when the pedal is connected and disconnected by limiting the valid ranges of input voltage when the pedal is connected to less than 0-3.3v...
That's an overview of the hardware side. But what about the software? Well I already have a lot of cross platform C++ code that will come in handy. Firstly I have written a library called LGI that allows the same code to run on Windows, Mac and Linux without much changes. So why not extend that to SDL on the Raspberry Pi? So that's what I did this month. Which gives me access to a whole bunch of little controls like, edit boxes, check boxes, labels, buttons, table layout controls, graphical design tools etc. Stuff I've already written.
But I still needed to work out the general look and feel of the user interface. Check it out:

Basically I'm drafting up the flow of buttons and the layout of the controls to get a feel for what I need to write in the software. I have this control that does layout for me, kinda like a HTML table in that it works out the spacing of everything based on the size of the content. And I can style all the controls with CSS which will make for a nice consistent look over the product.
I expect though it'll be some months before I get this all working. Only a few parts of this are tested and none of it has been integrated into a working system. I'll try and post updates when I can.

Tags: mc2 | (1) Comment | Add Comment

It's been a fantastic week at Memecode headquarters...
I bought a cheap new Win8.1 tablet. Which was amazing for about 24 hours until I decided that I didn't want the 5gb restore partition and tried to remove it and resize the C: to fill the available space. Yeah that didn't go so well and I think I've bricked it.

To add insult to injury my main Windows 7 install on the desktop PC died tonight. It boots to a blank black screen. Safe mode hangs with lots of disk activity. It got stuck on the Paragon HFS+ driver, so I booted into Mac and removed that (copied elsewhere). And I'm trying to fix the disks one at a time with Disk Manager. Currently it's in some sort of infinite loop verifying my Win7 NTFS partition. Sigh.

Seems like all my PCs hate me at the moment.

One thing to be happy about is the fixes to HTML table layout I implemented today. There were some bugs related to table layout for spanned cells that have non-dynamic width specifications that are larger than the available space. And also an off by one error in the block element flow code. Slowly that HTML control is getting quite solid.

Tags: windows | (1) Comment | Add Comment

SourceForge to Github Migration
You may or may not already be aware of this but SourceForge has started taking control of popular apps that have abandoned their SourceForge project and moved elsewhere for the purpose of injecting adware into the installer for said products. The Gimp and nmap are some high profile examples.

This of course goes directly against my principles. And I can't in good conscience continue to use SourceForge to host any of my Open Source apps or libraries. So as of today Lgi, i.Ftp, i.Mage and i.Hex are all hosted on Github.

I need some experience using git anyway.

My main concern is that I can't actually delete the projects on SourceForge, and they may decide to take them over and zombify them in the same manner as the Gimp. There is very little I can do about that unfortunately. Personally I will consider SourceForge as a point of last resort when getting software.

Tags: open-source | (0) Comments | Add Comment

Supporting Work
It seems that a few things have gradually become a problem. Firstly customers with accents in their name are getting bad key's generated off the InScribe purchase page that they land on after buying the software. This is caused by less than stella coding on my part. But something that I'm trying to fix. The issue is that the data coming from PayPal is URL encoded and is in an unknown Charset. I've implemented some PHP in the purchase page to find the charset in the headers and do all the conversion for the $name. However in trying to test it I ran into a fairly annoying PayPal sand box bug.

The PayPal Sand Box Bug

If you go to create a new test user with an accent in their name you'll get a field validation error along the lines of "Only use letters". Which makes it hard to test purchase scripts with non-latin characters in the buyers name. I did however find a way around this, and that is to use the bulk upload tool to create the users. You can download a .tsv template direct from the PayPal sand box site on the "Create New User" page. From that fill out the details, and supply whatever name you want. Because the file is saved in unicode it bypasses the broken field validation stuff. Then upload that and you got a test user with accents. (Haven't tried Asian characters yet, but I will at some point). My new problem is that even after doing that and putting a sandbox button on my site the purchase script gets an empty response from PayPal when it checks the transaction. Fun times.

The Installer/Uninstaller

Everyone knows that the official way to uninstall a Windows application is to use the Control Panel uninstall page. It had completely escaped my attention until now that Scribe provides no such uninstaller entry in that list (Thank you dear user for reminding me). So I've gone and added the right registry entries to list the uninstaller, with help / support links, and the current version. The version is read straight from the .exe during installer compile time so it's always correct. Also the installer has been refactored to have a Desktop/Portable switch baked right in. Huzzah.

The Help

Also the help files shipping with Scribe have drifted from reality. So I'm in the process of reading through everything and updated all the parts that aren't correct anymore. Some areas might need fleshing out as well.

OAUTH2 Support

An initial draft implementation of OAUTH2 support for Gmail IMAP was shipped in the most recent build of Scribe. I'm quite keen to get feedback about it. So if you have tried to get it working and either succeeded or failed. Let me know.

Tags: scribe | (3) Comments | Add Comment

Stabilizing GH3 Video For Sony Vegas
I have a GH3 camera that takes pretty nice video. Because I cheaped out and got a non-Panasonic prime for the lens, I don't have in lens stabilization. What I do have is a bunch of footage that needs stabilization so I've been looking around for software based solutions.

The first (free) one I heard about was Blender and it's point tracking. After downloading that and playing around with it I found it very limited in what footage it can work with. As soon as you pan or zoom it becomes very difficult to keep the footage zooming and panned correctly. There are scripts to help but because it's not core functionality it just gets complicated fast.

Then I heard about Deshaker, which primarily runs as a plugin for VirtualDub. A tool which I haven't used in a very long time. So I downloaded both of those and got to work testing it on my footage. Immediately it was obvious that it was vastly better and more powerful that Blender.

The first issue I faced when using VirtualDub was that the input video was .MOV files off the camera. This is the format from ffmpeg:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bec+tanner 038.MOV':
  Duration: 00:09:03.36, start: 0.000000, bitrate: 49552 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 48004 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
And VirtualDub uses .AVI files. Next step is converting the video to an AVI without re-encoding it. And that is best accomplished by my old friend ffmpeg. Which has the ability to convert between compatible containers without loss of quality and time caused by re-encoding the video. My initial attempt failed because the AVI container doesn't support big endian audio (the default off the camera). So I converted that to little endian using this command:
ffmpeg -i "" -vcodec copy -codec:a pcm_s16le "output.avi"
Now I could load my files into VirtualDub and stabilize them. The process basically involved adding 2 instances of the Deshaker plugin to the filter pipeline. The first one is set to "pass 1" and enabled. Disable the 2nd instance. Then go to the start of the video and runing the Output Playback mode. This generates all the motion vectors. Disable the first pass instance of Deshaker and enable the 2nd pass instance. Now you can export the video using your desired compression. I don't like any of the built in compressors so I downloaded the x264 codec and used that.

But the output had a problem. When the camera panned to track people walking, they appeared to jump back and forth in the stabilized output. Very odd looking. So I went frame by frame and noticed that in the source video each pair of frames coming through was the same. Deshaker then would get confused by this and shift the intermediate copy of the frame by more than the new frame. I thought the best way to get around this was to delete these redundant frames from the GH3. Fortunately VirtualDub comes with just such a filter: interpolate

By putting it in front of the Deshaker instances I got nice clean output, free of stuttering. At least as far as it would play in VLC. However when I loaded that into Sony Vegas there was big problems playing the AVI files back. Basically it would drop to a slide show, and on top of that there was corruption in the rendered output. Mulling my options I started looking for a way of getting the video out of VirtualDub without using the AVI container format. Fortunately there is a way. By installing an external encoder, which in my case was more just redirecting output to ffmpeg.

I found that by adding the right external encoder you can call ffmpeg to encoder the video straight from VirtualDub. The process involves writing out a "ffmpeg-1.vdprof" text file with the content from that link. Then importing that into VirtualDub and editing the details a bit. I decided to lower the -crf parameter to 16 to make it pretty much visually lossless. I don't want the stabilization to drop the quality at all.

Now I can bring that footage into Vegas and it plays smooth as butter. But it might have sent a few hairs grey.

Tags: video | (1) Comment | Add Comment

Scribe Gmail Support Update
Google has switched off so called "insecure" authentication methods, including "PLAIN", which Scribe relied on.

Today I got that draft implementation working enough to be able to login to the Gmail IMAP server using OAuth2. It does take you via a detour into your default browser but in the end it works. It's also quite the hack job at this point so I want to clean up the code and make the error handling at least very verbose. I will be making a release in the next few days off the stable branch that includes functional OAuth2 support.

It has been argued that Google's motivation in doing this is to force people onto the web and out of installed desktop / mobile clients, for the purpose of making Gmail's web UI more palatable. I remain unconvinced about this argument in that there seems to be another reason that makes more sense to me. OAuth2 doesn't require the client to store the plain text password. Thus reducing the possible points of failure for security. Most installed clients are bad at storing persistent account credentials in a fully secure fashion. So by removing that attack vector it could be argued that Google is doing App authors a favour.


I still find OAuth2 quite needlessly complicated. And it's very dependent on the client having lots of pre-configured knowledge about the server it's authenticating with. I mean for every service that Scribe will support OAuth2 authentication I have to have a unique ClientID and ClientSecret, as well as the token URI and access URI... none of which are "discoverable" on the fly, but hard coded in. So you can't connect Scribe to some arbitrary new service that supports OAuth2. I have to manually create support each new service. I don't yet understand how that is a reasonable state of affairs.

Tags: scribe oauth2 | (0) Comments | Add Comment

Scribe Gmail Support
So Google have changed the authentication support for Gmail again, breaking the ability for Scribe to log in to any of the Gmail related services. Which means I'm going to have to put aside the v2.1 work temporarily to work on getting one of the support authentication methods working in Scribe.

The options are: I'll try and keep this post updated with progress on that front.

The list of all official SASL mechanisms is here. PLAIN-CLIENTTOKEN is not mentioned at all. I wonder what implements that? Also of note, both XOAUTH and XOAUTH2 are marked "OBSOLETE". Nice one Google, supporting only obsolete, undocumented or non-functional authentication methods.

Tags: scribe | (0) Comments | Add Comment