BASIC STAMP for MIDI
Archiver
Posts: 46,084
On 23 Dec 02 at 14:17, futilityengineer dhlacey@yaho wrote:
> I'd like to use a basic stamp in a MIDI context...
>
> My questions are:
>
> will I need extra components between the switches & the basic stamp
> (i.e. some capacitors or something to help control multiple
> triggering) ?
If you don't require rapid switching, you can debounce the switches
from your program. You'll probably require a pullup/pulldown
resistor to assure a reliable default logic level for the switch.
> will I need extra components between the Basic Stamp & the DIN-5
> connector that is the MIDI output?
All I use is a 220 ohm resistor from the SEROUT pin to DIN-5 pin 5
and another 220 ohm resistor from +5 volts to DIN-5 pin 4. Works
fine for me.
> how do I send a MIDI signal w/ Basic Stamp. One of the outputs can
> function as a serial port, do I just send the serial port the bytes
> I want to send, or will it be a more low-level chore than that (i.e.
> do I have to turn that output on and off in a pattern that reflects
> the data I want to send)?
You send your MIDI bytes as arguments to a SEROUT statement.
Here's an example:
'{$STAMP BS2}
g CON $37 ' keyboard key #
c CON $3C ' keyboard key #
d CON $3E ' keyboard key #
e CON $40 ' keyboard key #
again:
SEROUT 8,32780,[noparse][[/noparse]$90,e,100] ' [noparse][[/noparse]on/off+channel, key, volume]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,e,0]
pause 200
SEROUT 8,32780,[noparse][[/noparse]$90,d,100]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,d,0]
pause 200
SEROUT 8,32780,[noparse][[/noparse]$90,c,100]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,c,0]
pause 200
SEROUT 8,32780,[noparse][[/noparse]$90,g,100]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,g,0]
pause 200
pause 10000
goto again
This simple program repeatedly plays the notes E, D, C, G in sequence
(the 1/4 past the hour Westminster chime sequence) on a Yamaha
Clavinova electronic keyboard. Taking a closer look at the final
SEROUT statement--using I/O 8, send the following bytes at 31,250
baud: hexadecimal 90, then hexadecimal 37, then 0 (zero).
I hope that gets you started. Regards and Merry Christmas,
Steve
> I'd like to use a basic stamp in a MIDI context...
>
> My questions are:
>
> will I need extra components between the switches & the basic stamp
> (i.e. some capacitors or something to help control multiple
> triggering) ?
If you don't require rapid switching, you can debounce the switches
from your program. You'll probably require a pullup/pulldown
resistor to assure a reliable default logic level for the switch.
> will I need extra components between the Basic Stamp & the DIN-5
> connector that is the MIDI output?
All I use is a 220 ohm resistor from the SEROUT pin to DIN-5 pin 5
and another 220 ohm resistor from +5 volts to DIN-5 pin 4. Works
fine for me.
> how do I send a MIDI signal w/ Basic Stamp. One of the outputs can
> function as a serial port, do I just send the serial port the bytes
> I want to send, or will it be a more low-level chore than that (i.e.
> do I have to turn that output on and off in a pattern that reflects
> the data I want to send)?
You send your MIDI bytes as arguments to a SEROUT statement.
Here's an example:
'{$STAMP BS2}
g CON $37 ' keyboard key #
c CON $3C ' keyboard key #
d CON $3E ' keyboard key #
e CON $40 ' keyboard key #
again:
SEROUT 8,32780,[noparse][[/noparse]$90,e,100] ' [noparse][[/noparse]on/off+channel, key, volume]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,e,0]
pause 200
SEROUT 8,32780,[noparse][[/noparse]$90,d,100]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,d,0]
pause 200
SEROUT 8,32780,[noparse][[/noparse]$90,c,100]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,c,0]
pause 200
SEROUT 8,32780,[noparse][[/noparse]$90,g,100]
pause 400
SEROUT 8,32780,[noparse][[/noparse]$90,g,0]
pause 200
pause 10000
goto again
This simple program repeatedly plays the notes E, D, C, G in sequence
(the 1/4 past the hour Westminster chime sequence) on a Yamaha
Clavinova electronic keyboard. Taking a closer look at the final
SEROUT statement--using I/O 8, send the following bytes at 31,250
baud: hexadecimal 90, then hexadecimal 37, then 0 (zero).
I hope that gets you started. Regards and Merry Christmas,
Steve
Comments
inputs (through 10K) and connect your push-buttons between the inputs and
ground. Tracy Allen's web site (www.emesystems.com) has code for watching
multiple inputs and noting when something changes (on or off).
You can create a Stamp-to-MIDI interface with two 220-ohm resistors and a
5-pin DIN socket (female). Schematics are all over the Internet (use your
favorite search engine), but here's a description:
DIN.2 --> ground
DIN.4 --> 220 --> 5 volts
DIN.5 --> 220 --> Stamp pin for MIDI serial ouput.
Sending MIDI messges is very easy with SEROUT. For example, the following
code will send a "Note On" ($90) message for Middle C ($3C) at the loudest
volume ($7F) from pin 15:
SEROUT 15, $8000+12, [noparse][[/noparse]$90, $3C, $7F]
The baudmode value of 12 is for MIDI's 31.25 kBaud rate. The $8000 puts the
pin in "open" mode (not driven).
You can get the details on MIDI messages from <A
HREF="www.midi.org">www.midi.org</A>.
-- Jon Williams
-- Parallax
In a message dated 12/23/2002 8:23:26 AM Central Standard Time,
futilityengineer@y... writes:
> Hello!
>
> I'd like to use a basic stamp in a MIDI context. I need to have
> three momentary switches attached to the basic stamp. Each switch
> should cause a MIDI message to be sent when it is pressed, and a
> different one to be sent when it is released. Also, when any of the
> switches are closed, a line needs to be 'held low.'
>
> The application is for talk back mics on a digital mixer. The MIDI
> messages turn three mic channels on and off (to talk back to three
> different busses: studio, phone &ISDN), the line 'held low' causes
> the mixer to 'dim' the control room speakers' signal to prevent
> feedback.
>
> My questions are:
>
> will I need extra components between the switches &the basic stamp
> (i.e. some capacitors or something to help control multiple
> triggering) ?
>
> will I need extra components between the Basic Stamp &the DIN-5
> connector that is the MIDI output?
>
> how do I send a MIDI signal w/ Basic Stamp. One of the outputs can
> function as a serial port, do I just send the serial port the bytes I
> want to send, or will it be a more low-level chore than that (i.e. do
> I have to turn that output on and off in a pattern that reflects the
> data I want to send)?
>
> any hints will be welcome, pointers to sections in the documentation
> as well. Please understand, I'm a recording engineer. Programming
> microcontrollers is a little new for me.
>
> thanks, DL
[noparse][[/noparse]Non-text portions of this message have been removed]
I did a project utilizing stamp/midi interaction. Some information is at
http://www.zenchemical.com/burningman/lightwave/ (Sorry, I just realized
how crappy this looks in non-IE browsers...)
Technically speaking , MIDI has to be optoisolated in order to be to
spec, so as to keep stray voltages from killing your boards. Practically
speaking, all you have to do is ground the GND side of midi, and tie the
+5 to the second pin through a 220 ohm resistor, and the third pin on
midi to one of the stamp I/O lines. Then driving midi devices is as easy
as using serout (technically 31025 baud, but I think I used 32768 for
better results...)
Your second statement is confusing though... "Sending the serial port
bytes I want to send " is the same thing as "turning an output on and off
in a pattern that reflects the data", it's just that stamps, pic
compilers, etc. have low-level functions which do that on-off thing for
you. But ultimately it's the same operation.
> will I need extra components between the Basic Stamp & the DIN-5
> connector that is the MIDI output?
>
> how do I send a MIDI signal w/ Basic Stamp. One of the outputs can
> function as a serial port, do I just send the serial port the bytes I
> want to send, or will it be a more low-level chore than that (i.e. do
> I have to turn that output on and off in a pattern that reflects the
> data I want to send)?
>
> any hints will be welcome, pointers to sections in the documentation
> as well. Please understand, I'm a recording engineer. Programming
> microcontrollers is a little new for me.
>
> thanks, DL
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Sean T. Lamont, CTO / Chief NetNerd, Abstract Software, Inc. (ServNet)
Seattle - Bellingham - Vancouver - Portland - Everett - Tacoma - Bremerton
email: lamont@a... WWW: http://www.serv.net
"Do not fear mistakes, There Are None" - Miles Davis
> (i.e. some capacitors or something to help control multiple
> triggering) ?
no, you can implement by software
> will I need extra components between the Basic Stamp & the DIN-5
> connector that is the MIDI output?
yes, the optocoupler, standard for MIDI
> how do I send a MIDI signal w/ Basic Stamp. One of the outputs can
> function as a serial port, do I just send the serial port the bytes I
> want to send, or will it be a more low-level chore than that (i.e. do
> I have to turn that output on and off in a pattern that reflects the
> data I want to send)?
If you want, I can send private any code and example.
Original Message
From: <dhlacey@y...>
To: <basicstamps@yahoogroups.com>
Sent: Monday, December 23, 2002 11:17 AM
Subject: [noparse][[/noparse]basicstamps] BASIC STAMP for MIDI
> I'd like to use a basic stamp in a MIDI context. I need to have
> three momentary switches attached to the basic stamp. Each switch
> should cause a MIDI message to be sent when it is pressed, and a
> different one to be sent when it is released. Also, when any of the
> switches are closed, a line needs to be 'held low.'
>
> The application is for talk back mics on a digital mixer. The MIDI
> messages turn three mic channels on and off (to talk back to three
> different busses: studio, phone & ISDN), the line 'held low' causes
> the mixer to 'dim' the control room speakers' signal to prevent
> feedback.
>
> My questions are:
>
> will I need extra components between the switches & the basic stamp
> (i.e. some capacitors or something to help control multiple
> triggering) ?
>
> will I need extra components between the Basic Stamp & the DIN-5
> connector that is the MIDI output?
>
> how do I send a MIDI signal w/ Basic Stamp. One of the outputs can
> function as a serial port, do I just send the serial port the bytes I
> want to send, or will it be a more low-level chore than that (i.e. do
> I have to turn that output on and off in a pattern that reflects the
> data I want to send)?
>
> any hints will be welcome, pointers to sections in the documentation
> as well. Please understand, I'm a recording engineer. Programming
> microcontrollers is a little new for me.
>
> thanks, DL
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>> will I need extra components between the switches & the basic stamp
>> (i.e. some capacitors or something to help control multiple
>> triggering) ?
> no, you can implement by software
>
>> will I need extra components between the Basic Stamp & the DIN-5
>> connector that is the MIDI output?
> yes, the optocoupler, standard for MIDI
[noparse][[/noparse]etc.]
Check out
http://interaccess.org/arg/arg-knowledge/MIDI.BS2
for code for a MIDI knob box. You should be able to adapt it for your
needs. In particular, the code shows how to configure serial for MIDI
and includes a mini-schematic for hooking up a STAMP chip to a MIDI
output jack. Note that for MIDI output, an opto-isolator is NOT
required. You only need an opto-isolator for MIDI input, something for
which the STAMP by itself is poorly suited anyway.
_murat
BS2 on Mac OS X!
http://www.interaction.rca.ac.uk/alumni/01-03/murat/MacBS2/