Skip to content

Tag Archives: haskell

Preview
Image
This is my entry to the Bricolage Pageant.

Blendings

Windows version
.t3 version

If you’re using Linux or a Mac, download the .t3 version. Unzip the file and run it with an interpreter from this page (such as spatterlight).

source code (TADS 3 + Haskell)

Preview
Image
I have quadtree and octree-based stuff up and running; I'll post 'em some time in the near future.

1D tessellation in haskell

This is what the game I posted a couple of days ago, Endless Cavern, was essentially based around.

The haskell code is simple (not awfully efficient, but that’s not a concern just yet), and I’ve tossed it here (32kb). You can control the prototype by pressing left/right on the keyboard.

Endless Cavern

Strange well in Arkham country—water gives out (or was never struck —hole kept tightly covered by a stone ever since dug)—no bottom—shunned and feared—what lay beneath (either unholy temple or other very ancient thing, or great cave-world).

An entry for the TIGsource Commonplace Book competition.

DOWNLOAD:

Windows (1MB)
Mac OSX 10.5 (2MB)
Source (4MB)

Continue reading ›

Preview
Image
Tigsource articles, that will appear here anyway, can be found here, if you can't wait for me to copy and paste them on here.

GTTM-based Chord Progression Generator

I’ll be posting some articles about the theory of Lerdahl very very soon. In anticipation of them (and to put something up so I can submit it to the Haskell Activity Report), here’s my implementation of a toy-model based roughly around his theory. It’s restricted to the process of chord generation.

Here‘s a simple playing by me of a chord-sequence that it produced. Here‘s a midi example that it produced by itself when I had it more developed.

There’s still a reasonable amount of work to be done on it, but it’s at a stage where it’s presentable.

Anyway, the current version of the haskell source code is here. Hopefully I’ll have more developed versions up in the future.

Preview
Image
hopefully this won't be my last toying about with Graphics.Rendering.OpenGL

lightcone: prototype 2

I decided to try doing a one-player prototype of this game, and to do it in haskell this time as an exercise instead of C++. It’s a much more bare-bones things, but might be of interest to some people (requires OpenGL and GLUT to be installed).

In this demo, you are a red or blue block, the enemies are red blocks, moving in various patterns. When you overlap with an enemy block, your colour changes.

I’m not bothering with a binary distribution, but the source is here.

Preview
Image
I even managed to do something useful with this sort of code, that I'll post some time in the near future.

Basic Haskell Midi file output

I thought it would be an unpleasant task, but it turned out it to be an entirely lovely task to deal with haskell and MIDI files directly (without having to deal with the current work-in-progress that is haskore).

The source file is here. To produce a major scale in ghci, do something like the following:


:l miditest
createMidi "test.mid" [50,52,54,55,57,59,61,62]

I even managed to do something useful with this sort of code, that I’ll post some time in the near future.

Preview
Image
Hmm. Pity there isn't any proper measure of consonance, Euler :/

Consonance-preserving maps.

Grrr. Baaad program. But I’m putting it up anyway, because it’s not *that* bad.

Basically, say we had a scale, and a gradus suavitatus on that, a measure of consonance, so that given any two intervals, you can say if one is more consonant than the other. Now given two scales, it might be a worthwhile thing to look for things that preserve relative consonance; that is to say, a function f from one scale to another will have to satisfy the rule a>b => f(a)>f(b).

So, I wrote a program to do it. No interface yet, it’s to be run from within ghci; specific details of how to use it are given (in a very rambling sort of way) at the top of the source code. It seemed like it might be most useful in looking for interesting transformations of melodic motives that have a small number of notes. However, I can’t say I have been able to do anything useful with it, alas.

For an example of the program’s output, see this file:

Harmony-preserving maps example ( ps | pdf ).

For the code itself, here’s the source file:

Harmony Preserving Maps Generator V0.1 ( hs )

So yeah. Out.

Preview
Image
It was a pleasant experience, writing this program.

Counterpoint Analysis Program

Counterpoint Analysis Program

V0.1 as of June 01 2007

So, this is a program that, when you input various melodies, will attempt to find contrapuntal relationships between them. I use something like a slightly weakened version of the 1st species counterpoint rules of Fuchs for this. As you may guess from the version number, this program is chiefly for my own use. However, I think it’s usable enough that it’s conceivable that other people might also use it. Oh, disclaimer: it doesn’t always (or even mostly) give great counterpoint examples, but that wasn’t so much the motivation; I wrote it because I’m never sure when writing fugues that I’m not missing some particular combination of themes that sounds especially nice; with this, I get straight away a bunch of combinations to play about with; many which I wouldn’t have seen without it I think (of course, I won’t limit myself to what this program outputs, but it’s a very good starting point I think), this makes it useful as a compositional tool for me.

No, no no, don’t expect any pictures (yet); it’s a console program (so far), so! And please, if you’ve anything to say about it, don’t hesitate to say it, either here or via email – I’m unlikely to do any work on it otherwise (as it fulfils my personal needs rather well in its current form).

Download Zip – Contains windows binaries, basic documentation, and Haskell source (should you wish to recompile it on a different platform).

Worked Example