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

Thread: How to read an EXTMEM array within an audio object

  1. #1
    Junior Member
    Join Date
    May 2016
    Nice France

    How to read an EXTMEM array within an audio object

    How would you go about sharing EXTMEM data between main sketch and audio objects?

    say if I create a large EXTMEM word audioData[] array in my main sketch, fill it with random data in setup().

    How can I access it within the update(void) of a custom audio object?
    Sorry if I'm missing something obvious - can't get my head around it
    Thanks in advance!

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Just seeing this unanswered - was a solution found? ... don't have the answer offhand ...

  3. #3
    Senior Member
    Join Date
    Apr 2020
    I'm replying here because the stuff I've found on using EXTMEM seems over my head. I ran the memory test and apparently have 16MB of ram on this thing that works just fine, but I can't access it like PROGMEM just assigning a table to be EXTMEM. As such, I have two tiny wasted chips on this thing.

  4. #4
    Senior Member ETMoody3's Avatar
    Join Date
    Mar 2014
    New Ulm, Mn

    I modified the idea in this thread to use EXTMEM ( scroll down in the thread for audio object files and example code that the snippet below is excerpted and modified from )

    I increased the size of the array to an extreme value, saw no change in the processor ram usage reported during compile, and the effect works.

    There may be some clue in the audio object files that explains why this works, found in how it uses a regular array in lieu of audio blocks. All I did was drop EXTMEM in front of the array this code uses for the delay line.

    #define DELAY_MAX_LEN 882000 // buffer for samples @44100 samples per second
    EXTMEM int16_t sample_delay_line[DELAY_MAX_LEN] = {};
    void setup(void) {
      AudioMemory(150 * (128 / AUDIO_BLOCK_SAMPLES));
      mixer1.gain(0, 0.7);
      mixer1.gain(1, 0.7);
      mixer1.gain(2, 0.5);
      mixer1.gain(3, 0.0);
      // initialise the delayline
      delay1.begin(sample_delay_line, DELAY_MAX_LEN);
      delay1.delayfade(2, 10000, 3.0);

Posting Permissions

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