Music Maker FeatherWing - Saving data on SD while Playing Music ?

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
IoTAll
 
Posts: 228
Joined: Wed May 31, 2017 6:34 pm

Music Maker FeatherWing - Saving data on SD while Playing Music ?

Post by IoTAll »

Hi !

I am trying with the Music Maker FeatherWing to save data on the SD card while playing music from an mp3 file from this same SD card, but each time I try to save some data to a file, it doesnt manage to open the file, or worse, it corrupts completely the data on the SD card.

I am using this function to play the music: "interrupt based / non-blocking playback via startPlayingFile()"

To create and wirte data I use this code:

Code: Select all

  file = SD.open(FilePath, FILE_WRITE);
  file.print(FileContent);
  file.close();

I am using this Music Maker FeatherWing with an M0 proto feather, the motor featherwing and the 128x64 LED featherwing.

My question concerning thisis: is there a way to safely play music and save data on the SD card at the same time?

A second question : is there a way to stop the music while it is playing? I couldnt find what command does this.

Thank you!

User avatar
IoTAll
 
Posts: 228
Joined: Wed May 31, 2017 6:34 pm

Re: Music Maker FeatherWing - Saving data on SD while Playing Music ?

Post by IoTAll »

I found the answer to my second question. I just needed to ready the library code. :)
For those looking for it here it is:

Code: Select all

musicPlayer.stopPlaying();
Still wondering about my first question though...!

Thanks!!

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Music Maker FeatherWing - Saving data on SD while Playing Music ?

Post by adafruit_support_mike »

IoTAll wrote: Sat Sep 17, 2022 9:19 am My question concerning thisis: is there a way to safely play music and save data on the SD card at the same time?
It's more a question of timing than safety.

The SD library can keep more than one filehandle open at the same time, so reading one file and writing another is generally possible. The challengs is keeping them from getting in each other's way.

Writing to Flash memory takes a few milliseconds. At the same time, the Music Maker's VS1053 has to refill its data buffer every few milliseconds to avoid skipping. You'll have to arrange the timing so the writes don't interfere with the reads.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”