FEZ Music Shield recording - minor issues

I am having a bit of trouble getting the Fez Music Shield to do exactly what I want.

First, I want to say that this works perfectly for playback and I have had no issues with the sound quality for recording or playback. This is a 1 month old Fez Music Shield (VS1053) sandwiched between a Panda II (SDK V1.0.19) and a Fez Connect . I also have a LED and Button on unused ports (Di5/Di0).

Using the source code from Driver — FEZ MUSIC SHIELD as well as Driver – Music Shield Extension Playing Steams I have things basically working:
• Starts up and initializes everything, mounts SD, opens FileStream for recording
• Prints Testing recording and calls RecordOggVorbis with stream and waits 30 seconds.
• I believe the next 9 seconds are spend loading the record patch from the OGG array
• For (9s < t < 30s) I get some hiss from speaker (music shield output pin) and it records about 21 seconds of sound.
• Then it finishes up writing the record buffer and closes the file. The file is fine
• I added a bit of code to play the newly recorded file. That works fine too.

I would like to record sound the moment the user presses a button, but it takes too long to initialize the record (mainly loading the patch). The documentation implies that this needs to be done each time. I would like to quickly switch between record/play/record/play. The ADPCM patch is smaller – I have not tried that. It would be nice to pre-load the patch once and then just activate recording when needed.

I eventually want to load the patch from SD – Im hitting memory issues with the array declared in my full project. I am guessing it will not be much slower (30k in less than 9 seconds should be fine). I’m sure I can figure that part out.

Im not sure how to minimize the speaker hiss is during recording. I have not experimented enough. I should try setting the volume to 0. I dont know if it is related to sound from the line-in. Im using low-volume earphone output as line-in during testing, so maybe that is messing things up.

It would be really nice to record and playback at the same time. I could not find any information about a full duplex mode. I know the soft-reset at the beginning/ending of record could not happen.

Does anyone have some wisdom here? I think I have a pretty good understanding of how the vs1053 works (I did a quick read of the vs1053 manual & the VobOrbitz recording manual)

This is needed by the codec chip just to be sure you are clear.

I do not think this is supported by the codec.

You can always use a larger FEZ with more RAM for buffering and maybe use RLP for recording drivers.

I did a bit more experimenting and research:

The Ogg Vorbis encoder takes over memory and interrupts on the vs1053 that are needed by the decoder. So duplex is impossible with Ogg Vorbis. A software reset is necessary to bring the chip into a state where it can decode again. Also, some initial values are overwritten during encoding so the patch need to get reread before each file. It is unlikely that reloading the patch will be faster than 5 seconds.

The solution is using ADPCM encoding (which is fine for my needs). There is a tiny patch (80 bytes) that should not need to be reloaded. The VLSI site has examples for full duplex, but I think you need to be decoding a similar & simple format. (I really don’t need this)

Line-in is played on line-out. The solution is to set the volume to low. (not zero [FF FF], that turns off
the whole analog part of the chip)

The VS1053 is a great ASIC with more features and plug-ins than I am able to use. The VS1063 has the encoders built-in and can do full-duplex Vob Orbis, but I think it is missing MIDI. The VLSI VSDSP Forums are very helpful.

I should have a pretty nice doorbell when this is all done (Visitors can leave a message that gets announced & emailed)

talking doorbell, sounds very FEZ !

[quote]but I think it is missing MIDI[/quote] It only plays Midi format 0. You may need to download a free converter to change Midi 1 or Midi 2 format files to Midi 0.