AdaFruit Wave Shield Exemples
Getting Stack overflow errors?
These examples are all tested to work with v13 or higher, so try to use that if possible!
Avoir plus de RAM et de Flash!
Note MCHobby: Les plateformes Arduino sont maintenant distribuée avec un ATmega328.
Cette section n'est vraiment pertinente que si vous ne possédez pas d'ATmega328.
Avant d'essayer de jouer de l'audio, vous aurez besoin de faire un peu de place
la mémoire RAM d'Arduino, cela évitera que cela se termine en vilain
dépassement de pile (stack-overflow). Manquer de mémoire RAM est difficile à déboguer et frustrant, d'autant plus si vous disposez d'un ATMega168
Suivez ces instructions (anglais) pour savoir comment avoir plus
de RAM en réduisant la taille de la mémoire tampon de la librairie série (Serial library).
Vous n'aurez pas besoin de faire cela si vous avez un ATmega328.
Notez que la librairie est vraiment grosse (approximativement 10K). Si vous voulez faire beaucoup plus avec Arduino, il est vivement conseillé de faire un Upgrade vers un ATmega328. Ce shield a été développé en prévoyant la disponibilité d'un ATmega328.
Generating speech
If you want a human voice in your project, you can use the free generator at AT&T Text-to-Speech demo page (sais aussi parler en français :-) )
It will create a 16KHz, 16-bit audio file so you can use the audio 'right out of the box'
Sound sample library
Here is huge collection of C.C. Attribution licensed sound samples! A lot of it is already mono, 16 or 22KHz
Digital audio player
This is the simplest example. It plays every audio file it finds on the SD card in a loop. This sketch is also included in the library
- Sketch (for the original AF_Wave library)
- Sketch (for the newer waveHC library also check the WaveHC library zip for any newer revision)
6 buttons, 6 sounds, multiple possibilities!
Here is a collection of different playback techniques with 6 buttons (connected to analog 0-5)
You can change the # of buttons and what they're wired to easily. This isn't an exhaustive list but will give you some ideas about how you can do a lot with the WaveHC library. Note that all the changes occur in loop(). The button checking and everything else is the same.
- Play the wave file all the way through, and only once
- Play one wave file all the way through, in a loop
- Play all the pressed wave files all the way through, in a loop
- Play the wave file only when the button is held down and only once (kind of like a musical keyboard)
- Play the wave file only when the button is held down and loop it (kind of like a sampler keyboard)
- Play the wave file all the way through and loop it, but allow other buttons to interrupt
- Play the wave file all the way through once, but allow other buttons to interrupt
Playing sound based on input
This example plays 6 different files depending on whether buttons connected to the 6 analog input pins are pressed. (for AF_wave)
This similar example plays 6 different files but its for WaveHC library (theres a walkthrough here)
This one plays 4 different files depending on serial characters, good if you have say an xbee you want to use
Changing the playback rate
By messing with the playback interrupt, [you can change the speed of playback for an interesting effect].
[Here is the sketch], connect the potentiometer to analog pin 0 (or change the code)
Halloween pumpkin
An example of using a sensor to trigger sounds, as well as animating LEDs based on the volume
Volume control via software
By changing the #define DVOLUME 1 in wave.cpp and recompiling you can do rudimentary software volume control as in this sketch