Shop OBEX P1 Docs P2 Docs Learn Events
9 x 14bit midi controllers from one basic stamp 2? — Parallax Forums

9 x 14bit midi controllers from one basic stamp 2?

vibrationsvibrations Posts: 3
edited 2007-09-16 15:53 in BASIC Stamp
looking at putting together a little project, to make an 9-channel midi pitchbend sending box
this is to send 9 channels of 14bit midi volume information to a daw (emulating the Mackie Control protocol)
so it will have to send a fair amount of data over one midi cable
each pitchbend signal has to be on its own midi channel (1 - 9)

has anyone put together a similar project? any data bottlenecking issues?
is there a potentiometer i can use that will send a greater range of values?
the pots i've looked at seem to only send a range of 0-1023 to the basic stamp...

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-09-15 08:46
    vibrations -

    I know nothing about Midi, but the following applications notes from past Nuts and Volts Magazine articles may prove to be helpful:

    http://www.parallax.com/html_pages/downloads/nvcolumns/Nuts_Volts_Downloads_V4.asp

    There may be other Midi articles in some of the other Nuts and Volts columns as well. I did not do a thorough search of them. Thanks go to Jon Williams, a former Parallax employee.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • vibrationsvibrations Posts: 3
    edited 2007-09-15 08:59
    thanks Bruce - unfortunately the application notes you posted refer to 7 bit midi only
    i have Jeff Mann's code for 14 bit midi output from basic stamp 2, just no examples of anyone using it 'in parallel'
    anyone out there outputting more than one midi pitchbend stream?
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2007-09-15 12:59
    vibrations,
    Jeff Mann's code is what you need - he doesn't split the word correctly and he doesn't tell you what to rem out and his use of PIN would have caused errors - that could be why you are confused - I simplified it for your needs below:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    baud CON 32780· '31.25kb, 8n1, non-inverted, open collector

    'declare variables
    value VAR Word········· 'holds the 16-bit value read from the pot
    MPIN VAR Nib············ 'which pin/pot we are reading at the moment
    statusbyte VAR Byte···· 'MIDI status fo pitchbend
    data1 VAR Byte
    data2 VAR Byte

    'user configuration - adjust these to suit you
    'set unused pins to outputs
    DIRS = %1111111000000000 'all outs
    midioutpin CON 9······· 'pin connected to MIDI out connector cause 0 thru 8 are your pots

    DO
    ·· FOR MPIN = 0 TO 8
    ···· 'read the value of the pot
    ···· HIGH MPIN
    ···· PAUSE 1
    ···· RCTIME MPIN, 1, value

    ···· 'debug will slow the process down - loose it
    ···· statusbyte = $e0 |MPIN········ 'sending controller message
    ···· data1 =value & $7F··········· 'least significant 7 bits
    ···· value=value<<1················· 'shift 8th bit into upper byte
    ···· data2 = value.HIGHBYTE & $7F················ 'most significant 7 bits
    ···· SEROUT midioutpin, baud, [noparse][[/noparse]statusbyte, data1, data2]

    ·· NEXT
    LOOP

    with this code the·pot may not be an issue but...

    MORE TO COME ON THE SUBJECT OF POTS

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 9/15/2007 4:08:43 PM GMT
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2007-09-15 16:04
    Problem #2
    vibrations said...

    is there a potentiometer i can use that will send a greater range of values?
    the pots i've looked at seem to only send a range of 0-1023 to the basic stamp...
    Here's the· issue, an· RCTIME value of 16383=·32.766ms. You have 9 pots so that equals...Umm lets see...a long time. In fact to take advantage of the full 14 bit range of the pitchbend you would need·358 mseconds (less than 3 scans per second -clocked on a oscilloscope). Making the pots very sluggish and seemingly unresponsive.

    So, for the sake of sanity·, a 10k pot and .1µF cap should do fine.

    "How do I get full range out of my mackie fader?", you ask. Well, you do pot scaling.

    Pot Scaling
    Let's say your max value from a 10k pot is 665 and your max pitchbend output is 16383 you do this math:

    x=x*16383/665 simplified to x=x*24
    take the remainder of 423 and divided by 665,multiply by 66536 this equals 41687
    put it all together like this:
    x=x*24 + (x**41687)

    This will evenly scale 0 to 665 into 0 to 16383. If you do achieve an rctime greater than 16383 (and I don't recommend it) just treat it as a remainder and do the remainder portion of the math.


    If you need higher resolution·look into·this 8 channel 12 bit·A to D converter.·

    http://www.parallax.com/detail.asp?product_id=604-00026

    Post edited after I put the code on a scope and found out some of my math was off.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 9/16/2007 7:31:01 AM GMT
  • vibrationsvibrations Posts: 3
    edited 2007-09-16 13:47
    thanks TechnoRobbo - you've made things much clearer (and, paradoxically, more complex!)

    i'll look into the MAX1270 12-bit A\D

    lo res volume controllers tend to sound a little zippery/steppy when changing values...
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2007-09-16 15:53
    Thats the inherent problem with rctime, it varies it's time of execution with the output value. A to D converters use a "successive approximation" method which is extremely quick and doesn't vary in execution time giving you a really smooth result.
    And you can't beat the price. Here's some documentation from Nuts & Volts

    http://www.parallax.com/dl/docs/cols/nv/vol5/col/nv105.pdf


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 9/16/2007 4:16:57 PM GMT
Sign In or Register to comment.