Highly Liquid Forum facebook twitter google plus rss feed

Go Back   Highly Liquid Forum > Current Products > MIDI CPU

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-31-2012, 11:11 PM
John's Avatar
John John is offline
Moderator
 
Join Date: Jan 2009
Posts: 3,007
Default Potentiometer input, continuous note output with restricted note range

R. writes:

Quote:
I want to do something I "think" is simple . I have the midiCPU working and responding from a 10K pot feeding input 16 - it triggers an E. I want a scale of notes.

- I do have a sysex platform for programming the midiCPU............, but do not know how to specify to /change the midiCPU via sysex to make a certain analog input [say #16) that is ref'ed to the onboard V+ make a continuous stream of notes, - let's say over 2 octaves? My setup is simple - I have a slide pot, 10K, and want to go from low (near 0V) notes to high note (+5) , for instance-

Can you please give a code example // explain parameters? The manual isn't doing it for me.
[ meaning - how to turn on continuous mode in software, note range (if possible), otherwise, I guess sliding through notes 0-127 will do, and maybe channel].

If a range set is not possible, I can do limiting via hardware (top and bottom of pot fixed resistors), and can change direction of pot easy enough as well. (for note high to low)
Ok. The setup for getting a continuous stream of notes from a potentiometer:

In addition to the control terminal connected to the potentiometer, you must have a control terminal set up as a logic input. The connected switch will act as the "gate" for the stream of notes.

Assuming that the pot is on CT 16 and the gate switch is on CT 17, the configuration sysex looks like this:

Code:
// Header
F0 00 01 5D 04 01
// Layer 0
00

// CT 16: analog input, continuous note, velocity 127 (7Fh)
10 00 00 00 00 7F

// CT 17: logic input, analog continuous note start/stop for CT #16 (10h)
11 00 68 00 10 00
11 01 69 00 10 00

// Footer
F7
The gate switch simply connects CT 17 to ground to start the generation of notes. If the gate functionality is not needed, simply tie CT 17 directly to ground.

Now, for limiting the note range.

Starting with firmware version 1.3 (get the latest firmware update here), we can restrict the range of values associated with the potentiometer on CT #16. The sysex message to do this is the "data register configuration sysex message":

Code:
// Header
F0 00 01 5D 04 04

// nn ii mn mx rr
// nn: data register 03h (03h is the data register for analog input on CT 16)
// ii: initial value 60 (3Ch)
// mn: minimum 48 (30h)
// mx: maximum 72 (48h)
// rr: round robin off (00h) --ignored for analog inputs
03 3C 30 48 00

// Footer
F7
For the above, I arbitrarily chose a 2-octave range beginning and ending with note C. For reference, a list of MIDI note numbers can be found here.

One problem with the setup above is that the potentiometer will have a "dead zone" at either end of its range of travel. In other words, the MIDI CPU does not use the register min/max values as a way of "stretching" the limited data range to fit the entire travel of the pot. So, to make the full travel of the pot correspond to the limited range of note values, you should also use hardware voltage limiting, as you suggest.

There is another possibility, which is to use the MIDI CPU's note number remapping to map the full range 0-127 to a restricted range of values. In this example, values 0-4 could map to note 48, values 5-9 could map to note 49, values 10-14 could map to note, 50, etc...

For that approach, check out the "MIDI number remapping" section of the firmware manual.

Last edited by John; 09-03-2013 at 03:48 PM.
Reply With Quote
  #2  
Old 01-03-2013, 04:08 PM
John's Avatar
John John is offline
Moderator
 
Join Date: Jan 2009
Posts: 3,007
Default

Demo video here:

http://forum.highlyliquid.com/showthread.php?t=942
Reply With Quote
  #3  
Old 10-04-2013, 11:39 PM
Prof H Prof H is offline
Junior Member
 
Join Date: Sep 2013
Posts: 9
Default Sharp IR Sensor

I got this all to work with a Sharp IR sensor, using the attached schematic. My first question is how to get the switch to work as a toggle or latch, with just one momentary physical switch. I am using two momentary switches now - one on - one off.

Next comes a two part question. I also got two accelerometers (on separate terminals) to work the same way, but want it to change velocity rather than notes. How do I do that? The next part of the question is that the range the accelerometers are working in, is limited. Any way to work around that to change the velocity full range?

Lastly, I would like to have an LED indicate if the sensor or the accelerometer terminals are active or turned on.

Thanks very much for a great MIDI "brain". GCH
Attached Images
 
Reply With Quote
  #4  
Old 10-05-2013, 02:47 PM
Synthetech's Avatar
Synthetech Synthetech is offline
Moderator
 
Join Date: May 2012
Location: USA
Posts: 711
Default

are you sure you have a full range for that proximity sensor?

I thought it had a range of .4v to 2.8v



As for your accelerometer,

John and I have thought out that if you use a rail to rail opamp like a MCP6001 as a voltage follower, but insert a combination of resistors that create a differential to work in a 0 to 5v range, you could come up with an amp that would translate something like the IR proximity sensors range to 0-5v at the opamps output.
it may not be exactly 0-5v, but perhaps very close.. hard telling w/out some tests.

check the datasheet

http://ww1.microchip.com/downloads/e...Doc/21733h.pdf

and the "non inverting amplifier" to see how to set up the resistors.




Switches can be programmed to toggle on/off with a mom. sw.
but it depends on what you are using the switch for.



To help further, a full description of what each terminal is used for and how you want it to behave is needed to get a configuration/ program coded up.

As for LED's. There might be a way to cause an LED to flicker when you have activity on an analog input (from the IR sensor or accell.'s).
It would maybe light up and flutter a bit.. by using two layers:

one layer to use "Analog Input: Data Register: Store Value" mode to store a 1 in a register to cause an LED to light up whenever there is activity.
a second layer to store a 0 in that register when there is activity (turn LED back off).

The idea is that when there is activity, it will light up and then immediately be put out. When the CPU cycles back to layer one again, if there is no activity, it will not light up.
This may be the only way to accomplish the "activity" light LED.
Reply With Quote
  #5  
Old 10-06-2013, 07:44 PM
Prof H Prof H is offline
Junior Member
 
Join Date: Sep 2013
Posts: 9
Default Trombone slide MIDI project

Thanks a lot for the prompt, thoughtful reply. My project started out just to track the movements of a trombone slide with MIDI notes by using a Sharp IR sensor. The data sheet for the one I am using says 4.5 – 5.5 supply voltage, so I am OK there. I also have an adjustable target on the slide itself to tune in the limits, then two pots (not pictured below) to adjust the range. It works to suit me, as it is active for the full range of motion, and this part of the project is more scientific than musical.

Then I found the Hot Hand accelerometer made by Source Audio, which uses an ADXL320 made by Analog Devices. There are wired, as well as wireless versions, and at first I thought that would be easier to track the trombone slide, than all this Sharp IR sensor business, but it is not precise enough, and the HL MIDI CPU offers much more versatility.

Then I thought the Hot Hand accelerometer might be used on the left thumb to change the Velocity, rather than invent some spring loaded pot or encoder. The range seems limited however, and again not too precise. No matter what I end up using, I would like to turn on and off the TC whatever I use is connected to, with a single momentary switch, rather the two as pictured below.

I would also like to have an indicator LED come on to show if that TC is active or not. Please excuse any confusion by my misuse of terms – I don’t need more that the one MIDI activity LED already in place.

I have the switch matrix working to send Program Changes, and it would be handy to be able to change layers, to give more choices, and here again, an LED indicator light for each layer would be helpful. I have read one post about changing layers and have successfully installed the 1.4 firmware.

The code I have used follows and I posted a picture, showing the project so far. Thanks very much for your help. GCH

// TC 04 – 07 DATA Lines for Switch Matrix
04 00 7F 00 00 00 04 01 7F 00 00 00
05 00 7F 00 00 00 05 01 7F 00 00 00
06 00 7F 00 00 00 06 01 7F 00 00 00
07 00 7F 00 00 00 07 017F 00 00 00

// TC 08 – 11 SELECT Lines for Switch Matrix (3C = Program Change)
08 00 3C 00 18 00 08 01 3C 00 18 00
09 00 3C 00 1C 00 09 01 3C 00 1C 00
0A 00 3C 00 20 00 0A 01 3C 00 20 00
0B 00 3C 00 24 00 0B 01 3C 00 24 00

// TC 16 – Sharp Sensor
10 00 00 00 00 7F 10 01 00 00 00 7F

// TC 17 – Switches notes from Sensor on/off (68 = on and 69 = off)
11 00 68 00 10 00 11 01 69 00 10 00

// TC 18-19-20 Switches on & off Hot Hand accelerometer X or Y
// TC 18 Hot Hand accelerometer X or Y
12 00 00 00 00 7F
// TC 19 ON
13 00 68 00 12 00
// TC 20 OFF
14 01 69 00 12 00

// TC 21-22-23 Switches on & off Hot Hand accelerometer X or Y
// TC 21 Hot Hand accelerometer X or Y
15 00 00 00 00 7F
// TC 22 ON
16 00 68 00 15 00
// TC 23 OFF
17 01 69 00 15 00
Attached Images
 
Reply With Quote
  #6  
Old 10-07-2013, 11:14 AM
Synthetech's Avatar
Synthetech Synthetech is offline
Moderator
 
Join Date: May 2012
Location: USA
Posts: 711
Default

I'd like to help, but unfortunately I have to leave town for a week on personal biz..

I help out with some projects on here, but John is of course the expert.

Your outline should help out alot in figuring up a design and code for your project.

Catch you back here in about a week.

-Blaine
Reply With Quote
  #7  
Old 10-10-2013, 02:32 PM
John's Avatar
John John is offline
Moderator
 
Join Date: Jan 2009
Posts: 3,007
Default

Hi Prof H, welcome to the forum.

Thank you for sharing such a cool project. Please continue to post photos as you continue with the build!

I'll do my best to reply to your questions below. Some parts may duplicate Blaine's response.

Quote:
Originally Posted by Prof H View Post
I got this all to work with a Sharp IR sensor, using the attached schematic. My first question is how to get the switch to work as a toggle or latch, with just one momentary physical switch. I am using two momentary switches now - one on - one off.
Ok. This is just a matter of employing both state transitions for the single switch. (tt=00h and tt=01h)

So, instead of this:

// CT 19: Gate ON for CT17 analog continuous note
13 00 68 00 12 00
// CT 20: Gate OFF for CT17 analog continuous note
14 01 69 00 12 00

Use this:

// CT 19: logic input, high-to-low transition: Gate ON for CT17 analog continuous note
13 00 68 00 11 00
// CT 19: logic input, high-to-low transition: Gate OFF for CT17 analog continuous note
13 01 69 00 11 00

Quote:
Next comes a two part question. I also got two accelerometers (on separate terminals) to work the same way, but want it to change velocity rather than notes. How do I do that?
Here is your original config for IR sensor input using mode 00h:

// CT 16: analog input, continuous note, fixed velocity=127 (7Fh)
10 00 00 00 00 7F

Instead, use mode 01h, which allows you to specify a data register for the note velocity:

// CT 16: analog input, continuous note, note velocity from register 05h
// (register 05h contains the value of analog input to CT #18)
10 00 01 00 00 05

You can find a list of regsiters for each analog input in the "analog input data" section of the firmware user manual.

Quote:
The next part of the question is that the range the accelerometers are working in, is limited. Any way to work around that to change the velocity full range?
There are a few approaches for manipulating the range of MIDI output data (note numbers, velocity, etc) for a MIDI CPU analog input. They can be used in combination if necessary.

First is changing the range of the analog signal itself. You can scale an analog signal from one range to another using a simple op amp circuit. Here is a document that explains:

http://www.ti.com/general/docs/lit/g...7&fileType=pdf

If you are unfamiliar with the jargon used in the document, it can be a little confusing at first, but ultimately it is very simple. If you want to discuss this further please let me know.

Voltage scaling as described in the document above is probably the best choice since it allows you to adjust the range of each signal independently from the others.

The second approach is to change the reference voltage used by the MIDI CPU for ADC conversion. This is a "global" setting and also occupies control terminals that could otherwise be used for data input, so I recommend against it in this case.

Finally, values in MIDI CPU data registers can be limited to a specific range. If you update your MIDI CPU to the latest firmware, (1.4, as of this writing), you can specify minimum and maximum values for registers that accept analog input. So this way, you can specify, say, a specific range of notes or velocities to be generated. Scaling the input voltage may still be required to reduce "dead zones" of input where the output value is pegged at the minimum or maximum.

Quote:
Lastly, I would like to have an LED indicate if the sensor or the accelerometer terminals are active or turned on.
Ok. By "active or turned on" do you mean that the MIDI CPU is generating notes? Or something different?

One other note about your config. For example:

// CT 18-19-20 Switches on & off Hot Hand accelerometer X or Y
// CT 18 Hot Hand accelerometer X or Y
12 00 00 00 00 7F

If you are going to use this sensor for something other than generating the note pitch, like note velocity, use mode 0Fh "analog input data only" mode:

// CT 18: Analog input, data only
12 00 0F 00 00 00

Please let me know if this was helpful. We'll continue from there.

Last edited by John; 10-10-2013 at 02:37 PM.
Reply With Quote
  #8  
Old 10-11-2013, 07:04 PM
Prof H Prof H is offline
Junior Member
 
Join Date: Sep 2013
Posts: 9
Default MIDI Trombone update

Thanks so much for the most helpful reply. The op-amp for the accelerometer will be the next challenge, because I am running out of room in the little tin I used. The wireless version of the Hot Hand accelerometer just arrived, and it works interchangeably with the wired version, so another option is to build a stand alone MIDI-CPU box for just the accelerometer, not on the trombone, then merge with the wireless signal from the trombone.

Also, I have gone in a different direction for the thumb velocity. I posted a picture of what is now installed – a Thumb Joystick, which works full range. I have tried to add Pitch to the other axis, but no luck. It would be nice to eventually have multiple layers, so I can switch between the Sharp sensor, the accelerometer, if that stays on board, and how the thumb joystick behaves. Having an LED indicate which Layer is being used would be important when that happens.

Here are some construction details that might be of interest, due to making the project as compact and light weight as possible. Since the Mid-Air wireless transmitter I am using takes a 4P4C (4 position, 4 contact) telephone connector rather than the usual MIDI ones, I found some 6P6C telephone jacks on breadboards, and used one to get the MIDI signal out from the MIDI-CPU. Gravitech makes a version with a setscrew header, which I found useful for this prototype, and by using a “stackable” header with long male pins, I was able to lift it away from the MIDI-CPU board components with a little insulator taken from the usual male header.

Telephone connectors come in two basic widths, the 4P4C being for headsets, and the 6P versions being for the wall jacks. Even though telephones need only two wires, 6P4C connectors are generally used with either 2 or 4 wire cable. But… what I did was to use a 6P6C jack on the MIDI-CPU, so I could get all 5 of the MIDI outputs on one cable. Additionally, the 6th connection could be used for power input by just running a wire.

That made it possible to build a breakout board with the 6P6C telephone jack going to the usual MIDI connectors both in and out, which makes it easy to hook to the MICI-CPU for programming.

Speaking of which, I now get to work with the code John was so kind as to provide! Thanks again, and I’ll post my progress and more questions I am sure.
Attached Images
   
Reply With Quote
  #9  
Old 05-18-2015, 07:19 PM
Prof H Prof H is offline
Junior Member
 
Join Date: Sep 2013
Posts: 9
Default MIDI Trombone Xbee

Well the latest on my MIDI trombone project is that I built a test bench so I can test without having to pick up an instrument every time, but now I have another question.

It would be much more compact if I could transmit the info from the Sharp IR sensor via Xbee radios to the MIDI CPU, rather than having the MIDI CPU hardwired and on the trombone itself. The question is if the PWM output of an Xbee radio can be converted with a simple DAC so this would work, and then of course suggested values for the resistor and capacitor of a simple DAC.

It would also be nice to use the same type of DAC for a thumb joystick for velocity and note on and note off switches.

Thanks for your help. GCH
Attached Images
 
Reply With Quote
  #10  
Old 06-22-2015, 11:18 PM
John's Avatar
John John is offline
Moderator
 
Join Date: Jan 2009
Posts: 3,007
Default

Prof H, cool diagram! Sorry for the long delay.

Quote:
Originally Posted by Prof H View Post
It would be much more compact if I could transmit the info from the Sharp IR sensor via Xbee radios to the MIDI CPU, rather than having the MIDI CPU hardwired and on the trombone itself. The question is if the PWM output of an Xbee radio can be converted with a simple DAC so this would work, and then of course suggested values for the resistor and capacitor of a simple DAC.
I don't have much of a guess on this. I think you'll just have to start with trial-and-error.

My understanding is that Xbee transmits serial data. Therefore, you'll want to do some kind of ADC locally on the trombone before sending the data. Maybe it is a good case to use a custom program on an Arduino or similar platform. (I'm guessing there are development boards that have integrated Xbee?)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.