|
Guitar Motion Sensor |
| BLACK | GROUND | A1, B1 |
| RED | 5 VOLTS | A2, B2 |
| BLUE | X AXIS | A8 |
| ORANGE | Y AXIS | A16 |
| YELLOW | Z AXIS | A9 |
| GREEN | X ROTATION | B8 |
| GREY | Y ROTATION | B16 |
| PURPLE | Z ROTATION | B9 |
| BROWN | NOT USED | NONE |
Well, I am rather surprised to learn this, but apparently there is no great need to buy an external USB sound card unless you're concerned about the noise floor and sound quality.
I tried an experiment tonight: I connected a 1/4" to 1/8" adapter to my guitar cable and plugged it into the line-in jack of my eMac.
Then I cranked up the line-in sensitivity of Apple's built-in audio and recorded my guitar using Audacity.
It worked just fine, though the signal was kind of low so I just boosted it with the "Amplify" feature under the "Effects" pull-down menu and it sounded clear as a bell to me.
Then I coded up a simple program in ChucK that routed the adc directly to the dac, or in other words just sent the line-in directly to the speakers.
This had the same result, it worked but I had to add a gain of 10 to get sufficiently loud sound output.
Furthermore, someone on the electro-music.com forum tells me that this will work on any PC, even a 10 year old junker PC.
This means that we can get our guitar directly into our effects software with just a $3 adapter instead of a $100 sound card!
Good news indeed.
What about getting the sound out of the computer and sending it to our guitar amp? That can also be done with the right cable for the job. As I mentioned on page 1, I have a cable that connects the headphone output from my eMac to my guitar amp. In my case, it's a Fender Frontman 15G amp so it has a pair of RCA jacks as input. The feature is a play-along with your CD player concept, but with the right cable it works nicely, albeit a little noisy. To be precise, I had to buy an RCA to 1/4" cable and use a 1/4" to 1/8" adapter. Your situation may be different, just get the right cable and the right adapter(s) for the job. So yeah, you can get started on the project without buying a sound card!
In my situation I may end up with an external USB sound card anyway because I would like to have a wearable headset microphone in addition to sending the guitar into the computer. That will not be a problem on my notebook computer which has line-in (guitar), mic-in (microphone) and headphone (amp) jacks on the side of it, but unfortunately my eMac only has line-in and headphone jacks. Besides, eventually I will want the low noise floor, or in other words the sound quality of an external USB sound card. Furthermore I need ChucK to be able to receive both the guitar and the microphone signals on separate channels so I can do some fancy vocoding stuff and make it sound like my guitar is talking, muhuhahaha!
One final note for anyone who might be experimenting with the analog guitar signal is that I measured the amplitude of the signal from my Fender Strat using my oscilloscope. It turned out to be 20 mV peak-to-peak when a single string was plucked, and 40 mV peak-to-peak when all six strings were strummed. You might need that information for future reference, certainly I was wondering about it until I made the measurement.
Yep. I hate to ask you to wade through a second complicated, boring, hi-tech data sheet but this one is also important. Fortunately it's only a few pages long and has lots of pictures that communicate the ideas well. Point your web page back to the Dimension Engineering accelerometer breakout-board page that we looked at earlier, which is here. Scroll down to where all that red text is and click on the red text next to the heading "Datasheet:" that says "DE-ACCM3D.pdf". This will download and display the data sheet for the $35 breakout board(s) that we will be using.
I'm not going to walk you through this data sheet since you really should read the entire thing completely and understand it all yourself. But I will call your attention to one important detail that will cause you to breathe a sigh of relief. On the last page, page 5, the very last thing mentioned is the Protection Features. Read them, they say two things. 1. Even if you do the most electrically destructive thing that one can do to any circuit board besides perhaps zap it with lightning, which is get power and ground backward, the thing will survive just fine. They added a transistor that protects against that possible mistake (hey, I did it once in my engineering career so I can't blame anyone for doing such a thing), so yes they thought of everything. 2. Even if you short the opamp outputs to ground by mistake, they still won't fry.
So fear not! Besides a little mechanical fanagling, the project consists only of soldering some wires and just about any mistake will be tolerated... um, except be sure not to hook anything up to the bypass pins. If you hook +5V to the bypass pin (pin 15) for some reason, the chip will probably survive and function for some time before it dies, which would probably be in the middle of a performance due to Murphy's law. So don't do that! Just to be sure, I'll clarify that the breakout boards have pin numbers that start at the upper left corner and increment counter-clockwise around the chip. That can be confusing if you happen to be an electronics beginner, and in fact I once got it wrong when I was a newbie electronics student, so I can see how someone could make that mistake. Clear as mud? Good!
After considering all the various factors involved, I have decided that the initial version of the project that I will construct will be a single 3-axis accelerometer version mounted on the headstock of the guitar. I have some good reasons for going this route initially. One is cost. Due to my meager budget and current car repair debt, it will be difficult to squeeze much hardware into the budget, besides I want any fellow musician to be able to get started as inexpensively as possible. Also the math is easier. I learned that figuring out the true angle of the guitar in all three dimensions, plus handling rotations and translations, involves using Euler angles. You can Google up some information on Euler angles if you want, but basically it is heavy duty math that is above my head at the moment. I mean, this is the kind of math that NASA uses to dock the space shuttle! It's a bit advanced for little old me. Plus mounting the sensor at the headstock means that the motion of the guitar will create the maximum amount of acceleration possible in this application. In other words, the headstock moves around a lot more than, say, the tail of the guitar. This prevents any problems with the signal being too small and allows us to sense slower, more gentle motions better so we can sense the full range of possible motions.
So that's what I plan to do. As to cost, I'll need to get just one accelerometer board for $35 + shipping, and one USB interface board for $35 + shipping. All the other parts I have laying around or can fanagle somehow, including a USB cable that is a bit short but will suffice, so total cost should be a mere $80.
Given the above preceeding paragraph about someone else wanting to get started, I felt a bit concerned about asking that person to invest in $80 or so worth of hardware that has no guarantee of actually working or proving useful. It occurred to me that perhaps I could provide some test software to demonstrate the concept and to help get this new friend started on the software prior to actually buying any hardware. After all, divide-and-conquer is a brilliant scheme most of the time and it only makes sense to get the ChucK software installed and a test program running before buying anything.
Well, it just so happens that I have a program already written that demonstrates the concept nicely. It's called "Guitar Mouse", and it uses the computer's mouse for the sensor input. The Guitar Mouse program listens for your guitar on the computer's built-in microphone, or an external microphone if that's what yyou have, and does a double-Wah effect on it, then sends the output sound to a .wav file on the disk. So with this program you don't even need to have that $3 1/4" to 1/8" adapter to get your guitar into your computer, you can just use your guitar hooked up to your amp and the software will hear it on the microphone. What could be easier and less expensive that free software with no hardware to buy?
Besides, setting up the software, though easy, does have some obstacles to overcome. You have to download ChucK and install it properly which should be easy enough, though Linux users must compile ChucK as is the Linux way of doing things. Then you have to figure out how to run ChucK which is easy enough but some people don't realize quite what buttons to push at first glance. Also you could get caught up on some minor detail like telling ChucK where to write the output file, which is different depending on whether you are using the command line version of ChucK or the graphical version (the miniAudicle). Yes, ChucK was originally a command line program and remains so today, but there is also a graphical version which I recommend using instead, or at least that's the one I use. So you see there are some stumbling blocks to the software so it is best to begin with the example Guitar Mouse program if you want to get started on this project.
Oh, yes, having said all that it would be a cruel tease not to give you the sofware! Here is the link to the downloads page which I have prepared for the guitar motion sensor project: downloads. I will post all the software on that page for your convenience and so that you don't have to wade through all this text to get what you want. Be sure to read all the introductory text, especially the free software usage conditions. Enjoy!
Eeep! There's an ASCII mouse on this web page: <:3 )~ OK, that was a bad joke and an even worse pun, but you probably deserved it you wild, free-thinking musician you! Speaking of mice, your computer mouse is actually an HID, or Human Interface Device that we can use to control guitar effects. Since you certainly must already have a computer mouse (or almost certainly, these days), I am providing you with some ChucKian guitar effects sofware that works under mouse control.
In addition to using the mouse that you already have, we are going to use the microphone that you should already have either built into your computer or external to it. When you run the software, you will play your guitar through your amp in the vicinity of your computer and the microphone will pick up the guitar's sound for effects procesing by the program. If you don't have a microphone then you can get by with a $3 1/4" to 1/8" adapter; just plug your guitar cable into the adapter and plug the adapter into the line-in jack of your computer. The sound will be kind of quiet, or low in volume, if you jack-in your guitar, but you can either amplify it or put a simple extra line of code in the program to boost the signal. Oh, and I almost forgot, Guitar Mouse works much better if you use headphones so that you can hear the effects-processed audio and you don't get a feedback loop from the speakers to the mic. But you can make do without headphones if you don't have them, just keep the volume down or turn the speakers off.
OK, so the code is on the download page, which once again is here. Download the text source code file and put it in a directory somewhere convenient. Then start up the ChucK miniAudicle. Select the File menu and then choose Open. You'll get a pop-up window that you can use to find that directory you made and open up the Guitar Mouse source code file. Then go to the miniAudicle menu and choose Preferences. Click on the Miscellaneous button at the top, then notice the Current Directory that is shown there. This is where ChucK will read and write files by default unless you specify the exact path in your software. You want it to be the same directory as where you keep your ChucK files, or most people would, but anyway set it up however you want and click OK. Now you're ready to run the program.
To run any ChucK program in the miniAudicle, we must first start the virtual machine. Why? I dunno, that's the way the software is set up for some reason. Fortunately it's easy a cake, or is it pie? See that window called "Virtual Machine"? Just click on the "Start Virtual Machine button". Now get your guitar ready and turn on your amp, it doesn't have to be all that loud just loud enough for the microphone to pick it up. Also put your headphones on and plug them into the computer, not the amp. Adjust the volume so you don't blow your ears to smithereens. Select the window with the source code in it that you opened up and click on the green "+" plus sign that says "Add Shred" underneath it. Now you're shredding!
The next thing to do is play your guitar a little bit and move the mouse around at the same time. I know, this requres three hands and you only have two! So just use one hand to pluck string six (that is, the thickest string of course) and the other hand to move the mouse. Hear the effect? What's happening is that the mouse is controlling two dimensions of Wah. The horizontal mouse motion controls the lower Wah that represents the first formant of vowels in human speech. The vertical mouse motion controls the upper Wah that represents the second formant of vowels in human speech. Together the guitar and these two Wahs sort of - not really exactly but kinda-sorta - simulate a person pronoucing vowels. The guitar is acting like the vocal chords and the Wahs are acting like the throat and mouth, or in other words the vocal tract. If you move the mouse around and sync it up to your string six plucking, you can make the thing say "do you". Actually it's more like "oo-ou" with the first initial pluck of the string lending a bit of a "d" consonant sound to the start of it. So anyway, just play around with it a bit and have some creative fun - you've earned a little entertainment!
Little did you realize, but the program was recording all that nonsense that you just created in a file called "Guitar_Mouse.wav". So now you can play that file back and hear your effects but first you must quit the Guitar Mouse program and there's a trick to doing that. First click on your operating system's background wallpaper, then press the "x" key (lower case x). The trick was that you must first do that click, and the reason is that if you don't do that click then the lower case "x" that you type will get inserted into the source code which is obviously a bad idea. Why it works this way, I don't know. ChucK is not perfect, he's just ChucK. So now you can go listen to your Wah jam if you like.
Well, that's the demonstration of controlling guitar effects using HID's. Hopefully you got a feel for what it's all about and that should help you decide whether you would like to invest your time and money into the hardware project. Good luck with your decision, and may the mouse <:3 )~ be with you!
Although the mention of gestures might make you think of hand gestures such as a thumbs-up or a middle finger, heh, in the context of Human Interface Devices a gesture is sort of a quick little motion that does something useful. In some software packages, for example, making a little circle with the mouse might call up a menu or zoom the screen. The operator learns to use these gestures to accomplish things faster and easier.
We can do the same sort of thing with our guitar motion sensor by programming the software to watch for the accelerometer signal changes that correspond to certain gestures made with the guitar. These include knocking on the body of the guitar just like knocking on someone's front door, recoiling the guitar as if it just fired a flare out of the headstock, making little clockwise or counter-clockwise circles with the headstock, or simply lowering or raising the headstock in a sudden rapid motion.
Some of the uses for gestures are: to act as an on/off switch for the effects, to lock the effects into place so that further motion does not change them, to unlock the effects, to access a menu system for selecting effects, or to make the software do special things like kick in a vocoder, play an audio sample, record/play an audio loop, or perhaps even to substitute a synthesized instrument under guitar control such as making your guitar play drums or saxophone. So gestures are quite useful and their use expands the realm of possibilities of the guitar motion sensor, as well as serving as a solution for various critiques of the system that some people make.
I have been posting about this guitar motion sensor project to some music and guitar forums and received some very eye-opening constructive criticism and suggestions from guitarists who are certainly way more experienced than I am. Musicians are so nice... they will shoot your ideas down and then sugar coat the bitter pill with a compliment to make it easier to swallow and I appreciate their kind way ot telling me to rethink some things! Specifically, no guitarist seems to relish the notion of a USB cable running down the neck of the guitar, nor do they enjoy the concept of circuit boards mounted on the headstock. So I conclude that mounting the sensor on the headstock is a plan that I should abandon immediately.
Instead I will mount the circuitry on the tail of the guitar. I had avoided that option because I couldn't think of a good way to secure the device there without messing up the guitar's paint and because I wanted the maximum possible signal strength. Well, attachment is no longer a problem since one musician offered the brilliant suggestion that I could just use an angle bracket ans secure the device to the strap pin on the tail end of the guitar. What a great idea! Regarding signal strength, it was suggested that these accelerometers are very sensitive as evidenced by the accelerometer in the Apple iPod Touch and iPhone, which is used as a gaming interface and responds to very delicate motions. Furthermore, the accelerometer chip manufacturer claims very low noise figures and the ADC has a full 12-bit resolution, so there should be enough sensitivity to detect the motion at the tail of the guitar, or at least I believe this to be true. So the current plan is to mount the device on the tail of the guitar.
Also I have decided to use just one 3-axis accelerometer chip, not two of them. The reasons are that the math behind a dual-accelerometer setup is too advanced for my current understanding and besides, we need those other inputs to interface some controls. As to the math, tracking the guitar's motion in three dimensional space and including all three angles of rotation would require something called Euler angles. The math behind that involves 3x3 matrix equations with trigonometry functions filling the matrices, and that's just for angular transformations - I didn't even try to figure out the linear transformations on top of that. Basically it's the same math that NASA uses to dock the space shuttle and suffice to say it's way over my head! So full tracking is out the window. It would be possible to simplify the math by assuming that the guitar stays aligned vertically all the time, but why be so restrictive and then have the thing stop working right if the guitarist lifts up the guitar or something? Far better is to just use one accelerometer chip and calculate the angles as was described at the top of page one.
For the buttons, some guitarists indicated the necessity of a kill-switch, or on/off switch, which can be easily accommodated by using one of the analog inputs to detect either ground or +5V from the switch. Also some guitarists voiced concern about the need to lock the effects, and long story short they want a button for that. This way you can gyrate into some position where you're happy with the effect, then lock that in for the duration of your performance. No problem, a button they shall have.
With the new mounting scheme and the need to put a button and a switch on the project, an enclosure is now required. I will probably use a simple box-style enclosure with a screw-down cover, probably from Radio Shack or Digi-Key depending on whether Radio Shack has an appropriate one or not. Simple enough, just put it in a box.
So that's the current plan as of today. Things may change, but in any case I'm sure glad I wrote all this up and posted about it to the forums because people are offering some excellent suggestions to improve the project. Thanks to all who contributed their thoughts and ideas.
One guitarist on a forum mentioned that there exist pedals that connect somehow to the computer and use existing effects software to modify the audio signal that is passing through the computer. This would be a totally different way to go with the project and it has the advantage that the guitarist would have the full set of proprietary effects available to them, not just the few effects that I will be able to create in my own software. To me, it's a great way to go, but it will take lots of time and effort to research it plus it may be difficult to obtain the proprietar information of the pedal signals. I just mention it as a possible future alternative for the product and anyone reading this who is in the biz and / or in the know can take the idea and run with it. After all I don't own these ideas, I'm just reporting them for the guitar world to enjoy!
|
copyright 2008 Les Hall
My stuff: Sports Prediction, Commentary, Oscillator, Music, HS TechSpy, and Dome Homes. |
Hit Counters |
Contact me inventor-66@comcast.net |