Some programming examples.

· 01_Play_Dacs
Play_Dacs is a simple example of how to set-up a stream from the memory to the DACs, open a sound file, play it on the stream and control the play-back. It does not use the DSP.

· 02_Rec_Mike
Rec_Mike is an example showing the basic way recording can be done. This example records from the microphone, and therefore is not very useful. But the mechanism of recording remains the same whether you record from the microphone of from the DSP. It does not use the DSP.

· 03_Dig_Ears
Dig_Ears shows how to set-up a stream from the DSP to the DACs, and get samples from the SSI port. If you have MetaResearch's Digital Ears, you can plug them in the DSP port, and use this example to play a source in real time through the DSP to the DACs. It uses the DSP, shows how to set-up the streams and the DSP, and how to pass data to the DSP to control its action on the sound (e.g. the volume at which the sound is played back etc...), and how DMA functions. If you have nothing to plug in the DSP port (no Digital Ears etc...) you can make the DSP send a pure sine wave instead (see the C program.)

· 04_Through_DSP
Through_DSP is an example showing how to play a sound through the DSP to the DACs using non DMA transfer from the host to the DSP and DMA from the DSP to the host. You need a sound file 44100 or 22050, mono or stereo. Note that the play back is not totally reliable when the sound is 44100 stereo, due to the high rate of transmission (over 176000 bytes/sec.)

· 05_Convert22_44
Convert22_44 shows how to implement two streams from and to the DSP, and use the DSP to process data really fast. The stream to the DSP is NON DMA, in this case. This example performs a sampling rate conversion from 22050 to 44100 mono or stereo. To use it, type
    convert22_44  inputSoud.snd outputSound.snd
The sample rate conversion is a simple interpolation, without filtering. Another way to do that is to add a zero after each sample, (getting l,r,l,r,l,r and replacing it by l,0,r,0,l,0,r,0...) and filter the result to remove the high frequencies.
Note that we could have done it using the function SNDRunDSP() (much simpler). 

· 06_DMA_DSP
DMA_DSP shows you how to set-up a DMA stream from the host to the DSP then to the DACs, and play a sound on it. It involves DMA transfer in both directions. The faster rate of transmission of DMA makes it possible to reliably play sounds at 44100 stereo (provided the high water mark in the driver is high enough, see the C program.)

· 07_IBulder_and_Sound
07_IBulder_and_Sound contains an example showing how to use the snddriver functions, stream set-up and DSP stuff to perform real time sound processing. It implements an Effect Box processing the sound coming from the Digital Ears in real time, with real time control over the effects. The set of effects includes:
- FIR and IIR filters
- All-Pass filter (Sort of reverb)
- Sine modulation
- Pitch shifting
- Spatializer
- Chorus / Phasing / Vibrato and FM
- Delay (up to 5 seconds)
- "Slow_play" To play sound files half as fast without altering the pitch...

· 08_Codec_convert
Finaly, 08_Codec_convert shows you how to perform CODEC conversion. It records about 4 seconds of sound from the CODEC microphone, and plays it through the DACs using a conversion algorithm implemented on the DSP. Here again, the function SNDStartPlaying() would do that just as well and probably better! But if you're interested in CODEC format, this is for you.

· 09_DSP_Src
This directory contains DSP sources for sound effects, and a template C program to run them on the Digital Ears input sound. Sound effects include a pitch shifter, a spacializer, and a phasing.