November 22, 2024, 02:47:15 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Electronic Drums / Analogue Input ?

Started by Hack, April 09, 2008, 01:09:45 PM

Previous topic - Next topic

Hack

This is actually seeming to be very simple so far; A few lines of code and a little bit of wiring later (for one input) and I have a drum sound coming out of my MIDI software on my computer! Here's the thing.. It's NOT touch sensitive so only one velocity is played. Don't get me wrong- it's still cool, but not practical in most musical applications.

My question is what should I do to make it touch sensitive? I want to make this kit cheap due to the high price in retail kits.
(By the way I am using a piezo rather than a "button" input)


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

' -----[ I/O Definitions ]-------------------------------------------------
DrumIN    PIN 0
MidiOut   PIN 15

' -----[ Variables ]-------------------------------------------------------
BoolHIT   VAR Bit
MidiBaud  CON $8000 + 12

' -----[ Program Code ]----------------------------------------------------
DO
  IF (DrumIN = 1) THEN
      IF BoolHIT = 0 THEN
        SEROUT MidiOut, MidiBaud, [$90, $24, $7F]  'KICK drum for ReDrum (Reason) - ON
        BoolHIT = 1
      ENDIF
    ELSE
      IF BoolHIT = 1 THEN
        SEROUT MidiOut, MidiBaud, [$80, $24, $7F]  'KICK drum for ReDrum (Reason) - OFF
        BoolHIT = 0
      ENDIF
  ENDIF
LOOP


Any help is greatly appreciated! Thanks!

JonnyMac

I don't think you're going to be able to do that with a BASIC Stamp.  What you need is what's called a sample-and-hold circuit for each of your pads.  When you strike a pad it will generate a voltage which gets captured by the S/H circuit (a cap and op-amp).  If the value -- which must be read by an ADC -- exceeds the strike threshold then you play the note with the velocity set by the value stored in the S/H circuit.

Like Mick Jagger sings, "You can't always get what you want." -- you may not be able to get what you want on the cheap.
Jon McPhalen
EFX-TEK Hollywood Office

Hack


JonnyMac

I don't recommend anything except the SX from Parallax because it's all I use.  You might want to do a web search on sample and hold circuits first.  I'm doing a control project for a friend that uses an SX chip and the ADC0838 to read a bunch of analog inputs; it works very well.  Yes, there are microcontrollers out there with built-in ADCs but I don't use them; those "specialty" chips have an annoying habit of being discontinued when you most need them.  I stick to straightforward microcontrollers and like the SX line the best, especially since I can program them in SX/B, a language I helped create.
Jon McPhalen
EFX-TEK Hollywood Office

Hack