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

Thread: Why would a "better" sd card perform worse with the "SdCardTest"

  1. #1

    Why would a "better" sd card perform worse with the "SdCardTest"

    For audio projects, I typically use the classic SanDisk Ultra (A1; 64 GB; U1; XC)

    But after noticing the Amazon Basics (A2; 64 GB; U3; XC) performed better with the Blackmagic Speed Test, I switched to that.

    I soon began noticing issues in performance, so I tested it with Teensy's SdCardTest. Despite better specs and performing much better in the Blackmagic Speed Test, Amazon Basics performed much worse on Teensy's SdCardTest.

    Any idea why?

    Dumb question, but is there a 'coding solution' to optimize for the Amazon Basics? (I ask because I'm sitting on a 'few' of them now...)


    SdCardTest Results:


    SanDisk Ultra
    Code:
    SD Card Test
    ------------
    SD card is connected :-)
    Card type is SDHC
    File system space is 63832.16 Mbytes.
    SD library is able to access the filesystem
    
    Reading SDTEST1.WAV:
      Overall speed = 21.72 Mbyte/sec
      Worst block time = 0.64 ms
        21.89% of audio frame time
    
    Reading SDTEST1.WAV & SDTEST2.WAV:
      Overall speed = 1.27 Mbyte/sec
      Worst block time = 1.45 ms
        49.84% of audio frame time
    
    Reading SDTEST1.WAV & SDTEST2.WAV staggered:
      Overall speed = 1.27 Mbyte/sec
      Worst block time = 1.15 ms
        39.57% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV:
      Overall speed = 1.26 Mbyte/sec
      Worst block time = 2.13 ms
        73.52% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV staggered:
      Overall speed = 1.26 Mbyte/sec
      Worst block time = 1.59 ms
        54.66% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV:
      Overall speed = 1.28 Mbyte/sec
      Worst block time = 2.77 ms
        95.37% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV staggered:
      Overall speed = 1.28 Mbyte/sec
      Worst block time = 1.97 ms
        67.80% of audio frame time

    Amazon Basics
    Code:
    SD Card Test
    ------------
    SD card is connected :-)
    Card type is SDHC
    File system space is 63832.16 Mbytes.
    SD library is able to access the filesystem
    
    Reading SDTEST1.WAV:
      Overall speed = 21.92 Mbyte/sec
      Worst block time = 0.58 ms
        20.06% of audio frame time
    
    Reading SDTEST1.WAV & SDTEST2.WAV:
      Overall speed = 2.83 Mbyte/sec
      Worst block time = 4.57 ms
        157.41% of audio frame time
    
    Reading SDTEST1.WAV & SDTEST2.WAV staggered:
      Overall speed = 2.80 Mbyte/sec
      Worst block time = 4.61 ms
        158.93% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV:
      Overall speed = 2.09 Mbyte/sec
      Worst block time = 4.07 ms
        140.28% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV staggered:
      Overall speed = 2.08 Mbyte/sec
      Worst block time = 4.79 ms
        165.03% of audio frame time
    
    Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV:
      Overall speed = 2.19 Mbyte/sec
      Worst block time = 5.10 ms
        175.75% of audio frame time

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,650
    Blackmagic measures only sequential access speed.

    For playing multiple files without large buffering, the random access read performance matters. Use a benchmark program which measures random access without queue (queue depth = 1). This is the most popular one for MacOS.

    https://apps.apple.com/us/app/amorph...k/id1168254295

    Sad reality is nearly all SD cards perform terribly this way, but some are less bad than others. Before the A1 & A2 rating, virtually all were optimized only for sequential access, because that's the only mode cameras use.

  3. #3
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    611
    Quote Originally Posted by isaacjacobson View Post
    Dumb question, but is there a 'coding solution' to optimize for the Amazon Basics? (I ask because I'm sitting on a 'few' of them now...)
    Yes - https://forum.pjrc.com/threads/70963...(and-recorder). Not specifically for the Amazon Basics SD card, but if you want to give it a try I'd love to know if it works. 2Mbytes/sec should be able to stream 10 stereo files (though it doesn't leave time to do much else!).

  4. #4
    Quote Originally Posted by PaulStoffregen View Post
    Blackmagic measures only sequential access speed.

    For playing multiple files without large buffering, the random access read performance matters. Use a benchmark program which measures random access without queue (queue depth = 1). This is the most popular one for MacOS.

    https://apps.apple.com/us/app/amorph...k/id1168254295

    Sad reality is nearly all SD cards perform terribly this way, but some are less bad than others. Before the A1 & A2 rating, virtually all were optimized only for sequential access, because that's the only mode cameras use.

    Thanks, Paul. That makes a ton of sense. It seems that was the case here.




    Quote Originally Posted by h4yn0nnym0u5e View Post
    Yes - https://forum.pjrc.com/threads/70963...(and-recorder). Not specifically for the Amazon Basics SD card, but if you want to give it a try I'd love to know if it works. 2Mbytes/sec should be able to stream 10 stereo files (though it doesn't leave time to do much else!).

    This looks incredible and would definitely solve my sd audio issues with cards that are a bit shy the necessary specs. I've been following along with the thread, but haven't successfully adapted it to my own code. I'm probably just missing something simple somewhere or have my audio libraries a little tangled. Is there a simple example integrating playing wav from sd?

  5. #5
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    611
    Quote Originally Posted by isaacjacobson View Post
    I've been following along with the thread, but haven't successfully adapted it to my own code. I'm probably just missing something simple somewhere or have my audio libraries a little tangled. Is there a simple example integrating playing wav from sd?
    You’re right, I should add a simple playback example!

    The nearest I have for now is https://github.com/h4yn0nnym0u5e/Aud...layMultiSD.ino, which plays back two files from two different SD cards when triggered by button presses. You could adapt it by “simply” not initialising the SD card you don’t have, and making both playback calls use the one you do have by editing line 75 or 79.

    You may need to increase the buffer sizes from the 2k allocated at lines 52 and 53. Beyond 32k is fairly pointless, unless your SD cards are really poor…

Posting Permissions

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