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

Thread: Mixers and multiple sounds example

  1. #1
    Junior Member
    Join Date
    Jun 2020
    Posts
    4

    Mixers and multiple sounds example

    When I try the Mixers and multiple sounds example and uncomment the fader code it does not work. I have added some println statements and this shows that code execution does not get beyond playing the second wav file.
    The audio also has crackling sound on it.

    Teensy 3.2 and audio board.
    Other examples work OK.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    Could you be more specific about exactly which code you're running? Maybe it's part 2-2 or 2-3 from the audio library tutorial?

    https://www.pjrc.com/store/audio_tutorial_kit.html

  3. #3
    Junior Member
    Join Date
    Jun 2020
    Posts
    4
    I am running part 2-2 of the library tutorial, I have a SanDisk Ultra 16Gb micro sd hc 1, card I have also tried other cards all freshly formatted with files transferred individually with the same result.
    I think that the code which was uncommented did run once when one of the songs ended, could it be there is a bottleneck reading the card?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    I retested part 2-2, on the audio tutorial breadboard with Teensy 3.2.

    It definitely is working. I recorded a quick video, so you can see how I tested and hear the result. The audio level in the video isn't great (I just turned the camera on and did a quick shot... good video production takes so much work....) Skip forward to 2:00 where I turned up the speaker volume. It's much easier to hear in that last part of the video.


  5. #5
    Junior Member
    Join Date
    Jun 2020
    Posts
    4
    I do not doubt that it will work I am trying to figure out why it isn't working for me. I have run the SD card test program in the hardware folder, it is showing over 100% of the audio period for reading 2 wav files so I presume this is too slow. I have tested the card speed on my PC which gives 33.5 Mb/s read speed I think this is a limitation of my card reader as this is the maximum for any card, it is also for a single file read, they also seem to be genuine SanDisk cards as far as I can tell.
    The boards are stacked one above the other so there are no long leads either, I have ordered a class 10 card to see if it will work with that, any other suggestions would be appreciated.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    Nearly all SD cards are fast enough to play 2 files. It's probably not the SD card.

    Try running File > Examples > Audio > Tutorial > TestTutorialKit. Open the serial monitor while it's running.

    Does the A3 knob on your setup really work? The test should show the number change in the serial monitor as you turn the knob, down to under 50 when fully counterclockwise, and up to about 1000 when fully clockwise. And it should not change when you're not turning.

  7. #7
    Junior Member
    Join Date
    Jun 2020
    Posts
    4
    Pot is working, I have a new ultra SD which is almost working OK.
    I have added some code to give the loop time.

    if (playSdWav2.isPlaying() == false) {
    Serial.println("Start playing 2");
    playSdWav2.play("SDTEST4.WAV");
    delay(10); // wait for library to parse WAV info
    }
    // uncomment this code to allow Knob A3 to pan between songs
    tiime = millis();
    looptime = tiime-oldtime;
    Serial.print("Time to loop ");
    Serial.println(looptime);
    oldtime = tiime;

    int knob = analogRead(A3); // knob = 0 to 1023
    float gain1 = (float)knob / 1023.0;
    float gain2 = 1.0 - gain1;

    serial monitor output, time in ms :-
    Time to loop 26

    Time to loop 1056

    Time to loop 3

    Time to loop 44

    Time to loop 9

    Time to loop 11

    Time to loop 2237

    Time to loop 6

    Time to loop 9

    Time to loop 560

    Time to loop 5

    Time to loop 560

    Time to loop 540

    Time to loop 3

    Time to loop 17

    Time to loop 554

    Time to loop 6

    Time to loop 499

    Time to loop 70

    Time to loop 1120

    Time to loop 1253

    Time to loop 32

    Time to loop 12

    Time to loop 1201

    Time to loop 14

    Time to loop 32

    Time to loop 21

    Time to loop 3

    Time to loop 29

    Time to loop 5

    Time to loop 3

    Time to loop 12

    Time to loop 17

    Time to loop 1230

    As you can see there are some long delays, it would seem that card access speed is the issue here, I am using arduino 1.8.12 could there be an issue with the SD library?

Posting Permissions

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