Fixing Spitfire BBC Orchestra in Reaper – or how to write a plugin

NOTE: SPITFIRE HAVE NOW FIXED THEIR BUGS SO IGNORE THIS POST

 

 

 

I recently bought the basic Spitfire BBC Orchestra samples for £0. (but I had to wait 2 weeks)

This is a cut down version of their full orchestra sample library, but I guess it is good for sketching. They have developed their own player for this which is similar to their LABS libraries. Presumably this is to avoid using Kontakt player which costs extra money. I used it for a little while and then discovered it had quite a serious bug when playing MIDI sequences. If you have a note played followed by the same note and the first note end time equals the second note start time, then the second note does not play. This can quite easily occur if you quantise a MIDI recording.

This annoyed me especially as I was paying nothing for it instead of the reccommended £49. I was about to report the bug but saw that other people had got there first and there was a forum discussion about it. Some bright spark mentioned that they had written a Reaper plug in to workaround the problem but did not give any further details. Basically if you shorten the first note ever so slightly, the second note will play.

I was intrigued by this and I decided to look further into the black art of writing a Reaper plug in. It is not particulary well documented and there was no basic tutorial in starting. It is really quite easy once you know how and I will show you how to write a plugin to fix the Spitfire library.

There are a large amount of Reaper plugins in the “JS” folder. I have already described how I use some of them when working with MIDI. These plugins use a native scripting language to work. There is a built in editor and basic debugger to create,edit and compile the scripts. You are able to view the source code of any of the built in plug ins and use it as a basis to create new ones.

Creating a new script.

In Reaper, create a new track. Click on the track effects button and this will bring up the effects library page. Right click on the “JS” section and this brings up a pop up menu. Select the “Create new JS effect“.

It will then ask you for an effect name. Enter a meaningfull name as this will appear later in the effects library “JS” section for you to select as an effect.

 

It will then create a basic plugin that does nothing in particular and has some default sliders for entering parameters. There is an edit window on the left and a variables watch window on the right.

You enter the script code in the editor window and finally press Ctl S to save the current text and compile the plugin. Any errors with the script syntax are then displayed and you have to fix the errors (if any) and press Ctl S again.

Editing an existing script.

In Reaper, create a new track. Click on the track effects button to get the effects library page. Double click on the effect you wish to edit and this will add it to the track effects chain. Click on the effect and the standard effect parameter page will be displayed.

 

There is an “Edit” button on this page. Press it and the following effect edit screen will be displayed. This is the same as the creation page.

 

 

Change the script and press Ctl S to save and re-compile it. Note that the changes only apply to the selected track. In order for it to apply to all instances of the effect, exit Reaper and restart it, gotcha !!!!!

The script to fix the Spitfire BBC Orchestra

This script needs to create a gap between adjacent notes of the same pitch. The gap only needs to be small. This means that it is easier to create small gaps between any note and the gaps are too small to be significant. So the script should take any MIDI note and make a small gap. A note comprises of a MIDI ON message followed by a MIDI OFF message, so if we alter the timing to make the ON message later and the OFF message earlier we can achieve a fix to the problem.

There are two MIDI functions within the script – midirecv and midisend.

Midirecv receives a single MIDI message from the previous effect plugin or routed MIDI stream. This is usually a command byte a pitch byte and a velocity byte for note on and note off messages. It also receives a time offset. As far as I can ascertain, this is relative to a block of MIDI messages and ranges from 0 to 239.

Midisend sends a single MIDI message to the next effect plugin or routed MIDI stream. It takes the same parameters as the receive. The timing of the outgoing message can be altered by changing the time offset up to a maximum of 239 and a minimum of zero.

Here is the script. Simply paste the entire script into the plugin editor window and save it with Ctl S. Ensure that it is placed before the Spitfire BBC Orchestra VST plugin in the effects chain.

 

desc: Spitfire BBC Hack


in_pin:none
out_pin:none

@init

@block

while(
midirecv(msgt,msg1,msg2,msg3)?
(


// note on 
(((msg1&240)==0x90) && (msg3!=0)) ? (


(msgt<230) ? msgt+=10; 
);

// note off
( ((msg1&240)==0x80) || ( (msg1&240)==0x90 )&& (msg3==0) ) ?(

(msgt > 20) ? msgt-=20;

);




midisend(msgt,msg1,msg2,msg3);
1;
):0;
);