Author Archives: PJADMIN

Transferring video from Reaper to a Humax video player

I use Reaper as a video editing tool and for film score composition. When I create a video and render it to a video file, it plays quite nicely on my PC. I have a (fairly old) Humax hard disk TV video recorder that is linked to my TV. I tried to play a video created in Reaper on the Humax, but it failed miserably and it took me a while to figure out how to transfer a video.

I downloaded and installed the VLC media player as part of my Reaper installation in order to play video in Reaper.

In Reaper, render the video as follows :

 

This will produce a .MOV file and is “xmas.mov” in my example.

Next you have to convert this to a video format suitable for the Humax machine. Run VLC media player and select “Convert / Save” from the main menu item called “Media”. This will show the following dialog.

Add the Reaper video file to the file list. (You can add multiple files for a batch conversion). Press the Convert / Save button and select “Convert”. You will then get the next dialog:

Ensuer the destination file extension is “.mpg”.

Ensure the “Profile” drop down is set to Video – H.264 + MP3 (TS).

 

Press the button with a spanner icon to change the profile settings. You will need to increase the bitrates for half-decent video resolution. Set a Video bitrate to 800 to 1200 kbs and the Audio to 256 to 320 kbs. The factory defaults are too low.

Click on the Video and Audio Codec Tabs and remember to press the “Save” button.

 

 

 

 

Press “Start” and the video(s) will be converted. You then copy the video file(s) to a USB memory stick and plug it into the front USB socket on the HUMAX recorder/player.

 

 

 

Adding a MIDI controller to Reaper

This is a recent addition to my home studio. The Korg nanoKontrol2 is a MIDI control surface that connects to the PC using a USB cable. Its an inexpensive versatile piece of kit.

It has the usual transport controls on the left hand side and 8 fader modules to the right. Each fader module has the slider fader, a rotary pot and three switches “S” “M” and “R”. It can be mapped directly to the reaper Transport controls and Mixer, but I intended to use it differently.

The kit comes with a comprehensive PC application that allows you to assign any MIDI control change number to the hardware elements. I used the defaults and this is programmed by applying USB power whilst the “Cycle” and “Set Marker” buttons are pressed.

When the unit is plugged in, it must be enabled for input on the MIDI devices dialog.

 

Reaper has a very powerful “Actions” feature. It is possible to map the internal system functions (e.g. start recording) to a PC key press or a hardware element on the controller itself. Furthermore, it is possible to chain several system functions as a single custom action. (Macro) Reaper actions have a “Learn” feature whereby you select the action you want and then press a PC key or twiddle a pot on the nanoKontrol2 and a link is made automatically.

 

What I have done is to map the Transport controls directly to the Reaper transport controls. I have then assigned the fader modules as follows:-

Fader Module 0 (first far left) — Master track

“S” : Toggle the mixer window on the PC screen

“M” : Insert a stretch marker

“R” : Invoke external MIDI editor(Cakewalk) for current track

Fader: Adjust Master volume

Fader Module 1 (far left) — Selected track

“S” : Set automation mode to Write for the selected track

“M” : Set automation mode to Read for the selected track

“R” : Set automation mode to Write for the selected track, start Play to record automation.

Fader: Adjust selected track volume

Fader Module 6 (far right) — Instrument expression

Fader: Adjust selected track expression on Spitfire VSTi

Fader Module 7 (last far right) — Instrument quality

Fader: Adjust selected track quality on Spitfire VSTi

 

The default mode for the switches is to issue two MIDI CC messages, one for the key press and one for the key release. There is another toggle  mode that issues a single CC message for a key press/release and toggles the state. It also switches a red LED on and off. These switch modes can be independently programmed.

Unfortunately, REAPER does not seem to allow the Learn mode to distinguish between key press and key release messages. Well it kinda does by setting the learn range to -65..+65 for a switch, but it doesn’t always work.

Tempo mapping and time stretching MIDI in Reaper

In my earlier post about cleaning up old Portastudio recordings, I showed how it could be done using stretch markers. This post shows an alternative way that may be quicker. It also shows up all the frustration and problems I had in tempo mapping.

I found that creating new tempos did not work intuitively and it seemed to add extra bars and knocked out the markers and timing for no particular reason.etc. etc. etc. The designers of Reaper have made a complete arse of something that should be so simple.

Reaper has a neat facility that inserts a tempo change for a section of music bounded by two ordinary markers. You are able to specify the time signature and number of bars and it calculates the tempo and adjust the beats grid for the region.

The reasons for doing this are :

  1. In score writing, markers are placed at points of interest e.g. a scene change. You may want the first bar to start here and the music to end on the next marker. You want an integral number of bars to fill the gap.
  2. You want to synchronise a recorded track (MIDI or Audio) to a fixed tempo.
  3. You want to clean up some freely recorded keyboard playing by locating markers at the start of each bar. Once every thing is bar wise it can be quantised with reference to the beats grid.
  4. You may need to mix time signatures. e.g 5 bars of 4/4, 3 bars of 3/4.

To do this manually :

  1. Double click at the track headings between two markers. This will set a time selection exactly between the markers.
  2. Right click and select “Create measure from time selection (detect tempo)
  3. A dialog allows you to enter the time signature and number of bars required.
  4. A tempo change is inserted and the grid is changed to accomodate the necessary bars.

But don’t expect this to work if you haven’t changed the timebase – see later !!!!

 

The following shows a process to tempo map both MIDI and WAV tracks.

 

Firstly, I recorded a MIDI track of an oom-pah-pah piano with deliberate speeding up and slowing down. The start of the oom shows as a long low note and it does not line up with the underlying grid.

Although oom-pah-pah is technically 3/4 time, I am going to assume it is in 4/4 time. i.e. I want the start of the oom to be the start of a bar and for there to be 4 beats before the next oom.

 

I then generated a audio (WAV) track from the MIDI and this is shown as the second track. Notice how the MIDI and WAV align together

 

 

I then played the tracks from the beginning and pressed the “M” key at the start of each bar. This generated a marker (the vertical red line) at the start of each bar. I then made small adjustments to align the marker with the start of the oom.

 

 

I then went to the project settings and set the Timebase to “TIME”. This is necessary to switch off any automatic time stretching when the grid is changed.

 

 

I also created two useful Actions and linked them to the Alt-F12 and Alt-F11. In Reaper you are able to create custom actions that contain a list of the in-built system actions.

 

The first action sets up a time selection between two adjacent markers at the current cursor. It then inserts a tempo change so that region selected occupies 1 bar and is divided into 4 beats. (note that the default is 4 beats, this can be changed by doing the action manually and entering the correct info in the displayed dialog box)

 

The second action selects all the tracks and splits the tracks at the marker positions. I found that if the MIDI track was not split it was not possible to change tempos independently.

 

 

This action really caused me a headache !! You have to “Ignore project tempo” for MIDI tracks. Why is this here ?? Surely the midi track should obey all tempo changes at all times. Surely the project tempo is a tempo change marker at the start of the project. The legend is confusing as well — if i tick the box does it ignore the project tempo and use a tempo of 120 bpm instead.

Select the MIDI track and select the Source Properties dialog from the Items menu.

 

 

I manually inserted a tempo change for the first bar to ensure the number of beats per bar (e.g. 3/4 4/4) was correct and the number of bars was 1.

I then put the cursor to the start of the project and pressed the Alt-F12 key to invoke my custom actions macro. This inserted tempo changes at each marker. You can see how the grid aligns to the markers for the actions carried out so far. The actual tempos are shown just below the marker text.

 

I then displayed the Master Track by right clicking in the left hand side of the track display. You can see that each tempo is displayed using a horizontal turquoise line.

 

I then pressed the Alt-F11 key to invoke my second action macro. This splits each track at the tempo change. This must be done for any tempo manipulations. Don’t know why but if you don’t do it you will get unexpected side effects. The tracks can be glued back together afterwards.

 

The aim is to be able to alter the tempo changes and have the tracks adjust automatically. e.g.

  • Remove all the points and have a constant tempo.
  • Make some bars have a constant tempos and others to have different tempos.
  • Make a tempo change gradually by drawing a tempo profile.
However, none of this is possible until the project settings are changed back to BEATs in the following dialog:-

 

 

 

Finally the tempo can be adjusted as shown below and the MIDI and WAV tracks are time stretched to fit exactly.

 

 

 

 

 

Fixing the touch screen on a Hannspree tablet

I have a Hannspree Android tablet with a 13.3″ screen. I use it to display sheet music when playing the piano. It is a very useful item. The screen is not quite A4 size but is adequate for lead sheets. I would prefer a larger screen with an E-ink display, but the latest offering is in excess of £600. My Hannspree tablet was £200 so I want to get the most out of it as it was purchased primarily for reading sheet music.

Unfortunately as with all consumer items, it has developed a serious fault. One day I discovered that the right hand of the screen was not responding to touch. During the course of the year the dead “column” became progressively wider and is now half the screen. It is becoming a bit difficult to operate. I wanted to fix it.

I wondered about the possible reasons for this failure. It could be a disconnection of a sensor wire to the screen, static damage to the detector, damage to fine wires embedded in the glass or maybe X rays from airport scanners. Tablet screens detect touch by change in capacitance. The sensors are embedded in the top glass that lays over the display and routed by a flexible printed cable to a microcontroller. The high impedance inputs to microcontrollers are susceptible to static damage and this is my number one suspect for the failure.

I have never looked inside a tablet before so i consulted some utube videos on how to take it apart. The tablet has a back panel that is secured by screws and plasticated internal catches. It is fairly easy to dismantle once you get the knack. I needed to fashion a special tool by taking a used credit card and sharpening one side to a knife edge using some sand paper.

There are two micro screws on the edge that houses all the electrical sockets. I used a spectacle screwdriver to remove these. If you look closely at the sockets you can see a hairline where the back panel joins the main body. You need to judiciously slide the plastic knife edge of the tool into this gap to lever the panel away. The internal catches are released when the knife edge slides passed them. You should not insert the tool too far in. Slide the tool all the way around the tablet edge to get the entire panel off. Note that the panel simply clicks back with a small amount of pressure around the edges.

Watch out for the plastic power button thats falls away.

Also remove an SD card if fitted before starting.

 

The photo shows the insides once the panel has been removed. The battery is mid centre and is soldered with two wires to the processor board on the right. This would be an easy item to replace. The cables are simply taped down with stcky tape.

The brown connector cable with micro-controller at the top right corner is the interface to the touch screen. The plastic printed cable is joined to the main processor board using a pinch connector. These have a plastic bar along the top. You lift the bar up using a fingernail to release the cable and the cable can be pulled out.

 

 

The next photo shows the touch screen controller in more detail. The controller connects to the touch screen using the top printed flexible cable and connects to the main processor board with the bottom printed flexible cable. The controller measures the touch sensor capcitance, sorts out the position information and communicates using a (SPI) serial bus. This is the beast that needs replacing.

I looked up the code numbers F-WGJi3308-V1 ILI2303 M1447 printed in white at the top on the Ali-Express website and got the following :-

Ali-Express is a chinese website that sources just about everything. I ordered the part for $40 and started to wait……………………………………………… and wait………………………………….

The replacement part arrived after a month and a day. It was well packed and in tact when I unwrapped it carefully. The replacement part is the entire touch screen glass, microcontroller and flexible cables assembly together with some double sided adhesive strips. It has two protective plastic films each side.

 

I took the back off the tablet and disconnected the old touch sensitve screen and connected the new one in its place. I then powered up and checked that the new screen was functional. I then disconnected it.

The touch sensitive screen is attached to the plastic frame using double sided adhesive tape. The hard bit is to persuade the screen to leave the plastic frame. I wanted to remove the glass panel in tact but it cracked halfway through. It is probably best to crack the screen in the first place.

However I gently prised the screen using a sharp knife at one corner and inserted a blade of tough, thin plastic between the frame and the glass. I then pulled and pushed it to release the glass. Once I had got a sizeable gap, I use a sharp knife to prise the glass away from the frame. I wore glasses during this in case the glass shattered and projected splinters into my eyes.

There are two loudspeaker grills that are held by the glass. These come loose and I stowed them safely away.

 

 

 

Most of the adhesive tape was attached to glass which I dumped. I used lighter fluid and tissue to clean residual parts of adhesive from the frame, as shown above. Note that the gap at the bottom right is to allow clearance to push the cable and micro-controller through.

 

I then cut the new adhesive strips to size and stuck them on the frame. The uppermost side is left covered by the backing paper. Note that a hole is needed where the camera is and the slot for cables needs to be uncovered.

The speaker grilles were then placed in position.

I then placed the new glass screen in position and checked that the cables could be threaded through OK and that it fitted the frame nicely. It was a good fit so I proceeded to do the sticking down.

 

It is a bit fiddly to manoeuvre the screen into position, so I partially uncovered the adhesive tape and bent the backing tape so that I could extract it with the glass more-or-less in position.

Before sticking down, I cleaned the LCD screen using a rag and methylated spirit. I also put the grilles in position and removed the glass protective film. Note that there are no second tries at doing this so everything must be right first time !!!

I positioned the screen,threaded the cable and micro-controller, pulled out the backing tapes and carefully set the glass into the frame at the edges. This went really smoothly.

I then turned the tablet over and re-connected the ribbon cable to  the processor card. I then put the back panel on the tablet and snapped it into place.

I powered on and the tablet was fixed !!!

 

I was really chuffed about this and this was £31 well spent. I had previously contacted Hannspree about getting it fixed and received NO REPLY from the toe-rags. I estimate that the time spent to fix this is about an hour so an honest repairer would probably charge about £80 to do the entire job including parts. I say honest as there are some toe-rags out there that would invent other things to fix and charge extra.

The tablet cost £200 so any repairs over £100 are probably not economic, such is our throwaway society but I think this repair was worth it. I now feel confident enough to repair mobile phones that have cracked screens.

 

Microphone Stand for Keyboard

I decided to update my Electronic Piano stand as the one I had was not very stable. I decided on “Stellar Labs 555-13830 Heavy Duty Keyboard Stand” at £36. This stand is very stable and easily takes the weight of my heavy piano keyboard. There are two bolts necessary to put it together using an Allan key. It has no adjustment for uneven floors and will require the use of a beermat to stop it from wobbling in this case. But I thought it was value for money.

It is a real nuisance using a traditional microphone stand when singing and playing, so I looked at an alternative solution. I bought the “Neewer Adjustable Microphone Suspension Boom Scissor Arm Stand” at £13 and figured out a way to fix it to my current keyboard setup. The stand is a bit on the flimsy side and I am not convinced that the bracket is strong enough when screwing in the round bit.

 

I made a bracket out of two pieces of wood and a steel strip. This attaches to the left support of the keyboard stand. I then affix the scissor mic stand to the bracket. The mic position is easily adjusted and remains in place. The bracket also allows for enough clearance for my left hand to reach the lowest notes.

 

The following photo shows the bracket and mic stand in position.

This photo is a closeup of the bracket attached to the keyboard stand. The steel strip wraps around the square section steel support on the keyboard stand. I made the bracket a snug fit and it can slide on or off for packing up. It is suprisingly firm and the mic stand does not wobble,

 

This is a photo of the bracket.

 

 

This is a photo of the bracket with the mic stand holder attached.

The final result looks a bit heath-robinson, but it is functional and an improvement on using a traditional mic stand.

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 }
var
count : integer;
onState : boolean;
byte_read : byte;
error : byte;

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

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

i := 0;
while p_count > 0 do
begin
dg := p_count mod 10;
digits[i] := dg + '0';
inc(i);
p_count := p_count div 10;
end;

for i := 5 downto 0 do
Soft_UART_Write(digits[i]);

Soft_UART_Write(13);
Soft_UART_Write(10);
end;
end;

begin
{ 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
Delay_ms(1000);
PORTA := $FF; //turn off LEDS
Delay_ms(1000);
PORTA := 0; //turn on LEDS
Delay_ms(1000);
PORTA := $FF; //turn off LEDS

Soft_UART_Init(PORTA,0,1,9600,true);
Soft_UART_Write('O');
Soft_UART_Write('p');
Soft_UART_Write('t');
Soft_UART_Write('o');
Soft_UART_Write(' ');
Soft_UART_Write('1');
Soft_UART_Write('.');
Soft_UART_Write('0');
Soft_UART_Write(13);
Soft_UART_Write(10);

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

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

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

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

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

inc(count);
end;

end.

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.

 

 

POST SCRIPT :–

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.

 

 

 

 

« Older Entries