Electronic Ocarina
Moderators: adafruit_support_bill, adafruit

Electronic Ocarina

by maria9876 on Thu Feb 17, 2011 7:02 pm

I want to build an electronic ocarina (flute-like instrument) but I need some questions answered.

Theoretically, if I put different tones on the SD card, then when the person plugs in headphones to the headphone jack on the instrument, they will hear each note played depending on the amount of holes covered.

I was going to use either the adafruit wave shield or the music & sound add-on pack to make my life a little easier. I was wondering:
1. Will I be able to attach and integrate light sensors on the shield?
2. Will I be able to control and program when the sounds are played using separate buttons?
3. Basically, by using this shield, how limited will I be in terms of add-ons (buttons, etc.) and programming?\

every piece of advice is useful. Thanks!
maria9876
 
Posts: 19
Joined: Tue Oct 05, 2010 9:35 pm

Re: Electronic Ocarina

by adafruit_support_bill on Thu Feb 17, 2011 7:31 pm

1 - yes
2 - there is sample code showing 6 different sounds attached to 6 buttons.
3 - for a musical instrument I think that the basic limitations are:
    The wave shield is not polyphonic. It can only play one sound at a time (probably not an issue for an ocarina)
    the .wav files are a fixed length - to generate a long continuous tone you would have to play the file over and over.
    There is a short but perceptible delay when transitioning between .wav files. So a long tone would sound like a bunch of shorter tones.
User avatar
adafruit_support_bill
 
Posts: 30867
Joined: Sat Feb 07, 2009 10:11 am

Re: Electronic Ocarina

by maria9876 on Thu Feb 17, 2011 7:45 pm

Thanks! I was wondering where the sample code with the buttons is. I looked around, but can't locate it.
maria9876
 
Posts: 19
Joined: Tue Oct 05, 2010 9:35 pm

Re: Electronic Ocarina

by adafruit_support_bill on Thu Feb 17, 2011 8:52 pm

User avatar
adafruit_support_bill
 
Posts: 30867
Joined: Sat Feb 07, 2009 10:11 am

Re: Electronic Ocarina

by maria9876 on Sun Nov 11, 2012 3:59 pm

I was looking at the MIDIsense board for making the electronic MIDI flute because it would be easier to program the sounds because I would avoid having to write code to loop the sounds and all that. I would just have to program when a certain combination of buttons (triggers) yields a certain tone. The problem is that the MIDIsense doesn't seem like it actually stores the midi patches, but hooks up to a device that does.

Is there anyway to avoid having to hook up the instrument to external MIDI controllers, but be able to access a specific patch from the board itself (even just one is fine)? This would avoid having to lug around a giant MIDI keyboard or haul around a computer every time I want to use the instrument. Does anyone know of such a thing? Thanks.

MIDIsense: http://www.ladyada.net/make/midisense/

Also, does anyone know how I could integrate buttons into this, or would I have to use a shield?
maria9876
 
Posts: 19
Joined: Tue Oct 05, 2010 9:35 pm

Re: Electronic Ocarina

by tastewar on Sun Nov 11, 2012 9:13 pm

Not sure that MIDI is what you want. It really is all about communicating musical note information from a user interface device (think: keyboard) to a synthesizer (or other device capable of actually making sound). I think that the MIDISense is designed to help you create a user interface (the physical ocarina part of your project), but it implies that you already have a "back end" capable of actually producing sounds from those MIDI descriptions.

If you want an all-in-one project, I wonder if you wouldn't be better off with a variation on the WAV shield theme, which would be the rMP3 shield http://www.roguerobotics.com/products/electronics/rmp3. You could have mp3 recordings of the tones you want, make them as long as the longest note you'd want to be able to produce (say... a minute). When you switch from one note to the next, you stop the current track and start another. I don't know exactly how smooth this transition would be, though. You could also consider the Arduino Due https://www.adafruit.com/products/1076 with its audio capability http://arduino.cc/en/Reference/Audio (no personal experience).
tastewar
 
Posts: 352
Joined: Thu Mar 17, 2011 10:16 am

Re: Electronic Ocarina

by maria9876 on Sun Nov 11, 2012 9:49 pm

Thanks! These are great ideas, but I need to do more research. If I used a MIDI shield, would I still have to loop sounds to get a sustained pitch, or would it do that automatically?
maria9876
 
Posts: 19
Joined: Tue Oct 05, 2010 9:35 pm

Re: Electronic Ocarina

by tastewar on Mon Nov 12, 2012 12:33 am

No; you shouldn't have to loop. It should be just like holding down a key on a keyboard (depending on the instrument chosen, of course). Here's a couple of possibly relevant links:

http://www.instructables.com/id/VSS1103b-Standalone-MIDI-Synthesizer/
http://shop.mutable-instruments.net/products/shruthi-1-kit
tastewar
 
Posts: 352
Joined: Thu Mar 17, 2011 10:16 am

Re: Electronic Ocarina

by maria9876 on Mon Nov 12, 2012 1:19 am

So I suppose it makes sense that there isn't a MIDI board out there that allows you to just add one, or a few patches onto the board without an external input, because the purpose of MIDI is to have many available patches and even if you were to load a few, you would need another cable hooking up to the input part of the instrument (buttons) which seems redundant. So I guess going the other direction is the best answer. I'm sure there's a way to have smooth playback.
maria9876
 
Posts: 19
Joined: Tue Oct 05, 2010 9:35 pm

Re: Electronic Ocarina

by tldr on Mon Nov 12, 2012 3:57 pm

have a vidi at the code in this post. modifying it for your project would mostly involve removal of existing code and the addition of some code to sample and debounce switches.

there is a table of values for an eight bit sin wave, another table of values with the size of steps to be taken through the table to generate the frequencies for various notes. for each note to be played just look up the offset and let things run. there's some weird 24 bit, (8 bit integer + 16 bit fraction), fixed point arithmetic, but i hope it's not too hard to dope out.

instead of the sin wave, you could start with a sample of a real sound, modify the maths a bit and wind up with a bastard ocapiano or ocaroboe or something.

don't now what to tell you about a wind controller, but i've seen arduino projects that implement them. i guess another button would do to turn the breath on and off.

the hardware is really simple. a cap and a resistor for the low pass filter on the audio out and say, five buttons, (four hole ocarina, with breath button), with pullups enabled on the i/o lines.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: Electronic Ocarina

by maria9876 on Mon Nov 12, 2012 7:05 pm

Synthesizing the sound is a great idea! I just don't know if the Arduino (16 MHz) will have enough Hz to do that. I mean it probably will, but I'm wondering if I will need the Arduino Due (84 MHz), or maybe even one in between? What do you think?
maria9876
 
Posts: 19
Joined: Tue Oct 05, 2010 9:35 pm

Re: Electronic Ocarina

by tldr on Mon Nov 12, 2012 8:12 pm

maria9876 wrote:Synthesizing the sound is a great idea! I just don't know if the Arduino (16 MHz) will have enough Hz to do that. I mean it probably will, but I'm wondering if I will need the Arduino Due (84 MHz), or maybe even one in between? What do you think?


i used a boarduino with the resonator left off so it was only running at 8MHz since i was testing code to run on a minipov board. plenty of headroom at 16MHz. and running at 16MHz eliminates the 15KHz hum that you hear in the video, or, at least, moves it up out of the range of most human hearing.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am