Hi,
Perfect newbie here
The music module is taking a long time (~90 seconds) to pass the
block. Is it normal that it takes so long? I'm using a FEZ Spider.
Thanks,
Davide
Hi,
Perfect newbie here
The music module is taking a long time (~90 seconds) to pass the
block. Is it normal that it takes so long? I'm using a FEZ Spider.
Thanks,
Davide
Can you show the rest of your code? Can you try it on a different S socket on the Spider? Or with a different music module or mainboard if you have any.
if (isRecording)
{
try
{
multicolorLed.BlinkRepeatedly(GT.Color.Yellow);
iAudioAttempt++;
string strFilename = "Record_" + iAudioDuration.ToString() + "_" + iAudioAttempt.ToString()
+ "-" + System.DateTime.Now.Year.ToString() + "-" + System.DateTime.Now.Month.ToString()
+ "-" + System.DateTime.Now.Day.ToString() + "_" + System.DateTime.Now.Hour.ToString()
+ "-" + System.DateTime.Now.Minute.ToString() + "-" + System.DateTime.Now.Second.ToString()
+ ".ogg";
using (FileStream recordingFile = sdCard.GetStorageDevice().OpenWrite(strFilename))
{
music.RecordOggVorbis(recordingFile, Gadgeteer.Modules.GHIElectronics.Music.patch_ogg);
Debug.Print("Waiting for the module to be ready");
while (!music._isReadyRecord) ;
multicolorLed.TurnColor(GT.Color.Red);
Debug.Print("Starting recording...");
// record for 'iAudioDuration' seconds
Thread.Sleep(iAudioDuration * 1000);
stopRecording();
}
...
void stopRecording()
{
isRecording = false;
music.StopRecording();
// Wait until recording is done
while (music.IsBusy)
Thread.Sleep(10);
Debug.Print("Recoding is done.");
// Unmount the SD card
sdCard.UnmountSDCard();
multicolorLed.TurnColor(GT.Color.Orange);
}
I would thread.sleep(10) in that wait loop as well to allow other stuff to run. Not saying it’s related but I’d make that change anyway…
@ Brett - As a matter of fact that has taken the waiting time down from about ~90 seconds to about ~50. Still very long but much better. Any idea why that is?
Thanks.
When you start recording, the patch has to be sent to the device. In total it looks to be about ~55KB for the built in patch. On the Spider, all of those 50 seconds are spent preparing and sending the patch. Increasing the SPI clock does not help much. Switching to the Raptor brought it down to ~3 seconds though.