Announcement

Collapse
No announcement yet.

Scratchy sound with wav file inside loop() in spe environment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scratchy sound with wav file inside loop() in spe environment

    I'm using a uLCD32PT with the latest firmware and serial spe environment, driven by an arduino mega 2650 with the latest arduino 4D library. When I play a wav file from the setup portion of the mega code it plays clearly. However, when played inside the loop the same file sounds scratchy even with a delay(2000) immediately after the playWAV call. Any hints about what would cause the scratchy sound?

  • #2
    Are you, perhaps, 'bombarding' the display with serial commands whilst the wav file is playing?
    Mark

    Comment


    • #3
      That was my first thought, so I put a delay(2000) immediately after the playWAV call. I'm assuming that blocks all communication between mega and 4d LCD for 2 seconds. Is that true?

      Comment


      • #4
        What environment are you using? Where are you putting the delay? What else is going on?

        Maybe a few snippets of your code would help...

        What size is the sound buffer? You should be getting consistent results, but maybe the sound buffer size is marginal and needs increasing for your particular WAV file
        Mark

        Comment


        • #5
          Update: Mystery solved. The difference between playing a wav file in the setup section (with clear sound) and in the loop section (with scratchy sound) was due to a difference in the volume settings between the two sections.A volume level of 100 for this particular file caused distortion, but 70 was clear. By turning down the volume with Display.snd_Volume(70) in the loop to match the volume in the setup caused the scratchiness to go away. It seems I'm right at the limit of my 5V power supply and by cutting back the power necessary to drive the sound at a louder volume, the distortion level dropped.

          Comment

          Working...
          X