Saturday, March 19, 2016

Digitizing Grandpa's Reel to Reel Tapes

My grandfather had a bunch of these reel to reel tapes from the 60's.  I thought it would be a good idea to digitize them to preserve the audio incase the tape began to deteriorate.  Conveniently enough, my aunt gave me this reel to reel player a few months ago.  I should have everything I need to manually transfer these audio tapes into digital format now.

But, there are quite a few of these tape reels, and my mind wanders.  I wonder if I could make this a semi automatic process.  The primary benefit would be that I don't have to be present during the entire recording process.  Of secondary benefit, I get to play with electronics.

I want to be able to set a tape playing and the recording program will automatically stop the recording when the reel to reel player stops playing.  Without automatic stopping of the recording, I am certain I would forget that I am recording and wander off to do something else while Audacity dutifully records silence at the end of each tape.

So, here is the setup.  To get the audio into the computer I made a 1/4" phono plug to 1/8" phono plug cable.  This cable runs from the reel to reel headphone jack to the computer's microphone input.  I am running a program called Audacity on this computer to handle the recording of the audio signal.



Like many programs, Audacity has keyboard shortcuts.  Press SHIFT + R to start/append a recording.  The spacebar will stop a recording.  Sending CTRL + SHIFT + E will open the audio export window.  All of these commands can be sent to Audacity with a keyboard, but we are trying to automate, so our commands will come from an ATMega32U4 microcontroller instead.


To know when the reel to reel player is playing, and thus when to have the microcontroller tell Audacity to start recording, I connected a Light Detecting Resistor along with a fixed value resistor to form a voltage divider.  The output of the divider is wired to the ADC on the ATMega32U4  uC.


The LDR ( Light Detecting Resistor ) is taped with blue painter's tape to the VU meter face.  The voltage from this divider circuit is read into the uC and compared to a threshold.  When the reel to reel is running, the VU meter turns on a tiny incandescent bulb inside.  The LDR voltage divider provides a high voltage when it sees light ( reel to reel is running ) and a low voltage when it sees little or no light ( reel to reel stopped ).


Operation:

Initially the reel to reel is stopped and a reel is loaded.  A new Audacity window is opened up by the operator.  As soon as the reel to reel starts playing, the VU meter lamp in the reel to reel turns ON, and the microcontroller detects the LDR voltage.  The uC then sends the keyboard shortcut SHIFT + R via USB to start Audacity recording.  I am now free to do other tasks without worrying about missing the end of the reel to press "stop" recording.

When the tape reaches the end of its run, the reel to reel will shut off, the VU meter will go dark, and the uC will send out ASCII 0x20 for a spacebar command.  This will stop the recording.  

Then the uC sends out CTRL + SHIFT + E to open the audio export path dialog box.  Here, everything will wait until I am available again.  At which point I enter a suitable filename to save the recording, and setup the process for the next side of the tape.

Conclusion:

I have now digitized both sides of one tape.  Everything went smoothly for the first side.

On the second side, however there was a small problem.  The screen saver came on.  When the recording was finished, the uC sent out the spacebar command to stop the recording.  Instead of stopping the recording the screensaver consumed this keypress and woke up, so the recording didnt stop.  Fortunately, I caught this problem early and have disabled the screensaver for the duration of this project.

An alternative solution to this problem could be to send a keypress that Audacity does not recognize before sending the STOP recording shortcut.  The first keypress would cancel the screensaver, then the spacebar keypress could stop the recording.  If the screensaver was not on, the first keypress is benign and only the spacebar command will be acted upon.

Here is a short sample of some of the audio I captured while setting up this system.  It ends abruptly because I was just testing the start/stop commands from the uC:
https://drive.google.com/file/d/0B1CPUkh94AtmcHR3OGNmQkMwc0k/view?usp=sharing

Let me know if you have success digitizing some reel to reel tapes using this method or perhaps you have a different method?

Microcontroller Code:
// running on an arduino pro micro

#include 

int ledPin = 17;    // Onboard the arduino pro micro
int ldrPin = A0;    // light Detecting Resistor input

int adcRaw = 0;

#define OFF_THRESHOLD 512
#define HYSTERESIS 25

#define KEY_LEFT_CTRL  0x80
#define KEY_LEFT_SHIFT 0x81
#define KEY_LEFT_ALT   0x82
#define KEY_LEFT_GUI   0x83
#define KEY_RIGHT_CTRL 0x84
#define KEY_RIGHT_SHIFT    0x85
#define KEY_RIGHT_ALT  0x86
#define KEY_RIGHT_GUI  0x87

#define KEY_UP_ARROW   0xDA
#define KEY_DOWN_ARROW 0xD9
#define KEY_LEFT_ARROW 0xD8
#define KEY_RIGHT_ARROW    0xD7
#define KEY_BACKSPACE  0xB2
#define KEY_TAB        0xB3
#define KEY_RETURN 0xB0
#define KEY_ESC        0xB1
#define KEY_INSERT 0xD1
#define KEY_DELETE 0xD4
#define KEY_PAGE_UP    0xD3
#define KEY_PAGE_DOWN  0xD6
#define KEY_HOME   0xD2
#define KEY_END        0xD5
#define KEY_CAPS_LOCK  0xC1
#define KEY_F1     0xC2
#define KEY_F2     0xC3
#define KEY_F3     0xC4
#define KEY_F4     0xC5
#define KEY_F5     0xC6
#define KEY_F6     0xC7
#define KEY_F7     0xC8
#define KEY_F8     0xC9
#define KEY_F9     0xCA
#define KEY_F10        0xCB
#define KEY_F11        0xCC
#define KEY_F12        0xCD

int ledToggleCounter = 1;

void setup()
{

  Serial.begin(9600);
  
  pinMode(ledPin, OUTPUT); // onboard LED

  
}


void loop()
{


adcRaw = analogRead(ldrPin);

// if the player is ON
if( adcRaw > OFF_THRESHOLD + HYSTERESIS ){
  
  ++ledToggleCounter;
}
else if( adcRaw < OFF_THRESHOLD - HYSTERESIS )
{
  // player is off
  //digitalWrite( ledPin, HIGH);

  delay(1000); // Wait a bit to make sure the reel to reel is really off.

  // If the signal is still low.
  if( adcRaw < OFF_THRESHOLD - HYSTERESIS ){
    
    Keyboard.write(0x20); // Send the spacebar to stop the audacity recording
    delay(500);
    Keyboard.press(KEY_LEFT_CTRL);  // Send CTRL + SHIFT + E to export the audio
    delay(100);                     // Audacity will wait for a filename to be manually input.
    Keyboard.press(KEY_LEFT_SHIFT);
    delay(100);
    Keyboard.write('e');
    Keyboard.release(KEY_LEFT_CTRL);
    Keyboard.release(KEY_LEFT_SHIFT); // CTRL + SHIFT + E complete. 

    // Stay here  until the reel to reel turns on again
    while(analogRead(ldrPin) < OFF_THRESHOLD ){
      // Blink fast because we are stopped.
      digitalWrite( ledPin, !(digitalRead(ledPin)));
      delay(200);
    }
    
    // The reel to reel has turned ON! Start recording.
    Keyboard.press(KEY_LEFT_SHIFT);   // Send SHIFT + R to Start/Append the audacity recording.
    delay(100);
    Keyboard.write('r');
    Keyboard.release(KEY_LEFT_SHIFT);
  }
  

}
else{
  digitalWrite( ledPin, LOW);
  }

  // toggle the LED at 2 Hzbecause we are recording.
  if( ledToggleCounter % 10 == 0 ){
    digitalWrite( ledPin, !(digitalRead(ledPin)));
    ledToggleCounter = 0;
  }

  Serial.println(analogRead(ldrPin));
delay(100);

  
}



Friday, March 18, 2016

tgimboej

tgimboej is an acronym for The Great Internet Migratory Box Of Electronics Junk, which is pretty much what it sounds like.  You can sign up to receive one of the boxes; participation is free - you just have to pay to ship the box to the next person.  When you receive the box, you can take out a few bits, and put some back in before sending it to another recipient.

You can read more here: http://tgimboej.org/Main_Page

They say one man's trash is another's treasure, but that doesn't really apply here.  I found the components in the box of very high quality.  I was quite pleased with the selection.  I even found an immediate use for one of the switches I acquired!

Here is a photo of the bits I took.


As you can see I got some sweet switches, a stepper motor, some gear motors, an audio jack, binding posts, SMD to PTH adapters, perf board, a piezo buzzer, and a key switch.  Thank you to the donors!

Here are some photos of some of the things I added.






I hope you will sign up.  It was a rather fun experience.

Saturday, May 30, 2015

A GUI Makeover

I've been wanting to play around with a different look for this blog for a while now.  I thought the previous layout looked a bit passé.  I also didn't like the color scheme for unclicked hyperlinks vs clicked hyperlinks; they were hard to read and not distinct enough to be useful.

And, so I made a few changes.  It was a painful process; I don't consider myself to have an eye for the artistic.  Basically, I just poked around at color schemes and backgrounds for an hour until I got bored.

This new layout is definitively different and subjectively more satisfying to the eye.  Below is a pic of the old layout so that you can be the judge.




Ok, so I just checked the preview of this post before...posting, and I have to laugh a bit.  I guess the new and the old look are not as contradistinctive as I had led myself to believe.  We'll keep it anyhow.