How to clean up Portastudio tracks (part 2)

I am using “Reaper” as a Digital Audio Workstation to produce music compositions. The previous part described how I have copied old Portastudio recordings to the digital domain and how I have cleaned them up and synchronised them to a standard tempo.

As part of this exercise I have come across some useful plugins provided by Reaper itself.

All of my old recordings  were made using a home made poly synthesizer. This was an analog synth and was not always tuned to the 440 Hz standard. The Portastudio also had a control that could speed up the tape, so some of the recordings are not to a fixed standard. This means that if I want to add a current instrument tuned to 440 Hz standard, I need to adust the pitch of the recordings to match. There is a wealth of “JS” (JesuSonic) plugins that come with Reaper that do loads of useful specific tasks.

I used the “JS Pitch Shifter 2” plugin and added it to all the Portastudio tracks as the first in the effects chain. I then adjusted the pitch by an amount of cents until the track tuning matched the standard 440 Hz. I simply added a piano instrument and played along to a lead track and adjusted it until I had a good fit. There is a plugin that can analyse the pitch played, but if you have a good ear that works just fine!!


If you are feeling lazy and just want to transcribe a lead track to a MIDI track without having to use your ears, then there is a brilliant wheeze to do this. I used this to beef up a synth lead track with a digital synth and a violin and it is quite a nice effect.

Reaper comes with an auto-tune plugin to do vocal pitch correction called “ReaTune”. This plugin can also track an monophonic instrument track and determine the pitch of the notes played. The neat thing about this plugin is that it can generate MIDI note on/off messages when the pitch changes.


Add the ReaTune plugin to the audio track with the lead synth. Simply check the checkbox “Send MIDI events when pitch changes”. When the audio track is played then MIDI mesages are generated automatically.

The MIDI messages need to be recorded on a new track. Add a new track, press the routing button and add a receive route from the audio track to receive MIDI messages.


Note that the Audio option at the bottom of the form has been set to “None” (we are only routing MIDI) and the MIDI option at the bottom right has been set “All to All”.


There is another essential step to be done (which rather tried my patience when setting this up). If you don’t do this you will see the MIDI generated by ReaTune but you will get a blank recoding. You have to tell Reaper that the MIDI track is recording MIDI data from an internal source rather from an external keyboard.

Press the input button for the MIDI track and select “Record Output (MIDI)”. The default is set to Record Input either MIDI of Audio.

You then arm the MIDI track, put the cursor to the start and press record. You will then see MIDI events being recorded.



Once you have transcribed the MIDI you can then remove ReaTune from the Audio track, unarm the MIDI track and then add a VSTi instrument to the MIDI track.

Before you play the track it is worthwhile making sure the MIDI track aligns with the audio as there may be some common delay latency. I also edited the MIDI track to take out notes that were accidentally transcribed by ReaTune.


Project “MIDI ing up a Grand Piano” part 1

This is the start of a new project. I have always wanted to get a standard MIDI output from playing my acoustic Grand Piano. I hate playing an electronic piano and much prefer the touch and sound of the real thing. It is my primary composing tool and I would like to just to be able to record every time I play it so that I never miss that “lost chord”.

There are systems out there to do this and I have seen an open source project, but they are expensive. I want to produce a reliable system that is cheap to build.

Many years ago, I built an electronic piano from a kit. This had a standard spring loaded organ keyboard. Each key had a “plunger” that was used to operate an electric switch. The switches were created by soldering a gold plated springy wire to a PCB and arranging the plunger to move it between two parallel gold plated bus bars. There was some electronics that measured the discharge of a capacitor as the wire moved from the upper bus bar to the lower bus bar. The voltage pulse generated was related to the key velocity and so the piano was able to implement touch sensitivity. (each key circuit utilised a signal diode and I got the polarity wrong and soldered 76 of them into position. I then had to unsolder each one, turn it around and re-solder it. Oh happy days !)

I took this basic system and adapted it to a microcontroller. The two bus bars were connected to two output pins and the switch wire was connected to an input pin. The micro controller alternately switched the bus bars from low to high and so was able to determine whether the switch wire was touching a bus bar. The micro controller started a timer when the switch wire left the upper bus bar and stopped the timer when it touched the lower busbar. The micro controller was able to determine the key velocity from the timing and generated a pair of MIDI key on and key off commands.

I proved the concept using a PIC 16F628 micro controller. Each PIC could handle up to 12 keys. I planned to daisy chain 7 PICs to handle a full keyboard.

I had thought of using this type of system to MIDI up my Grand Piano, however there is the problem of getting the piano action mechanics to operate the switches. The switches themselves do not take much force to operate them, so they would not really affect the touch. I may use this concept to make a MIDI keyboard controller from an old scrap piano.

The alternative is to use some sort of opto sensing of the key operation, either digital or analog. For instance an analog system would observe the piano hammer distance by observing the amount of reflected light. A digital system would observe the key interrupting a light beam at two points and calculate the velocity using the interrupt time.

I am going with the digital system for my project. My first stab is to link up some opto components to my favourite PIC and do some experimentation.

I bought 2 Infra-Red LEDS (TSUS5400 940nm 5mm infrared emitter) costing 20p each, an Infra-Red photo transistor (LL-304PTC4B-1AD 3mm IR Detector 940nm) costing 31p and linked them up to a PIC 16F628 micro controller. The prototype was built on bread board as shown ….



The two IR LEDs are connected to pins A2 and A3. When these pins go low, current flows through the LED making it emit infra red. The photo transistor collector is connected to the input pin B0. This is normally held high by the pull up resistor. When light is detected, the transistor conducts and pulls the collector low. This transition of high to low can be detected by the micro controller.

The PIC output at A1  is connected to pin 2 and the 0v line is connected to pin 5 of a 9 way D type socket. This is connected to my PC serial comms port which allows me to see debug information on a terminal running at 9600 baud rate.



The prototype shows the photo transistor in the centre with a IR LED either side. They are all pointing vertically upwards so that minimal light reaches the photo transistor. When a reflective surface (such as a screwdriver blade) is held above one of the LEDs, light is reflected from the LED to the photo transistor, causing it to conduct.

As the reflector is moved horizontally from left to right there are two detections from each LED. The micro controller can determine which LED is causing the detection because it continually switches each LED on and off in sequence. The test software determines the time between detections, converts it to text and prints it out at the computer terminal.

So when I “swipe the reflector, I get a number indicating how fast the swipe is.

The infra red light emitted by the LEDs can not be seen by the naked eye, however the camera in a smartphone is able to “see” infra red as shown by the following photographs. The first is with both LEDs off and the second one is with both LEDs on.


The next stage of my project is as follows :-

1) mount the components on some vero board.

2) take out the piano action and investigate a suitable place to put the sensor.

3) fix the sensor into position at say middle C and bring out some temporary leads.

4) connect up to a terminal and investigate the range of velocities detected.


I wrote the test program using MikroElectronika PASCAL. I took advantage of its software library to output data to the RS232 PC Comms port. The program initially flashes the LEDs as a test which I can see using the smartphone camera, it then outputs the program version string and goes into the detection loop.

program MicroRtu;

{ Declarations section }
count : integer;
onState : boolean;
byte_read : byte;
error : byte;

procedure displayCount( p_count : integer );
dg : byte;
i : integer;
digits : array [0..5] of byte;

if p_count > 0 then
for i := 0 to 5 do digits[i] := '0';

i := 0;
while p_count > 0 do
dg := p_count mod 10;
digits[i] := dg + '0';
p_count := p_count div 10;

for i := 5 downto 0 do


{ Main program }
TRISA := $FF; //isolate
TRISB := $FF; // usart pins must be inputs exept B4
CMCON := $07; // disable comparators

//outputs A2..A3 connected to IR LEDs
TRISA := $F3;

PORTA := 0; //turn on LEDS
PORTA := $FF; //turn off LEDS
PORTA := 0; //turn on LEDS
PORTA := $FF; //turn off LEDS

Soft_UART_Write(' ');

count := 0;
onState := false;
while true do

// set IR led 1 ON led 2 off
ClearBit (PORTA, 2) ;
SetBit (PORTA, 3);

// check sensor
if TestBit (PORTB, 0) = 0 then
if not onState then
count := 0;
onState := true;

// set IR led 2 ON led 1 off
ClearBit (PORTA, 3);
SetBit (PORTA, 2);

// check sensor
if TestBit (PORTB, 0) = 0 then
if onState then
onState := false;



Generating Drum Clicks from Yamaha PSR775

I am investigating the possibilty of using the PSR775 keyboard (or any other arranger keyboard) in a band situation. The default option for the PSRS775 is to generate a full drum track, bass and accompany tracks in response to playing left hand chords.

The mixer function allows you to mute any track(s), so I could play without the drum track and the bass track. If I have a trio with a bass and drums then it is possible to make a more live sound and take advantage of the additional instrument tracks to fill out the sound.

The drawback to this is the the PSR775 does not generate a drum click track (like a metronome) which is needed for the drummer to count in the song and generally keep in sync with the keyboard.

The PSR775 does have a MIDI output however. The MIDI specification caters for synchronisation of instruments by having a dedicated timing message. This is a single byte F8 (hex) and it is sent 24 times for each beat of the bar. The PSR775 can be configured to send this timing message out of the MIDI output port. This message is sent out when the auto accompany is running and is synchronised to the current tempo.

If the reception of this message is counted, then it is possible to generate a “click” for every beat.

I designed a very simple device that plugs into the MIDI output port and generates an audio click for every beat. It is based around a PIC microcontroller and does not require any external power. The device has a 5 way DIN plug to plug into the keyboard MIDI port and has a 1/4″ jack socket for audio out and this can be directly connected to a monitor mixer input.

The click is actually generated using a one bit digital to analog convertor. A digital output line from the PIC is connected to a simple RC network (Resistor and Capacitor). The capacitor takes time to charge and discharge in response to the applied voltage. If the output is held high the capacitor eventually charges and the audio output goes to max, if the output is held low the capcitor eventually discharges and the audio output goes to min. It is possible to produce an audio waveform by switching high and low for different time periods. The audio is encoded as a bit stream of ones and zeros. The maximum switching rate is 4000 bits per second which in theory allows for tones up to 2KHz. It’s not hifi, but it can reproduce speech and simple waveforms such as metronome clicks.

I am able to program several different waveforms so that the first beat of the bar can be a bell sound.




The above is the circuit diagram using a PIC16F628 chip. An extra two resistors and capacitors are required. I constructed the device on some veroboard and fitted it into a discarded plastic pill container.






The above photos show the completed device.




The internal clock needs to be transmitted (TRANSMIT CLOCK:ON). The above shows the MIDI configuration page on the PSR775.




I used this device successfully on a gig. I played in a trio (bass, drums and keyboards) and accompanied a singer doing mainly swing jazz stuff. I patched the audio output into a small audio mixer and plugged in the drummer’s headphones into the mixer headphone socket. The drummer was used to playing with click tracks so had no problems adapting.

To start a song, I pressed the start button on the keyboard and the drummer counted in the band. During some numbers where there was a key change, a break or a time signature change, I stopped the click track by pressing the auto start button. This primed the keyboard ready to start again. When the song resumed, I played a left hand chord to restart the auto chording and the regular click track.


How to clean up Portastudio tracks

I am using Reaper Digital Audio Workstation (DAW) to clean up old Portastudio tapes that I copied to my PC. (See previous post). Reaper is inexpensive and you can use it for free to try it out. It is a very sophisticated program that runs on a Windows PC and is of audio studio quality.

So, first step: Fire up Reaper, start a new project and copy the 4 track Portastudio WAV files into the workspace. Simply drag and drop the files and get Reaper to arrange them as 4 separate tracks..


The next screenshot shows the 4 tracks with a whole cassette of music. We are working on a single song, so select all the tracks and set a selection around the part we want. Right click and select “Crop project to selection”.



You will then get just the required bit of music to work on. Note that there is no danger of deleting or altering the original WAV files. In the cropped view you can see that track 2 contains a drum machine track. This is to be replaced by a MIDI drum track.

At the moment I have no idea of the tempo. It is in 4/4 time. So I select all tracks and play from the start.

I press the SHIFT W key at the start of every bar and try and get these as accurately placed as possible. This creates a special time stretch marker (shown as a vertical line on the trace) that can be moved to stretch/reduce the time base for the music. If I move the marker to the left it will speed up the music on the left up to the next marker and slow up the music on the right up to the next marker. The neat thing about this is that the start of the bar can be adjusted to line up exactly with a fixed tempo grid.


The above screenshot shows all the markers added. You can see that the underlying grid is set to 120 bpm (beats per minute) tempo and does not align with the added markers. The next step is to calculate the average tempo and set the tempo grid so that the markers will line up.


The above screenshot shows just the drum track with markers. Position the cursor on the first marker and read off the time display. You then position the cursor on (say) the eleventh marker and read off the time display. You can then work out the time interval for 10 bars of music and hence calculate the bpm.

In my example:

cursor @ 1 time = 4.8 S

cursor @ 11 time = 37.7 S

Time interval = 37.7 – 4.8 = 32.9 S

Number of bars = 10

Number of beats in 4/4 = 4 * 10 = 40 beats

Tempo (bpm) = (40 x 60) / 32.9 = 72.9 bpm


The next step is to adjust the underlying grid so that the markers align. There is a field to enter the tempo (bpm) under the displayed tracks. When this is changed, Reaper will by default time stretch or reduce the tracks in order to change the tempo. At the moment we do NOT want this behaviour, but adjust the tempo grid independently of the music tracks.

The way to do this is to temporarily turn off the time stretch/reduce function. Go to the “File” main menu and select “Project Settings”. Set the two “Timebase” values to “Time” as shown below.

Enable the editing function “Item Edit Grouping Enabled” to allow all tracks to be edited in one go and also turn “Snap To Grid” to off.

Enter the calculate tempo (72.9) to the “bpm” field and this will change the grid spacing.

Select all the tracks and move the tracks to align the first marker with a bar start line.


If you calculations are right and the original keyboard tapping is accurate, you will see the music line up with the tempo display. In my example above, you can see some slight discrepancies with the markers and the beat lines. In my example it is pretty obvious where the markers should be on the drum machine track.

The next step is to adjust the markers to align with the beat lines on the tempo grid. When these markers are moved, the tracks are time stretched to fit.

Select all the tracks, hover the over the diamond symbol on the marker. The cursor will then change to a diamond shape. Press the left mouse button to grab the marker and whilst holding the mouse button down, move the marker to align to its nearest beat line, then release.

Note that it is possible to select a single track and adjust it independently to correct for timing errors in the original performance and so tighten up sloppy playing. Obviously in my example this is not necessary !

Once the process is complete, go back to the project settings dialog and change the timebase values back to their original defaults (beats). The music can then be changed to any desired tempo and the audio will be automatically time stretched or reduced.


In my example I can set the tempo to 85 bpm to speed it up slightly. I can then generate a drum track using a MIDI editor for a tempo of 85 bpm and import it, or I could record a drum machine running at 85 bpm. The old drum track can then be replaced.


You can see that the original drum track is muted and a new MIDI drum track has been added as Track 5. I have assigned a VSTi instrument to the MIDI track using the fX button and am using a sound font with a standard drum kit.

Remember the Portastudio ?

I bought a Portastudio 4 track tape recorder in the early eighties. This allowed me to record 4 tracks of audio on a compact cassette tape. The tape spooled at twice the normal speed to increase fidelity. It also had a 4 track mixer and basic studio facilities. The main drawback with this system was that it only allowed a maximum of two tracks to be recorded at any one time. It allowed 4 tracks to be mixed into a stereo output but it had no facilities to output 4 separate tracks at once.

TEAC Portastudio 144

At the time it was the bee’s knees and was very popular with bedroom musicians. I used it in conjunction with a Polysynth that I built and a very basic drum machine. The vocals were questionable !

Wind on thirty years….. I wanted to preserve all my earlier creations and I wanted to get them digitised as the tape deteriorates and the machine will stop working soon. There have been so many advances in digital audio engineering and I have the facilities to edit, improve, add effects etc.etc.

My first attempt was to output two channels (1 & 2) and record them to my PC using a stereo ADC interface, and then record the other two channels (3 & 4). This required two passes of the tape and when I tried to match up the two recordings there were quite serious synchronisation problems.

I then decided to hack the machine and get access to the 4 channels at the mixer. I bought a 4 channel ADC USB interface and hooked this up to my PC.



I used a superb, cheap DAW (digital audio workstation) application called “Reaper” on my PC and this allowed me to record 4 channels at once. Each track can then be saved as a WAV file.

The Portastudio hack involved the following:-

  1. Take a stereo phono lead and cut in half so that you have 4 phone connectors.
  2. Take the back off the portastudio.
  3. Solder the signal wires to test point connectors on the Mixer part of the exposed PCB.
  4. Attach the screen wires to the chassis.
  5. Plug the phonos into the MAYA 44 USB analog inputs.

Notice the connector labelled “T.P. (TRK 2)” in the centre. Connect a signal lead to it. (actually shown as white). The phone cable screen is connected to the blue/white stripey wire.



Continue with Tracks 1 to 4.


The screen wires (connected to blue/white stripey wire) are connected to the chassis.


The Portastudio back is stuck back temporarily and there are 4 phono leads available.


I have managed to transcribe all my old Portastudio tapes to individual WAV files. I have managed to do various tasks, for example I have taken off the old drum machine track and replaced it with a more realistic track, I have managed to add extra tracks of instruments, Vocal tracks. I have also managed to edit the tape to duplicate choruses, take out bum notes – that sort of thing.

In order to add extra drum tracks or MIDI sequences it helps to make sure that the tracks are all synchronised to a standard beats-per-minute. I play the tracks together using Reaper and press a key to generate a marker on every bar start. I can then get the average BPM and set up a grid with this figure. I then manually adjust each marker to the grid using the time expand  /compress feature to get the start of each bar to line up with the grid. The adjustments required are very small (if required at all) and do not affect the fidelity. If a track includes a drum machine it is easy to check that the manually generated marker is actually the start of the bar.

Once this has been done, it is easy to run a drum machine along side or add a MIDI track.

I used to bounce 3 tracks into one track in order to free up more recording tracks, unfortunately this cannot be undone and the tracks need to be transcribed by ear and re-played on a MIDI instrument.

I shall show a tutorial for processing the tracks on a later blog entry.





Foot switches for PSR S775

I have extended my “Midi Mate” (in previous post) to incorporate four footswitches to control the variation and drum fill selection on the PSR S775. I bought 4 foot switches from Amazon for a total of £10. These are momentary push to make switches that are designed to operate mains voltage for machinery.

I mounted four of these onto a strip of MDF by screwing screws directly into the plastic switch body from underneath. I then connected the outgoing cables to a 5 core cable with four of the switch poles commoned to one wire. (This is the voltage send and the other 4 wires are for the sense)

The five way cable is terminated using a 5 pin DIN plug (as used for MIDI) and this plugs into the Midi Mate unit as shown in the picture:

The four foot switches are connected internally to the electronics that scans the 3×4 keypad using a fourth scan output line. (In the AK47M project this is wired to four push button switches on the front panel.)

When a foot press is detected, the unit sends a series of MIDI messages to select a variation fill and select a new variation. As far as I can see, the MIDI interface does not operate in the same way as the manual push buttons on the keyboard. If the “auto fill” mode is on and you press a new variation button, the keyboard does a drum fill and then starts on the new variation after it completes.

The MIDI interface has ‘ on/off’ messages for drum fills and variations. So if you switch a drum fill on, it keeps repeating until you send a message to switch it off. So what I have done is to send a ‘variation off‘ and a ‘fill on‘ message when the foot switch is pressed down and a ‘fill off‘ and ‘variation on‘ when the foot switch is released. So a fill keeps going as long as the foot switch is held down. The switch springs back by itself when the foot is released and the new variation resumes.

This works fairly well and means that I can operate fills and variation changes whilst using both hands to play the keyboard.

The MIDI messages are  (in HEX):

F0 43 7E 00 ss dd F7

dd = Switch On/Off 00H(Off) 7FH(On)

ss = Section



Stand for Hannspree 13.3″ Tablet

I use a Hannspree 13.3″ Android tablet to store and display sheet music. It runs the excellent “MobileSheets” app that allows me to store PDF files of sheet music scans and store them in an indexed database. THe Hannspree tablet was about the largest screen I could find at the time. It’s not bad and nearly A4 size and so not too strenuous on the eyes.

I tried to find an adaptor to mount it on a photography tripod but they all seem too small for the tablet. I had to build one myself. Its not too hard. I found a scrap of plastic extrusion that had a channel to hold the bottom of the tablet and mounted this on a piece of wood. The top of tablet is held in place with a large padded washer and a wing nut. I used a spare table leg bracket to attach the wooden piece to the tripod. The tripod I have has a detachable bracket which has a bolt that screws into the table leg bracket.

Jobs a good’un ……

Front view of holder. The squares are pieces of felt padding.



Rear view of holder with attached tripod mount piece.

Tablet mounted on tripod running MobileSheets.



New Yamaha PSR S775 with MIDI mate

PSR S775

I have bought myself a Yamaha PSR S775 as an early christmas present. (But really for starting up a functions duo). This is the flagship “arranger” keyboard that has lots of realistic voices, auto accompaniment, USB interface, MIDI record/play and MP3 record/play.

I decided to buy this keyboard to replace the defunct BK7M (spit!!) and upgrade from an earlier Yamaha arranger keyboard that I bought in 1993. (and still works!!) The PSR 6000 was very good at the time and I used it successfully in a functions duo (keyboard/vocals, guitar/vocals). It unfortunately had a floppy disk drive to save and restore registrations and there was not enough memory to hold everything required for a gig. This meant that there was a frantic swapping of floppy disks during the gig.


Now, with a 25 year interval, you would have thought that the latest keyboard would be best in all respects, but it is not necessarily the case …..

Here are my Pros and Cons :-

  1. Obviously with better technology there is more memory, more and better voices and everything can be stored on a USB stick. [+]
  2. The S775 buttons are much smaller and spongier. There is too much use of LEDs behind the buttons so it looks like a christmas tree. The PSR6000 had nice thumb wheels to change parameters whereas the S775 has fiddly up/down buttons. The PSR775 parameter selection wheel has a really cheap feel to it. [-]
  3. The PSR6000 has nice rounded corners, looks more robust and is more appealing to look at. There is more space used for the controls. [-]
  4. The PSRS775 has two “live control” knobs to adjust effects on the fly. [+]
  5. The auto accompany function and styles has not really changed at all. The S775 can store a lot more styles.
  6. The keyboard size and touch is identical.
  7. The pitch change and modulation wheels on the S775 are not as good as the PSR6000. [-]
  8. I think that the layout and ergonomics are better on the PSR6000. [-]
  9. The music stand is the most cheap and nasty thing ever. Obviously just an after thought. [-]

Overall the technology has improved, but little consideration has been paid to ergonomics and style !!

Anyhow the keyboard sounds as cheesy as its predecessor and you soon get tired of the novelty of the styles. However, it is ideal for the function gig either as a one man band or a duo.


It didn’t take me long to hook up my Yamaha P120 electronic piano using a midi cable in order to provide a wider and touch weighted keyboard.

It didn’t take me long also to realise that a “MIDI mate” would allow me to have two keyboard setups with different sounds. So I have written some firmware for my “MIDI mate” that allows me to some nifty functions by simply pressing keys on the keypad.


Midi Mate with keypad

The MIDI mate is connected in between the Piano and the S775 using standard MIDI cables. No battery or power is required, as it is able to obtain a small amount of power from the MIDI interface. The next picture shows the insides. I have used my AK47M pcb. You can see it is sparsly populated with one microcontroller chip a capacitor and 5 resistors.


The next picture shows my keyboard setup with the “Midi Mate” in place. There is also a screenshot of the MIDI configuration required on the PSR S775 :-

The nifty functions are as follows :-

  1. Press the “#” key and the piano keyboard duplicates the PSR S775 keyboard.
  2. Press the “*” key and the entire piano keyboard is independent to the S775 keyboard.
  3. Press keys “1” to “9” and a right hand voice is selected independent to the S775 keyboard. e.g 1=piano 4=strings 5=jazz organ. The piano keyboard is split so that the left hand can control the auto accompany.
  4. Press key “0” followed by two digit number to select a voice as in (3). The voice is stored for key press “9”.  Press key “0” three times to double up last two voice selections.

Function “4” may change as I explore what works.

This works really well by having a basic pallette of solo instruments on the piano keyboard and being able to swap quickly without any fiddling about. It also means I have a decent keyboard to play and plenty of space for the auto accompany left hand.


I mentioned the music stand was tacky – well this is what I meant ……

The Real book causes it to wobble like a demented penguin.



AK47M project part 10 (Prototype ready)

I have completed the prototype AK47M and the first versions of firmware and controller software. I used an old cigar box as the enclosure. I have tested the unit using my Yamaha electronic piano and a keyboard amplifier. It works as expected and I am currently  writing a user manual which will explain the operation in greater detail.

The front panel is a piece of laminated paper glued onto some thin MDF. The front panel comprises of a 3×4 keypad, a 2 line LCD display and a row of 4 push buttons.


On the back is from left to right:

  1. The USB power cable.
  2. A pair of jack sockets for the stereo output for the auto accompany synth.
  3. A pair of jack sockets for the stereo output for the solo (right hand) synth.
  4. A 5 way DIN socket for the MIDI input

The following shows a series of screen shots of the AK47 LIVE software that either runs on a Windows PC or the internal Raspberry PI on-board computer.

The windows version simulates the keypad using the PC numeric keypad.


This is the initial screen with control for the solo lead voices and the left right hand split.

The buttons along the bottom deal with navigating the performance file and editing the current performance file.

The green boxes allow for easy selection of a voice for a part. The blue boxes are volume control sliders.


These two screens control the selected style parameter. The style file assigned to the current performance is shown in red text. The individual style parts may be independently controlled

This screen shows the BIAB file selection and the BIAB editor with a chord sequence for “Ain’t Misbehavin”





Lazarus / FreePascal problem on 64 bit machines.

I ported some open source MIDI handler code from Delphi to Lazarus. This was originally working on a 32 bit Windows machine but when I compiled and ran it on my Windows 64 bit machine I got a Segment Violation error when opening the input MIDI port.

I tracked the error down to the system unit called “mmSystem”. This defines interfaces to the windows multimedia DLL –  “winmm.dll”. The offending interface was a function called “midiInOpen”.

The function has a parameter for the address of a callback function. The current “mmSystem” unit defines this as 32 bit and not 64 bit as it should be if the code is compiled for a 64 bit machine. The unit needs to be upgraded to handle both cases.

In the mean time, I hacked my (open source) MIDI driver code to handle both cases:

I used the compiler conditional expressions to determine when I am compiling a 32bit or 64 bit system.

I have defined an alternative interface for midiInOpen call midiInOpenX which has a 64bit parameter (int64) for the callback address.

Seems to do the trick…


// X64 hack
Function midiInOpenX(x1: LPHMIDIIN; x2: UINT; x3: int64; x4: DWORD; x5: DWORD): MMRESULT;stdcall; external 'winmm.dll' name 'midiInOpen';

procedure TMidiInput.Open(const aDeviceIndex: integer);
lHandle: THandle;
lResult: MMResult;

if assigned( fDevices.Objects[ aDeviceIndex ] ) then Exit;

lResult := midiInOpenX( @lHandle, aDeviceIndex, int64(@midiCallback), aDeviceIndex, CALLBACK_FUNCTION );

lResult := midiInOpen( @lHandle, aDeviceIndex, longword(@midiCallback), aDeviceIndex, CALLBACK_FUNCTION );

if lResult <> MMSYSERR_NOERROR then
raise exception.Create( GetLastErrorText );

fDevices.Objects[ aDeviceIndex ] := TObject( lHandle );
« Older Entries Recent Entries »