Abstract guitar model base

Bit of a strange one, with limited appeal i guess, but i thought i’d post it here as i thought it was quite interesting :slight_smile:

Basic guitar model classes + MIDI example: here
PC compiled VST demonstration of Midi model: here

There are three classes here:


This tries to behave like a string on a guitar, taking care of frets, bending, tuning, etc… There are some virtual functions which you override to give a particular response - playNote, playMutedNote, stopNote and stringBent.


This gathers together a bunch of strings and gives you access to them. The virtual function to override here is the createString one to instantiate a GuitarString subclass.


This specialised class is for simulating strumming. There’s an axis of movement (a double between 0.0 and 1.0). You set the position along the axis, and the system calculates which objects on the axis lie between the last position and the new one. Override getPositionOfObject to tell it how to find where objects lie (and getNumObjects so it knows how many there are), and strumObject to define what will happen when an object is passed. handleVelocity also lets you define a behaviour based on the displacement/time calculation of the position change.

NOTE: all time related stuff (string ring time and velocity in strum) uses actual time at the moment, rather than mystical sample step time (so using these in a VST would need 1x speed rendering). I’ll be putting in a stepwise mode too.

I’ve put an example of how it can be used as a MIDI guitar system in the root of the archive. These example files are the same ones used in the demonstration plugin- the filter simply inherits the MidiGuitarStrummer, and sets the strum position using incoming CC/pitchbend messages. It would of course be a simple task to allow midi notes to pluck strings, etc…

Like i said, a bit odd, but reasonably interesting nonetheless (to me ;))


an interesting response :slight_smile: i guess it’s not the kind of thing people tend to make!

It’s a cool idea. I once started writing some classes to represent musical concepts (intervals, chords, etc) but gave up because it ended up being hundreds of classes, none of which actually did anything useful!