ode writes down how an instrument is played
A violinist reads more than pitches. ode has the bow, the breath and five styles of playing, in score words or plain ones, and you can hear each of them here.
A note in a piano roll has four facts: its pitch, where it starts, how long it lasts and how hard it was hit. A violinist reading a part gets more than that. A dot over a note says play it short, a curved line says take these four notes in one bow, and a wedge says hammer this one. The player turns each mark into something the arm does. This is the power of sheet music, and the weakness of synthesizing.
So we’re going to fix that.
Songcode’s music coding language, ode, writes those marks down as text and communicates them to our musical engine. In this post we’ll through all the cool stuff ode can say about a physical instrument.
A bow and a breath
A bowed note has no hard edge. The bow has to get the string moving, so the note swells in, and the bow slows before it turns, so the note sinks away. A horn or a flute does a similar thing with air. Every note has that swell. Fast when the player digs in and slow when the playing is gentle.
Songcode plays every note of a bowed string, a wind, a brass instrument or a choir this way. Dynamics steer the note, so a line marked p blooms and a line marked f speaks at once. Two settings in ode manage this.
stem violins: violins {
line [mf g4/8 a4 b4 c5 d5/4 b4 c5/8 b4 a4 g4 a4/2 g4/8 a4 b4 c5 d5/4 g5 e5/4 d5 g4/2]
bow 45%
}
stem horn: french_horn {
line [p d4/2 a4 f#4/1 r/1 r/1]
breath 30%
in chorus {
breath 75%
}
}Press play on that code or on any code in this post. What you hear is the text in the box, played in your browser with the Songcode engine.
A low number is a slow bow or a gentle breath. A high number is a fast one. Both can change by section, as the horn does above, or move across a build with ramp. Writing bow on a flute is an error that tells you the word is breath.
Five styles of playing
The swell is one way to play a note. Players choose others all the time and sheet music has had names for them for centuries. ode uses those names written between the notes the way a score writes them above the staff.
| score word | short form | plain word | what the player does |
|---|---|---|---|
| staccato | stacc | short | Short and clean. The note speaks at once and stops at once, with no swell. |
| spiccato | spic | bounce | The bow bounces off the string, so the note is nearly all start. Bowed strings only. |
| marcato | marc | punch | Hammered. A hard start that drops back, with air before the next note. |
| tenuto | ten | held | Held for its full length at one level. |
| portato | port | pushed | Pulsed inside one bow or one breath. Each note leans in and eases, and none of them stops. |
Here is the same phrase from the example above, six different times, with the score word tweaked to affect how the notes are played.
stem violins: violins {
line [mf stacc g4/8 a4 b4 c5 d5/4 b4 c5/8 b4 a4 g4 a4/2 g4/8 a4 b4 c5 d5/4 g5 e5/4 d5 g4/2]
}stacc.spic.marc.ten.port.This horn tongues two bars short, hammers two, holds two and pulses the last two. arco or normal goes back to the ordinary stroke.
stem horn: french_horn {
line [mf stacc g3/8 g3 b3 d4 g3/4 r d4/8 d4 b3 g3 d4/4 r marc g3/4 d4 b3 r g3/4 a3 b3 r ten g3/2 d4/4 r c4/2 b3/4 r port g3/4 g3 g3 r a3/4 a3 g3 r]
}A style can also be a setting, technique marcato, for a whole stem or for one section of the song. Two older marks still work on single notes: ' after a note makes that one note staccato, and _ makes it tenuto. Strings keep the ways of playing that were recorded as their own sounds, such as pizz for plucked or trem for tremolo.
Music for the rest of us
A rock band has its own words for these: keep it tight, hit it, let it ring. So every style has a plain word as well and both vocabularies work on every pitched instrument. A guitar, a bass or a synth has no bow to shape the note, so a style there sets how long each note sounds, and punch hits it harder.
stem riff: crunch_guitar {
line [short e3/8 e3 e3 e3 punch g3/4 a3 short e3/8 e3 e3 e3 punch b3/4 a3 held e3/2 g3 pushed e3/4 e3 g3 a3]
}
stem bass: pulsebass {
line [short e2/8 e2 e2 e2 e2 e2 e2 e2 e2/8 e2 e2 e2 e2 e2 e2 e2 held e2/1 punch e2/4 e2 g2 a2]
}On a synth bass the choice between short and held is most of the groove, so it is written in the part with the notes.
Slurred notes run into each other
Round brackets are a slur: (c5/8 d5 e5 f5) is four notes in one bow or one breath. Only the first note swells in. Each note after it fades up while the one before fades out, so the line never dips between pitches. People who work in a DAW historically have done this by hand, dragging each note a little past the start of the next. No more of that.
stem cello: cello {
line [mp (d3/2 a3/4 d4) (e4/2. f4/8 e4) (d4/4 bb3 g4/4. f4/8) e4/1]
overlap 100ms
}overlap sets how long two joined notes share. Left out, Songcode picks a length from the speed of the notes. legato on a stem joins every note in it.
Edits go both ways
Everything above is text in the track’s code, which translates natively to Songcode’s web DAW step view. Drag a staccato note to a new pitch in the note grid and the code comes back with the note moved and its style still in front of it, spelled out as staccato. Change stacc to ten in the code and the grid shows the same notes at their written length, played the new way. It just works.
Songcode writes like a player
When you tell Songcode to write a song, it uses everything we’ve talked about here in the most optimal way. Songcode’s internal knowledge of music and how its historically been played stretches back generations. It will write each part the way someone who plays that instrument would play it, picking a style phrase by phrase: short where a figure dances, hammered at the peak, held on the last chord.
Here we ask for “an orchestral cue: a ship leaving harbour at first light, building from one horn to the full orchestra”. Songcode writes a song for 14 instruments across six sections.
Here is the moment the full orchestra takes the theme. The lines are as Songcode wrote them.
form horizon 4
let theme = line [a3/4 d4/4. e4/8 f#4/4 a4/2. g4/8 f#4/8]
let answer = line [e4/4. f#4/8 g4/4 b4 a4/1]
stem trumpet: trumpet {
breath 80%
}
stem flute: flute {
breath 50%
}
stem violins: violins {
bow 45%
in horizon {
bow 80%
}
}
stem violas: violas {
bow 40%
}
score horizon bars 1..4 {
trumpet [1: f marc theme(up 1oct) answer(up 1oct)]
flute [1: f theme(up 2oct) (e6/4. f#6/8 g6/4 b6) a6/2 r/2]
violins [1: f arco (f#5/8 e5 d5 e5 f#5 a5 d6 a5) (f#5/2 e5/4 d5) (d5/8 c#5 b4 c#5 d5 g5 b5 g5) (e5/2 c#5/2)]
violas [1: f port d4/4 f#4 a4 f#4 d4/4 f#4 a4 f#4 d4/4 g4 b4 g4 c#4/4 e4 a4 e4]
}The tune is written once, as theme and answer, and each section plays it its own way. The violins get a faster bow for this section than they have at the start of the track. The trumpet hammers the tune an octave up on a strong breath, the flute sings it two octaves up, the violins slur a running figure over it, and the violas pulse quarter notes underneath.
Earlier, in the section called sea, the violas bounce an ostinato with spic while the cellos play port under them. In the closing bars the violins and violas hold ten chords at pp.
Want to experiment with this track? Because of the native flexibility of ode code, you can load it up right now. first-light-open-water.ode is the code alone, and first-light-open-water.songcode is the project file. Open either one in Songcode with the open button or by dropping it on the page, then change a marc to a ten and listen to what the trumpet does. We think you’ll like it.
Current limits and the future of Songcode instruments
The language can describe how a part is played in as much detail as a score can. What you hear in these recordings is limited by something else, which is the instruments. Songcode’s built-in strings, winds and brass are small recorded sets that load fast in a browser. A professional orchestral library records every note at many strengths and in every style, and you can hear that gap in the samples above.
We are working on it from three directions. We are improving the built-in instruments. We are building a way for you to bring your own VST instruments, so a part written in ode can play through the library you already own. And we are pursuing partnerships with instrument makers. The code will not need to change when the instruments do, because marc on a trumpet is the same word whichever trumpet plays it.