MIDI-to-variable resistance and/or individual controller key switches?

I'm not very familiar with Arduino and what software is out there. Was hoping someone might know if this was feasible and/or the software available.

I want to make a keyboard controlled tape sampler very similar to the one in this video:

The primary difference is that I want it to be a MIDI unit.

So far as I can tell from the description and some of the OP's responses to questions, it looks like he's taken the variable resistor that was between the cassette player's power source and the cassette spindle(?) motor, and split it out to every single key, run in parallel. Each key is paired with a variable resistor which is "tuned" (in a musical sense, not an electronics sense) to correlate to the appropriate play speed to return the desired note.

If the tape has a middle C flying RC toy on it, the resistor in line with middle C results in the cassette motor running at normal speed, the resistor on the C an octave below is set to run the motor at half speed, the C and octave above middle C plays to tape at double speed, and so on.

From what I have figured out, I need software that would facilitate an Arduino circuit either:

  1. Ingesting MIDI and outputting variable resistance that I can tweak to dial in the right cassette motor speed for each note.

  2. Ingesting MIDI and outputting a on-off "switch" input and output for each note (note, if it can be subject to the octave setting on my MIDI controller; key, if if not) that I can run into variable resistor that I will dial in for each note.

Thoughts? Is there already software out there that can do this? Is this even possible? Can you build this? Do you know someone who can?

(Also, I haven't quite figured out where in the circuit the capacitor is going to affect the portamento and/or how I could make that happen variably in my circuit--I should google capacitive potentiometers... If you know, please speak up!)

You can probably avoid a lot of complexity by using a PWM output to drive the cassette motor speed directly. You can get 256 different notes that way although how many will be in tune is anyone's guess. If you need more control you can use Timer1 to generate 16-bit PWM to get over 65000 notes. You could then glide between notes at any speed you like.

Timer1 has two PWM output pins so you can do two-note polyphonic if you have a second cassette player. :slight_smile:

You could add semi-automatic tuning: tune a few of the notes with a pitch-bend knob and have a button to set that note. Set a few across the scale and the instrument should be able to pick out values for the notes in between.

Sounds like a keen project. Let me know if you need any programming help.

Man, I'll gladly accept any programming help you'll offer.

So...is there an Arduino kit that can output PWM? Or is there a component I need to get to add to a particular Arduino board?

I have no idea what sort of software I would need to encode MIDI into PMW, nor what frequency would be needed to translate to the appropriate voltage for each note. Is that something you could help me figure out? Or point me toward resources where I could learn how?

Any arduino can output pwm. You will have to tweak with the filtering and drive circuit though. The arduino cannot drive a motor directly.
Another solution would be using an external DAC and some drive circuitry. It will give you more precision and faster response.
The software in both cases would be rather simple. Decode the midi and map the note value to a voltage or pwm value. Since the relationship almost certainly is non linear i would use an array for this

This article shows how to set up 16-bit PWM on Timer1:
http://www.ofrecordings.com/2014/03/16/how-to-set-up-16-bit-pwm-with-an-arduino-uno-atmega328/

That uses OCR1A (Output Compare Register A for Timer1) to set how long into each cycle to turn off Pin 9. You will get 244 updates per second which should be plenty. With a few changes you can also enable OCR1B to get a PWM signal on Pin 10 for a second cassette player.

To drive the motor you will need an NPN bipolar or N-Channel MOSFET transistor. The transistor goes between the motor and Ground. The PWM signal turns the power on and off 244 times a second at an adjustable duty cycle. If the power is mostly ON the motor runs fast. If the power is mostly OFF the motor runs slow. The transistor will allow the Arduino to control both higher current (more than the 30 mA the pin can supply) and higher voltage (more than the 5V the pin can supply).

I had another look at the video. It puzzled me how quick an accurate the reaction of the motor was. I remember many cassette players having a TDA 7274 or similar to control motor speed. It is quite possible that the circuit in the video manipulates this chip.

johnwasser:
This article shows how to set up 16-bit PWM on Timer1:
http://www.ofrecordings.com/2014/03/16/how-to-set-up-16-bit-pwm-with-an-arduino-uno-atmega328/

That uses OCR1A (Output Compare Register A for Timer1) to set how long into each cycle to turn off Pin 9. You will get 244 updates per second which should be plenty. With a few changes you can also enable OCR1B to get a PWM signal on Pin 10 for a second cassette player.

To drive the motor you will need an NPN bipolar or N-Channel MOSFET transistor. The transistor goes between the motor and Ground. The PWM signal turns the power on and off 244 times a second at an adjustable duty cycle. If the power is mostly ON the motor runs fast. If the power is mostly OFF the motor runs slow. The transistor will allow the Arduino to control both higher current (more than the 30 mA the pin can supply) and higher voltage (more than the 5V the pin can supply).

Wow, I am really over my head, here. I totally understand the mechanics of how the power affects the motor speed, etc. It's all the "how" that I'm completely lost on. I'd really like to understand how to make this work, but I feel I'm missing some foundational understandings that are making me completely miss certain terms and concepts.

Do you do commission work? :smiley:

I've got a buddy who will help me code the software, but I'm still at a loss for quite what hardware specifically I will need for this.

He says once I have that, he'll know what firmware it has and stuff, then I can figure out what voltage makes the tape run at normal speed.

Does it seem like I'm on the right track? What should my next steps be?

I don't expect the cassette player has much firmware.

There are lots of examples and tutorials for doing MIDI input (and output) on an Arduino. That part should be relatively easy.

Sorry, I meant the firmware on whatever Arduino kit I buy. Any advice on that?

I recommend the Arduino UNO. It has all the features you need and is the most common model making it easy to get help and examples that work.

If you look at the video and how fast it get to pitch i am sure that any unfiltered pwm that is in the audible range will cause some modulation effects.
The TDA 7247 acts as a regulator using the motors back emf for speed control which is probably the reason for the performance in the video.

Nilton, I'm unclear on what you are saying. Is the TDA an alternative you are suggesting to the Arduino UNO, or a component in the original video circuit?

John, thank you so much for your help! I'll keep this thread updated with the project progress. I plan to write up the build with photos as a DIY once I'm done.

The TDA 7274 is an IC used in many cassette players to stabilize motor speed. It uses the motors back-emf in order to measure and regulate the speed. The setpoint is adjusted by varying a resistance.

Simply adjusting motor voltage will not give you the results you are expecting i believe.

EDIT: I found This. If you scroll down to Analogue Speed Controller with Negative Resistance you could use that circuit with voltage control.

Thank you very much for you input, nilton. I'm really struggling to keep a cursory grasp on what all this means, though, as the concepts and terms are well beyond my level of electronics familiarity. Would this circumvent the need for the Arduino UNO or supplement it?

John, what is your take on this line of thought?

I will reiterate, while I'd love to figure out how to design and build this part of the circuit myself, I really would not be opposed to hiring someone to do it. I can handle the housing, the audio outputs, etc., but I think the actual MIDI-to-tape speed aspect is outside my abilities at present. I have a tape player, can provide voltage/resistance measurements where necessary, and can pay via Paypal.

If you go for the circuit mentioned you can use a arduino to receive and decode the midi messages and map them into values that can be sent out to a dac. As i stated before i believe that using pwm without filtering will cuase modulation of the motor speed.

Got my Arduino, power supply, and multimeter ordered!

Thanks guys. I'll keep this thread updated.

Alright, I'm all set up to get going on this build, but I have no idea how to get started with the coding part. I also don't quite understand how the PWM output will need to be handled so I can't plan that part of the circuit.

Can anyone lend a hand, proffer their services, and/or point to me toward a tutorial(s) that will get me that specific coding-oriented knowledge I'll need for this build?

I have zero coding experience beyond writing some simple games on my TI-83 in high school, but I'm an IT analyst and a quick learn. Plus I really want to make this, so I'm willing to put in the work to figure it out or pay someone to help me. :slight_smile:

The first step is learning to control the capstan speed on the cassette player:

The second step is receiving MIDI note data.

Once you have both of those working you can ask for more advice.

johnwasser:
The first step is learning to control the capstan speed on the cassette player:
How to Control the Speed of a DC Motor with the Arduino - dummies

As i stated before the speed of the capstan motor is not controlled by motor voltage directly but by a mechanism using the motors back emf to control speed. This is true even for very simple cassette machines