# MIDI instrument dynamic control

#### jjj

Joined Feb 25, 2007
116
MIDI instruments sound robotic/ soulless; lacking dynamic variations.

I used to play the accordion for years and albeit I'm keen to enjoy MIDI instruments, so far their "dead" dynamics put me off...
For instance, I have got those great BigFish "Play the Tango" sound samples of each button of the bandoneon.
I also have got a 120-button accordion bass (box part only; i.e. without the bellow) wired to my Roland Synth D20. The problem now is: how to add volume variations, the way accordion/ bandoneon players do it with the bellow while playing the bass buttons?

Since my both hands are occupied playing buttons and keys, I have no hand free to vary the volume control (for vibrato and volume variations). Foot control is far too inaccurate for expressing rapid, accurate vibrato variations.
Since my 120-button accordion bass is attached to brackets on left side of the Synth, I was thinking of suspending it via gentle springs. Then only a lever to a volume control would be needed.
By shaking or pressing up & down the whole 120-button bass box I could vary the vibrato and volume rate as needed to add realism to any MIDI instrument.
Ordinary pots won't last; I suppose a mechanical/ electronic solution is what I'm after. Years ago, I saw a pedal from an Elka organ, which had a v-shaped slot through which a bulb light hit the LDR. Maybe there's a way of doing the same even more efficiently with special optocoupler? The volume variations have to be pretty responsive in order to create vibrato and attacks as applied by bandoneon (tango) players. I still have got an old PC-mouse, whose rubbered steel-ball often failed to drive the two little plastic wheels. If I'm not wrong this type of optocoupler might (?) be the answer.
Searching the Internet, I discovered that Yamaha built a breath controller (Model: BC3 ...sounds like a trani) for $80, but it requires yet another MIDI box. Price tag: with shipping & import duty$300+
Since I need only to control the soundcard's stereo output, DIY is my idea. Does anyone of you wise men have a clue how this BC3 breath controls works? I imagine, that it must be some type of fine, flexible plastic gate, flap or membrane, sensitive to slightest air movement, which controls the brightness of a light.

I guess, I'll have to experiment until I get one such gate logarithmically controlling light from a bulb/ LED to an LDR, which then controls another 2 bulbs/ LEDs with an LDR (each) to control the soundcard's stereo output.
In case it doesn't work out with breath control, I still can use it with the 120-bass box (as already described).

Any suggestions on that are "willkommen", for there might be even better/ shorter way to Rome...
of which I didn't think; 100 brains are better than 1

P.S. Anyone interested in the easiest method of playing MIDI music is invited to d/l my PDF instructions at: http://www.live-styler.de/home/Janko Project.pdf

I am grateful for your good advice on that idea. Now that I'm retired I have at last time to live out my dreams. jjj333 from Chile

#### mrmeval

Joined Jun 30, 2006
833
Hall effect sensor

#### thingmaker3

Joined May 16, 2005
5,084
I think MrMeval is on to something. You could experiment with different springs and steel weights to get the right trigger for that hall-effect sensor.

#### SgtWookie

Joined Jul 17, 2007
22,220
Hmm - Hall-effect sensors are available in both "on-off" and "field signal strength" versions. The former would not be very useable for your application. The output from the latter tends to be logarithmic, if I remember correctly - that might also be difficult to implement.

You may already know that a note-on MIDI command consists of three bytes; the first byte begins with binary "1001" and then the channel number, then "0" and the note number, then "0" and the velocity of the note. That 3rd byte is what you're after - unless you already have access to control via some other means.

Just a thought - do you know what a theremin is? It basically has two control inputs; volume and frequency, both activated by the proximity of the player's hands. You could use just the volume portion of a theremin's circuit to control the velocity input on your setup. That way you could manipulate your velocity by using an available body part; like the proximity of your knee.

#### jjj

Joined Feb 25, 2007
116
Hall Effect Sensor.
Thx for the head scratching kick to it.
So, all I have to do now is >>> finding out how they work and search for some circuit examples for it...
Yes, I'm really grateful for the hint, because without your hint my idea is like MIDI sound lacking dynamics!
Here I found a simple hall effect application. Is that what I could use?

Not quite sure how it works. As far I discovered it works with moving a little magnet to the hall effect sensor or visa versa. How do I connect the soundcard's outputs to it? Finally, how to make it work logarithmically?
Since I need only to control the soundcard's stereo output, I'm glad not to bother with MIDI control and that surely makes it less problematic.

#### jjj

Joined Feb 25, 2007
116
Greetings SgtWookie,

I found two Theremin circuits. The question is which circuit is better and which is the bit I'll need? The other problem is that I'll have to control the soundcard's two signals (stereo). The picture of circuit "cir2.gif" was too big and so, uploaded the 28Kb on Rapidshare.

http://rapidshare.com/files/82271637/cir2.gif.html

As long I know what to connect to what, I can solder the thing successfully together. The PS is no problem. With my 40 years of hobby electronics skills I built far more complex circuits; i.e. knowing everything & nothing! I guess, where the volume ctrl. ends is:
1) ...in the 1st circuit, where the volume control's output is. 2) ...in the 2nd circuit, before pin 8 goes to 8038.

So how does it work? Is it that the volume control output swings between +15V/-15V/OV? How does it attenuate the soundcard's stereo output? How can I control the input without using hand, foot (or knee) but rather via a DIY breath controller with a sensitive gate/ flap or a membrane? Like the foot, the knee isn't accurate enough to modulate tremolo & fast volume changes. It surely will modulate my knee's arthritis!

Actually, all I need is a sensor, which senses the approximation of a magnet or metal etc. and translates it to bulb/LED intensity, which then shines/modulates an LDR. The problem is to get this sensor operate over the whole volume range via an approximation path of of max. half inch. As mentioned, since I need only to control the soundcard's stereo output, I'm glad not to bother with MIDI control and that surely makes it less problematic.

#### SgtWookie

Joined Jul 17, 2007
22,220
Actually, I was reading back to the beginning of this thread, and thinking that perhaps I was overcomplicating the matter. Mounting your keyboard on springs may not be such a bad idea - but it sort of depends upon how heavy it is, and how much volume control you wish to exert.

What I'm thinking now is something much more simple than the theremin interface; simply using an LED or laser to illuminate a phototransistor or Cds (light sensitive resistor). Moving the light around would change the conductivity of either. The phototransistor would have much more rapid response than the Cds.

The output of that relatively simple circuit could be used to control the gain of a pair of operational amplifiers, through which the output of your stereo card would pass. I'll have to think a bit more on this, but I'm a little tired after working all day.

This would enable you to add a bit more musical expression - but I'm wondering; your Roland D20 has a velocity-sensitive keyboard, and thus should recognize velocity inputs from a MIDI file (unless they were input player-piano style.) If your 120-button accordion bass is General MIDI compatible, you likely could use your D20 as a controller for it.

I have a Roland U20; similar vintage but very different machines. Mine is a sample player and is not General Midi compliant (it doesn't have all of the sounds required for General Midi, and the ones that are present are in different places) where yours is a true synthesizer.

Your keyboard should also have a "pitch bender"; if your accordion base could be set up to recognize those commands, or the D20 set up to send the commands to the accordion base...

Simply controlling the volume output of the sound card won't give you as much control as MIDI commands would - if your hardware is compatible. Besides simply volume, you have attack, sustain, decay, vibrato frequency, vibrato depth, vibrato delay, etc ad nauseum.

Do you have the documentation on your 120-button accordion bass and your D20? If not, it may be available on the Web. Who made your 120-button accordion bass and what model is it?

#### jjj

Joined Feb 25, 2007
116
Yes, Roland D20 has a velocity-sensitive keyboard, pitch bender and the lot. Controlling the volume output of the sound card equals the volume changes accordion/ bandoneon players generate with bellow manipulation. Most natural music instruments, such as all wind & string instruments, mainly rely on this kind of volume and tremolo variations. Of course the range is decisive.
My Synth seems only apply a limited range. Albeit a MIDI controller can alter the range etc., I still would need to apply tremolo variations manually. Thus, control by breath or as described is required.
I have got the service manual from my Synth w/circuits etc. The 120-button bass is from an old electronic Farfisa accordion. I customized it by separating all six rows of buttons so, that each button has it's own (silver spring) contact. All 120 buttons/ contacts than touch 12V busbars to activate basses & chords, which I wired up via diodes & 4066 quad-switches. The tunes taken from the Synth's keyboard. The Synth has two contacts for each key (for t.-sensitivity), but I only wired one contact for each of the 120 buttons accompaniment. Thus, MIDI control won't control t. sensitivity of the latter. I still got unique steel spring contact wire with silver alloy plating from a German Dr. Boehm organ kit, which I build almost 50 years ago (!) With that I can build my own contacts. That might serve another poor, musical bugger (like me)...

You were quite spot on! Googling day & night, I finally discovered the innards of Yamaha BC3: http://www.freepatentsonline.com/5189240.html
i) Yamaha BC3 breath controller comprises a box member having an air chamber communicated to a mouth piece; a permanent magnet fixed to a elastic member, this combination of which is attached in the box member to receive the blowing pressure from mouth piece; and a hall element facing the permanent magnet. Accordingly, when a player blows the air into the air chamber, both the elastic member and permanent magnet are deformed by the blowing pressure to change the distance between the permanent magnet and the hall element, so that the hall element generates a voltage signal which is changed in respect to the blowing air pressure.
However, the voltage signal is not stable in case of such construction, therefore it is difficult to adjust the voltage signal for maintaining an operating level. A multi-stage amplifier is required to obtain a wide range of the operating level so that a very small voltage is generated from the hall element, while it is required that this amplifier must be a high sensitivity (S/N ratio).

ii) an elastic diaphragm coupled to the air chamber and having a light reflection surface coated with a light reflecting material, said surface being positioned relative to the air chamber so as to be displaced by the pressure of blowing into the mouth piece, wherein the elastic member comprises a diaphragm having a circular ridge, and the reflection surface is surrounded by the circular ridge; an infrared light-emitting element for emitting infrared light onto the reflection surface; a phototransistor for receiving reflected infrared light from the reflection surface and for outputting an analog signal, the magnitude of which corresponds to the amount of received reflected light, said phototransistor being positioned relative to the light reflection surface of the diaphragm so that the amount of light received from the diaphragm reflection surface and the magnitude of the corresponding phototransistor analog output signal vary in response to the displacement of the reflection surface by the blowing pressure; an analog to digital converter for converting the analog output of the phototransistor to a digital signal; a digital musical tone generator for generating a musical tone in response to a digital input signal; and a characteristic converter coupled to the output of the analog to digital converter and to the input of the tone generator, for adjusting the digital signal output of the analog to digital converter to a digital input signal which is appropriate for the digital musical tone generator in accordance with the characteristics of the musical tone generator.

As "elastic member" I could use a piece of condom rubber and with silicon glue attach a small magnet. Using an good Op-Amp, such as NE5534 I would get a variable V range, but how then to regulate the soundcard's stereo output with it?? Thus, using photo transistor and LED/laser would even work better than Yamaha's BC3. You reckon the elastic membrane idea is (lasting) the thing to use or how else could I gate/ vary the light's brightness?

Well, if the project works out, I'll add it to my "Janko Project", mentioning your assistance and this forum, if you allow?

#### FredM

Joined Dec 27, 2005
124
Capacitive sensing can do this job - Cypress PSoC parts with CapSense can easily implement a proximity detector, and one of the digital blocks can be configured as a TX8 to output MIDI data directly - This is far easier than using the theremin method which produces a frequency output proportional to capacitance.. and it is a lot cheaper!
I am in the 'final' stages o prototyping a MIDI theremin - (when I say final stages,it sometimes means a few months yet..) - I have developed a 8 pin PSoC which incorperates the relaxation oscillator, digital blocks, and output stage (which can be voltage, PWM, or serial data) as a general purpose capacitive proximity detector - it is self-calibrating, and can be programmed to give various distance -> output profiles (Can for example give exponential compensated output so that distance directly relates to equally tempered pitch). This PSoC does not use Cypress CapSense - I have implemented my own method which gives 14 bit resolution.
Drop me a line, and I will send you updates as this progresses.

#### SgtWookie

Joined Jul 17, 2007
22,220
OK, I'm getting a better picture of what you have available.

Tell me, does your accordion bass have a pitch adjust; ie "master tune" that affects the fine tuning of the entire instrument? Is it digital, analog?

I'm asking because tremolo aka vibrato is more than simply varying the volume level at a sinusoidal rate; it's also slightly varying the pitch of the note(s), even in supposedly "fixed frequency" instruments like accordians or harmonicas that have fixed-length reeds in them. I'm afraid that simply varying the volume level would result in a very artificial-sounding tremolo/vibrato.

Back to your volume control idea, here's a somewhat expanded concept:
The light from an LED or laser is reflected from a membrane surface, such as your condom idea or surgical grade rubber, onto a phototransistor's lens. The phototransistor controls the voltage supplied to a 7 or 8-bit ADC (Analog to Digital Converter). This ADC could be a part of a microcontroller, such as a PIC.

The outputs of the ADC are connected to drive two 4066 analog switch ICs that control a binary-weighted ladder of resistance (per channel) that control the feedback path (- input) for the operational amplifiers.

With zero resistance on the + input and zero resistance from the - input to the output of an op amp, the gain is unity (that is, what you put in is what you get out!) By increasing the resistance of the negative feedback path of the op amp, the less the output is attenuated; ie: the signal output of the op amp is increased.

It may be possible to affect your master tune of your bass in the same manner.

While it may seem to be "a hassle" to use an ADC to control 4066's, this opens up the possibility of eventually controlling the volume via MIDI commands (!) since 7 bits corresponds directly to the 0-127 volume data.

Is this making sense to you so far?

I've attached a .jpg conceptual schematic, several items are missing. The tool I used to generate the schmatic didn't have 4066's in it, so I used a different analog switch; the idea is the same though. Only one channel of volume control shown for simplicity's sake. Everything past the ADC would have to be replicated for additional channels.

I selected an LT1057 low-noise JFET-input dual op amp because it doesn't exhibit phase reversal such as a TL72, LF353 et cetera might.

#### Attachments

• 49.2 KB Views: 51

#### jjj

Joined Feb 25, 2007
116
Hi FredM,

Thx for the help. Your project is too hard for me to follow. My electronics skills are rather basic. I find it impossible to be good at everything! Forgive me!

SgtWookie,

The bass box has no pitch adjust/master tune, because it's just working in parallel with the keyboard's lower octave keys. The Synth has all that.

i) The harder an accordion player presses/pulls the bellow, the more air is forced through the reeds and that makes the accordion merely sound louder; i.e. no pitch changes come into play.

ii) When the bellow is shaken/ chuckled at various rates and volume levels, various degrees of volume fluctuations result, which I call "tremolo"; i.e. again, no pitch changes come into play. Agreed, it's vital to sort that out.

Thus, the breath controller will create the same result; if not better.
In this case vibrato etc. is undesirable. Hence, this insight enables us to go for the easier option of LED & phototransistor, I suggest.
Maybe there's better way of regulating the light brightness than using a rubber diaphragm. Reflecting light is not a bad idea...

#### SgtWookie

Joined Jul 17, 2007
22,220
OK, have a look at the schematic I posted in my prior post - see if you understand where I'm going with it.

#### jjj

Joined Feb 25, 2007
116
Great job! Very professional, indeed!
Only how it works was missing...
Here's my guess work:
The light proportionally activates PH-transistor the analog signal is then converted into digital data, which is then switched (Quad SPST Switch) to deliver the desired output. I only hope that the output is smooth like a Vol Pot; not hacked (?)

I have quite a few sticks of ICs. Lots of OpAmp and MOS. Also dozens of 4066/4016 - I'm amazed that the circuit has to be that complex. I suppose I'll have to order these parts from overseas, because here they only got stones.

#### SgtWookie

Joined Jul 17, 2007
22,220
LOLOL!! Well, from stones comes sand, and from sand comes silicon... it's "roll your own" semiconductor time

You guessed correctly on the theory - good job The analog switches will connect the various resistors into the feedback path of the op amp, changing the amount of attenuation supplied to the output signal. I'm going to have to double check my logic on it.

As I suggested in that post, using the ADC to create a range of binary steps can eventually lead to interfacing your volume control with MIDI commands that you can send from your sequencer or when you're using your keyboard as a controller. We're not going there yet, however.

I just threw that schematic together in a few minutes, it hasn't been checked for errors or anything yet; it was just to get the basic concept down.

A couple of glaring omissions are the lack of Vref inputs for the ADC, and the fact that the MSB of the ADC output is disconnected. I'm still debating whether it would be better to allow finer control of the volume using all 8 bits, or be consistent with MIDI, should you decide to expand on the thing later on.

It's always nice to have an easy upgrade path, rather than have to tear things apart and start over.

#### jjj

Joined Feb 25, 2007
116
To be honest, I'm not really keen on going into MIDI implementations, because (as mentioned) the 120-button bass box hasn't touch sensitivity and I don't know a thing about MIDI. If I really need it later on I can buy a MIDI control box.
Does the circuit has to that complex? How about just having the LED, Ph-transistor and a transistor to amplify the PH-transistor, which then drives another LED/ bulb regulate an LDR. Unless the LDR would be too slow. Maybe there exist a faster LDR? Just a thought... sorry about that, but I'm addicted to lateral thoughts.

Here I only need a sensitive, smooth breath controller to control volume variations and so, adding dynamics to my performance.
Beside... did you check out my twittering to music? http://www.live-styler.de/home/images/jjj-DEMO.wma
Chances are that you might like what you hear... hopefully!

#### jjj

Joined Feb 25, 2007
116
Hi SgtWookie,
Since you ran out of puff... I had no alternative than to apply my belief: "Help yourself, so helps you God!" Because if I don't the good Lord wouldn't even kick me to it! My persistent googling got me there! Look what I found... a (universal) Morley stereo volume pedal with LDR & lamp. That seems to be the answer to my prayers. Please put me right in case this circuit mightn't be what I need or maybe you know how to improve its performance. Far less work/ easier to amend the circuit than to create it:

Instead of the piston, a rubber membrane (cut from a condom) could push the slider (using silicon).