Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Recording multiple audios one after another with different name and playback

  1. #1
    Junior Member
    Join Date
    Aug 2016
    Posts
    8

    Recording multiple audios one after another with different name and playback

    Hi all,

    I am working on a project which requires to record multiple audios in the memory card in different unique names. Then playing back by selecting the unique name.
    In the example code it will record and when recording next time it will delete the old file.

    void startRecording() {
    Serial.println("startRecording");
    if (SD.exists("RECORD.RAW")) {
    // The SD library writes new data to the end of the
    // file, so to start a new recording, the old file
    // must be deleted before new data is written.
    SD.remove("RECORD.RAW");
    }
    Is there any example which shows recording of multiple audio files in different name. Then playing back by selecting different names.
    Also does any one know how many minutes we can store in a 8 GB memory card.

    Thanks in advance

  2. #2
    Junior Member
    Join Date
    Aug 2016
    Posts
    8
    Waiting for reply...

  3. #3
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    Hi,

    I took a look at the example code when you initially posted your question, but didn't feel qualified enough to give an answer. Anyway, here's my "opinion":
    I guess you need to instantiate multiple files:
    Code:
    File frec1;
    File frec2;
    File frec3;
    and you can then record into different *.raw files like so:

    Code:
    void startRecording1() {
      if (SD.exists("RECORD1.RAW")) {
        SD.remove("RECORD1.RAW");
      }
      frec1 = SD.open("RECORD1.RAW", FILE_WRITE);
      if (frec1) {
        queue1.begin();
        mode = 1;
      }
    }
    void startRecording2() {
      if (SD.exists("RECORD2.RAW")) {
        SD.remove("RECORD2.RAW");
      }
      frec2 = SD.open("RECORD2.RAW", FILE_WRITE);
      if (frec2) {
        queue2.begin();
        mode = 1;
      }
    }
    // and so on...
    Or you could use a single record(int number); function where "number" tells the function which file to write to.

    This is just my guess and untested, I hope it helps...
    -Ben

  4. #4
    Junior Member
    Join Date
    Aug 2016
    Posts
    8
    Thank you very much for the reply.

    -Adarsha

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •