Check this out: MyTrigger

My friend Erik has not yet
mentioned this on his blog, but I
feel I need to tell the world about his latest project, MyTrigger. Basically, it’s a small app that lives in your system tray and waits for various system events (WLAN changes, USB device insertions, processes starting), and then executes programs or scripts in response.

For example, you can use it to mount/unmount network shares whenever you entter or exit a WLAN, start your webcam software whenever you plug in your USB webcam, or bring up a notification whenever a background process starts.

After having the 1.0 version for a week, he has now brought forth
1.1, which adds triggering on file system changes, such as when a file
changes or a file is removed from a directory. This stuff can be used
as electronic duct tape for a lot of scenarios.

Hardware sucks, part 2

A month ago the hard disk in my home desktop computer crashed. Yesterday, the hard disk in my laptop crashed. I’ve been using computers with hard disks for at least 15 years, and before last month, I had never had a actual, physical hard disk crash on any of my personal machines (I’ve had drives wiped out for various other reasons, but the actual drives were always usable). Is this the start of a bad trend? Having hard disk prices below 1$/GB isn’t all that great if the disks have the life expectancy of a Microdrive.

Well, all the important stuff is backed up elsewhere, and I only lost some blog subscriptions added in the last few weeks. Still, I should try to start using Unison again (I stopped using it when I retired my Linux machine, which acted as server storage area) — it’s a great way to keep all one’s important files (in my case, almost everything under %USERPROFILE%) in sync between machines. Use it to sync your work and home computer, and you have automatic offsite backup.

Trying out RSSBandit

When i first got into this RSS aggregator game, FeedReader was pretty much the only (free) game in town. When Syndirella came out, I quickly switched to that, then to SharpReader, and now I’m trying out RSSBandit. I was mostly satisfied with SharpReader, but I wanted to try out the ”Special Feeds” feature (basically, you can flag blog postings for later perusal), which ought to be useful when reading posts and thinking ”hey, I might want to blog about this at a later point”. Also, being able to synchronize the state of RSSBandit instances on different machines seems useful (but I haven’t tried it yet). All in all, mad respect to Dare (who, like me, uses dasBlog).

However, it seems that RSSBandit has inherited my pet peeve with SharpReader in that, while reading, the Space key will sometimes sometimes scroll down the current blog posting pane, and sometime move to the next unread item. This seem to depend on which pane the focus is, and possibly on wheter the currently selected item has been read previously.

I want Space to always, ALWAYS, scroll down in the current blog posting pane, unless that pane is already at the bottom. Right now I often run into the following scenario: I’m reading a blog post that’s to large to fit in the pane, and i press Space to read the rest of it. But for some reason the focus was in the wrong pane, and RSSBandit moves to the next posting, which often is in a different RSS feed, making it difficult to navigate back (I have to remember which feed I was just reading, as well as marking the new selected blog post unread).

I also miss SharpReader’s feature of right-clicking a blog posting title and selecting ”Open in new window”. However, since RSSBandit is open source, there’s a theoretical chance that I might fix this, and the above problem, myself 🙂

Update: Unlike SharpReader, RSSBandit exits when I press Alt+F4, but not when I click the right-corner ”X”. I think Alt-F4 and right-corner-”X” should have the same behaviour. The good news is that RSSBandit restarts faster than SharpReader 🙂

Making music on a computer, from a programmers perspective

I spent most of yesterday’s evening setting up Cubase SE after my harddrive crash. I went through all free CD’s that I got with the issues of swedish computer music magazine Studio and discovered a bunch of interesting virtual effects and instruments.

A little background in how modern versions of Cubase (or indeed most any sequencer program works): The program mimics a analog multi-track recorder, to which you can record analouge sound sources (in my cases an electric guitar and an electric bass — soon, vocals as well). There’s nothing magical about the way the audio is recorded — basically they just end up as high-resolution WAV files on your harddrive.

In addition, you can record or program MIDI as well. A midi file is essentially a bunch of messages arranged on a time scale, the most important being Note on (that has some parameters, like pitch and velocity) and Note off. MIDI is about 20 years old as a standard now, but it’s surprisingly versatile in a computer recording environment.

In the old way of doing things (like 5 or 10 years ago), these MIDI messages were sent to an external unit of some kind — a synthesized/sampler/workstation/sound module or some other box outside of the computer that made some kind of sound, that was then recorded more or less like an analouge source (like a electric guitar). Nowadays, it’s feasible to simulate all kinds of sound-generating boxes inside of the sequencer program in form of plugins. In Cubase lingo, such a plugin is called a Virtual instrument, or VSTi (Virtual Studio Technology instrument), and it’s essentially a multithreaded win32 dynamically loaded library, compatible with C++ calling conventions. When writing a VSTi, you inherit from a base C++ class and override a bunch of methods. Basically, one method that the host application calls to notify you that there is a incoming MIDI message, and another that the host application calls to find out how the instrument sounds. Your plugin renders the sound, based on incoming MIDI data, in the form of an array of doubles that represent the sound (typically 44100 doubles each second) — essentially PCM samples.

Now, MIDI messages can be more than just Note on and note off. There’s a whole class of messages that are used for parametrizing various aspects of a electronic instruments sound generation — things like changing the cutoff frequency or the resonance. If you’ve ever twiddled on a Roland TR303 or it’s virtual cousin Rebirth you know the kind of things that can be tweaked, and what kind of sounds can come as a result. Each VSTi can choose if and how to map these messages to some form of internal state.

There are some additional methods that are used for the host application to query and set the state of the instrument (for things like changing the sound preset, or manipulating parameters that can’t be changed by MIDI messages), but essentially that’s the entire interface — it’s less than 10 methods, most with very very simple signatures. But that’s enough for building an amazing amount of virtual instruments — every known technique for generating sound (playing samples, frequency modulation, simulating analog circuits, and so on) has been encapsulated in the form of VSTi’s. I used to play with hardware synthesizers and ”music workstations” back in the day, and it’s so much more flexible and downright fun to work with virtual instruments.

There is a similar (and older) API for writing effect plugins, like reverb and delay — override some methods, recieve a bunch of floats and tweak them to produce the sound you want — enabling you to virtualize a bunch of effect boxes, and even simulate complex things like the sound of a Marshall tube amplifier playing through a 4×12 speaker.

My favorites so far:

  • sfz – a soundfont player. A soundfont is basically a bunch of audio samples with some metadata that tells which samples that corresponds to what notes and velocity ranges. This is a common format for free sample collections.
  • crystal – a polyphonic synthesizer with really good presets
  • creakbox – sounds like a Roland TR303, including all the knobs to tweak.
  • Lallapallooza lite – great for more noisy sounds
  • Little green amp II – a guitar amplifier simulator

Fiddler – a HTTP debug proxy

I saw this on Scott Water’s blog: A HTTP debugging proxy called Fiddler, that sets itself up as a default system proxy and enables you to see every little detail about every request sent and response recieved to your computer, as well as intercept requests/responses and ”fiddle” with them. Great for troubleshooting and a bunch of other stuff as well. I’ve been holding on to a copy of Steve Genusa‘s TelHTTP to be able to inspect headers and similar stuff from random webservers, but this does all that TelHTTP ever did, and so much more.

Works with IE, and Mozilla too, if you configure it to use localhost:8888 as it’s proxy.

New toy: CassiniEx

A while ago, Microsoft released a small webserver called Cassini,
aimed at only hosting ASP.NET, for the developer who didn’t want to/could install
IIS, under their ”Shared
source
” license. Michael J. Carter took the code and added
a bunch of features
that makes it a realistic alternative to IIS in some scenarios.
In particular, it supports multiple virtual hosts, something that I’ve had
problems with
, using IIS 5.0 under W2K, so I’m going to take a look at it and
see if it works as a replacement.

It’s interesting to note that good things do
come out of the shared source releases that Microsoft has done so far, even though
the license has been throughly
blasted
in the more zealous parts of the open-source world. In particular, this
document
states ” All versions of `shared source’ deny
you the right to redistribute the code or share it with third parties”
. However,
Michael is redistributing the source for CassiniEx, so either he’s in trouble or OSI
is wrong.

Update: Now I’ve downloaded the original Cassini source code and viewed the
license
, and I cannot find anything that denies anyone from redistributing the
source or derivatives of it. In fact, point 3 states:

[We simply require that you agree]: That if you distribute the Software
in source code form you do so only under this license (i.e. you must include a complete
copy of this license with your distribution), and if you distribute the Software solely
in object form you only do so under a license that complies with this license.

Doesn’t seem more restrictive than the GPL to me. Could someone fill me in with what
I’m missing?