Archive

Posts Tagged ‘engine’

A crazy idea

March 4th, 2010 1 comment

As I cycled to work this morning, I had a crazy idea. It’s just daydreaming and will probably never happen, but it’s fun to think about. I’ve already posted this idea to the linux-audio-user mailing list in case anyone there has any insights on synthesising/sampling engine sounds.

I want to measure how fast I’m turning the pedals on my bike (the cadence) and synthesize/sample the sound of an internal combustion engine.

As far as I can work out, there are three major parts to this.

1. A sensor that can measure my cadence. A simple magnet switch that triggers once a revolution won’t be enough to measure the cadence with sufficient resolution, since my cadence is usually between 50 and 80 rpm, and I will need to sample more than once a second. I would probably need to mount multiple magnets spaced equally around the chainwheel and have a single sensor on the frame. Then I have to get it to supply this information to my control program.

2. I need a control program that can read in the input from my cadence sensor and convert a cadence reading of “66 rpm” into a frequency that should be sampled/synthesised, e.g. “500 Hz” (I’m making these numbers up). It will also need to be able to somehow smooth out the readings, perhaps by interpolation, so when I accelerate, the sound of the revs climbing doesn’t increase in obvious steps. It could also have other logic, e.g. when my cadence is 0 rpm, the sound of the engine is idling rather than off.

3. I need a synthesiser or sampler that can take an input from my control program and make the sound of an engine (or more likely, a sine wave to start with). I’ve never sampled or synthesised on a computer before but this engine-specific sampling technology already exists in video games, such as torcs.

I have absolutely no idea why I would want such a device – just for the fun of building it, I guess. I would like it to work in realtime (rather than later generating the soundtrack from recorded cadence data). The thought of sitting at the traffic lights with my earphones in and then hearing the mighty roar of a V8 as I pull away would be really satisfying…

Any thoughts – useful, interesting, humorous, or otherwise – are welcome!

Federated tables in MySQL

September 10th, 2009 7 comments

Yesterday at work I had the need to create a federated table in MySQL. I read about the federated engine and thought I had it sussed. I noted:

Beginning with MySQL 5.1.26, the FEDERATED storage engine is not enabled by default in the running server; to enable FEDERATED, you must start the MySQL server binary using the --federated option.

Turns out it’s also possible simply to add the line federated in the [mysqld] section of /etc/my.cnf

The version of MySQL currently installed on my CentOS box was an older one (5.0.45) but I added this line anyway. The server refused to start. It quickly became clear that the MySQL binary packaged with CentOS was not compiled with the federated engine.

Fedora is currently packaging MySQL 5.1.37 but it seems that this too is lacking the federated engine. That’s annoying – I had wanted to install a version of MySQL from some yum repo or other, so I don’t have to keep upgrading the package every time a new version is released.

Perhaps the lack of federated support is a Red Hat (and derivatives) issue. I downloaded the rpm from MySQL directly, and installed it. Guess what – no federated engine compiled in.

So I downloaded the source tarball. I explicitly configured it with the federated engine, like so:

./configure --with-plugins=federated

And then I built and installed it. Nothing worked properly out of the box, and I was annoyed to find that the make install command doesn’t do half of the things I would normally expect it to do. I found this information and followed the steps to get it working. I had to steal and tweak the /etc/init.d/mysqld script from a different box which was running the bog-standard CentOS package.

Woohoo! The federated engine was finally available.

mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | YES     | Federated MySQL storage engine                                 | NO           | NO   | NO         |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.00 sec)

But I can’t understand why none of the binary builds of MySQL include it. Fair enough that isn’t enabled by default in the running server – it’s no problem to add a line to my.cnf on a standard CentOS box. But it is a nuisance to have to build from source. It doesn’t break anything to have it enabled in a build, even if unused.

Of course CentOS won’t change the way they build their packages until Red Hat does. So I’m doing what I can, and I have filed a feature request with Fedora in the hope that in the next major release, there will be a version of MySQL built with the federated engine.

Categories: Fedora, Linux Tags: , , , , ,