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

Thread: Need more sound sample memory

  1. #1
    Senior Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    126

    Need more sound sample memory

    I want to load a few instrument samples (flute, piano, drums, etc.), but run out of memory quickly.
    Is there a way to "move" memory from "Program" to the "other". Now its usage is 4% vs. 65%. To get to 65% from 94%, I had to limit my instruments to a very few.
    And I don't want to add the memory chips because it will complicate my production very much.

    Or should I use smaller (lower quality) samples? Do you have some I can borrow?

    This is what I get now:
    Program size: 292,352 bytes (used 4% of a 8,126,464 byte maximum) (13.02 secs)
    Minimum Memory Usage: 339732 bytes (65% of a 524288 byte maximum)

    Thanks.

  2. #2
    Junior Member
    Join Date
    Mar 2020
    Posts
    2
    Why do you need to load the entire sample into memory?

    To store a sample in program memory the following should do I guess:
    Code:
    constexpr size_t SAMPLE_SIZE = 131072;
    
    __attribute__((section(".text")))
    const static int16_t sample[SAMPLE_SIZE] = {
        0, // ... sample data goes here ...
    };

  3. #3
    Senior Member
    Join Date
    Dec 2019
    Posts
    129
    You can use PROGMEM to store variables in flash, EXTMEM if you have PSRAM installed. There is also another post on the forum regarding loading wavetables from an SD card to memory.

    Code:
    EXTMEM uint32_t foo[20352];
    
    PROGMEM uint32_t foo2[20352];

Posting Permissions

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