Light Saber sound card project

Status
Not open for further replies.

forsytjr

Member
I've been working to try to put together a sound card/LED controller for a light saber. The hilt inner diameter is 1.25", so that is my size limit. I've been trying to get stuff working with an Arduino pro mini 3.3v, a 6050 based IMU, and a couple alternatives for the sound. The 6050 IMU using the FreeIMU seems to work fine for what I want. But I've been struggling with sound. I tried a WTV020-sd-16p and could get it to play OK, but it looks like it can't do gapless playback - or at least no one has figured it out that I can find. I then got a WT588d. Unfortunatelyi I haven't figured this one out either. It looks like it requires an external programmer. Maybe it can be programmed via SPI, but the documentation is awful with bad translations. I want to be able to change the sounds of what is in there via usb or an SD card.

So I then happened upon the teensy audio library, and it looks perfect for what I want to do. Even if I could get one of the other boards working, the capability to mix sounds and do some audio processing is very attractive.

So I'm looking to ditch the arduino pro and get a teensy 3.1. But the teensy audio board is just a little too wide - around 1.5". So my first question is would the teensy 3.1 be enough itself to do what I need. I was looking to hook up an 8 ohm speaker with a 2W max (but I think 0.5-1.0 watts is fine). The audio would be mono. I can convert the files to ad4 or something if that helps. If I use the DAC output, I assumed I would need some sort of amp? I was looking at: https://www.sparkfun.com/products/11044. I think 12 bit audio should be good enough quality, although it would be nice to get to 16bit. Besides running the audio the board would also need to take in data from the 6DOF gyro (it has its own processor, so wouldn't need to crunch too many numbers), and then send PWM output to three channels for three different LEDs (with mosfet triggers to drive directly off the battery). The sound clips are short, but need to be switched out based on what is going on (swing, clash, blaster effect, etc).

If I can't get a soundboard with an SD card, but just use the teensy, I was thinking of getting http://www.pjrc.com/store/sd_adaptor.html.

Are there other options for sound boards that would fit inside 1.25"? Longer than that is OK, just not wider. Or will I be OK with just the teensy? I worry about having to juggle playing the sounds on top of all the other stuff the board will need to do.
 
I am pretty sure Teensy 3.1 is plenty appropriate for your project; No need for audio board and, if you can 'squeeze' your sound files down enough, you may not even really need an SD adapter.

Teensy 3.1 DAC may be a little wide of Hi-Fi but, for what it is, it is pretty darn good :D
 
Yes the onboard DAC (which also works with the audio library) would be fine for making lightsaber sounds. I would tend to go with synthesis rather than playback of static samples; include acceleration values from your IMU to affect the sound.
 
At least start with File > Examples > Audio > SamplePlayer. You can just open that and program it onto a Teensy 3.1, and then hear some sounds when pins 0 to 5 go low (eg, pushbuttons or touching wires).

You may ultimately decide to do something much more elaborate, but the simplest thing is so very easy to try with the example, so at least give it a try and maybe convert your own sounds to replace those drum samples.
 
At least start with File > Examples > Audio > SamplePlayer. You can just open that and program it onto a Teensy 3.1, and then hear some sounds when pins 0 to 5 go low (eg, pushbuttons or touching wires).

You may ultimately decide to do something much more elaborate, but the simplest thing is so very easy to try with the example, so at least give it a try and maybe convert your own sounds to replace those drum samples.

Thanks to both. Yes, I've already been looking at the samplePlayer code, so I was going to start with that, without an amp. Then add the amp if needed. Then on to putting the data onto the SD card, and seeing if I can play from there.
 
Yes the onboard DAC (which also works with the audio library) would be fine for making lightsaber sounds. I would tend to go with synthesis rather than playback of static samples; include acceleration values from your IMU to affect the sound.

Reading out of order and didn't see this one. By synthesis, I imagine you mean synthesized sounds, like sin waves and such? There are actually lot's of customized "sound fonts" that people use in commercially available sound cards. I got a prizm sound card for my wife's saber - http://www.plecterlabs.com/catalog/product_info.php?products_id=1172. More "sound fonts" are available at http://www.saberfont.com/. These sound fonts have a hum sound, but then when you slash, clash, etc, it puts the additional sounds on top of the hum (pre-mixes), so it sounds very seamless as long as you can do gapless playback. Generally you have the hum, then switch to a random copy of a premixed sound based on the motion. E.g. there are 8 different slash sounds, so you randomly pick one if the motion senses a slash. Some sounds are triggered by a button press, like blaster deflections, force push, etc. So I think I have a handle on the sounds I want to play and when. If I can get that working, then I can play with doing stuff like doing a frequency and/or amplitude modification based on swing rate.
 
Thanks to both. Yes, I've already been looking at the samplePlayer code, so I was going to start with that, without an amp. Then add the amp if needed. Then on to putting the data onto the SD card, and seeing if I can play from there.

Teensy 3.1 has 256kb of Flash on board... that's not a huge amount, but you should only need a few seconds of samples, so you should be able to cram the samples you need in without needing external storage.

Are you planning to incorporate accelerometers to detect the sabre's movement and play sounds accordingly?

James
 
Teensy 3.1 has 256kb of Flash on board... that's not a huge amount, but you should only need a few seconds of samples, so you should be able to cram the samples you need in without needing external storage.

Are you planning to incorporate accelerometers to detect the sabre's movement and play sounds accordingly?

James

Yes. Accelerometer and gyros. There are sound banks available with stabbing sounds, spin sounds, variable ignition sounds based on orientation, etc. So I should be able to trigger sounds accordingly. Even better would be to modify a fixed sound directly in response to the motion. E.g. Add a doppler shift based on swing rate. I've hooked the gyro up, swung it around and logged the data, and it looks very useable for what I want to do.

For pre-mixed sounds, 256kb won't be enough, especially if I want several options of sound fonts to choose from. A fully featured sound font I think is around 1M. But it will be plenty to load the hum, a few swings, and a few clashes, and see how things go.
 
Came across an interesting and in-depth article about how the original lightsaber sounds were produced, and how to recreate that with recorded sounds:
http://www.dblondin.com/071807.html

or, for sounds made by other people, there is a star wars pack on freesound with CC0 license
http://www.freesound.org/people/joe93barlow/packs/5968/

That first article is a great find! That gives a lot of insight that could be useful for how to mix some basic sounds based on the motion, rather than going with pre-recorded sounds that trigger based on the motion. The medium cost sound cards basically trigger a swing sound when you hit a certain motion threshold. It would be great instead to have the effect by done in proportion to the swing rate, so that it is a more continuous thing. This is going to be fun!
 
FYI, this is a sound font I bought:
https://www.youtube.com/watch?v=4uEg4cwOySU
That's the kind of functionality I am going for, or hopefully even better. The sound card in the video is around $175 and very tough to get your hands on as one guy makes them all by hand. The guy in the video was the person who made my wife's saber. I added the sound to her saber using a lower cost sound card that I could actually get my hands on.
 
I got the board and and wow, I'm impressed! Got the sample player working, and played around with some synthesizer sounds and effects. The library is great!
 
OK, the project is going very well. I have my IMU6050 working in conjunction with the teensy. I set up several synthesized sounds following http://www.dblondin.com/071807.html, using pulse wave forms with filtering and it does a pretty decent hum. I then used the gyro rate magnitude to vary continuously the frequency and amplitude of one of the sounds. Although I'm not happy with the the synthesized swing sound I came up with, it's a very cool effect to have it smoothly varying, rather than triggered once hitting a threshold. On searching, I found this nice video of a wii remote with some sophisticated synthesized sound techniques - would be wonderful to reproduce that. I guess they use a technique called granular synthesis. I found some free packages that support this kind of stuff (csound). Seems like the kind of think I could work on for the next few years to couple something like that in. ;) In the meantime, I tried converting some of the professionally created saber sounds and playing them, and a single file fills up the memory (no SD card yet). So I am definitely going to add an SD card. I figure I can get those sounds working while I continue to play with synthesized sounds.

QUESTIONS:

1) If I am getting an SD card anyway, I was considering trying to cram the Teensy audio card into the saber somehow, since it comes with one, and that would also get me 16 bit sound. However, it is about 1/4" too big. Would it be possible for me to cut off the side with the headphones since I won't be using them? Comparing the schematic and board picture here: https://www.pjrc.com/store/teensy3_audio.html, it looks like I might be OK, as that section has the flash memory spot (not used now), the headphones, and the volume control. It looks like maybe I could trim a little bit off the other side too.

2) Whether or not I use the sound card (I think I will get one in any case to play with) I got an amp off sparkfun - https://www.sparkfun.com/products/11044. It's a bit big and I'm not completely happy with the quality at the volume I am looking for. I have an 8 ohm speaker and looking for around 1W. Any other ideas for a very compact mono amp? I'm not hugely worried about power consumption (this one uses PWM to reduce power use). The LED's I'm driving will draw 1-3 amps anyway. And there will be a kill key to shut off power when not in use. Being able to drive the amp volume using a signal from the teensy would be great too.

3) Is there anyway to compile and run the audio library directly on the PC to make testing of different synth sounds quicker then repeatedly downloading onto the teensy? Probably not, but thought I would ask. Or maybe a generic app that will let you build up synth sounds in a similar way (I'm looking at csound for that).

Again, I am thoroughly impressed with this board and the library! My board so far is pictured below. That amp is almost as big as the teensy! Another note, I am open to building up some circuits myself, like for the amp, and will need to build the mosfet or transistor switches for the high power LEDs. I have been playing with fritzing and may etch a circuit board for these kinds of things.
board.jpg
 
Last edited:
Status
Not open for further replies.
Back
Top