Announcement

Collapse
No announcement yet.

audio enable problem

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

  • audio enable problem

    Display is gen4-uLCD-50DCT-CLM with latest PMMC.

    I have the audio output and audio enable output pins connected to an external amplifier. Playing wav files is no problem. However, the amp never turns off (annoying background noise).
    I checked the AUDENB pin and it is always high (from power on). I believe this pin is supposed to automatically go high when playing sound, then go low when not playing sound.

    I tried adding this to Magic in main loop:

    Code:
    if (snd_Playing()==0)
        pin_LO(AUDIO_ENABLE);
    endif
    AUDENB still always high.

    Please help. Thanks!!

  • #2
    Hello,

    You can refer to this thread forum: https://forum.4dsystems.com.au/node/52095

    As for file_PlayWAV, when you do it it turns on the amp and leaves it on, assuming more sounds will be used, this is to avoid the 'click' when the amp is first turned on.
    If you can hear a sound in the speaker after playing, then it is most likely that the 'audio rate' of the sample is quite low. Try resampling the audio to a higher rate.
    Also, you can use pin_LO(AUDIO_ENABLE) ;
    Code:
    if (snd_Playing()==0)
        pin_LO(AUDIO_ENABLE);
    endif
    Is it possible that you are not getting to the if statement? Try to use a print command to confirm this.

    Can you try this snippet of code?
    Code:
    //InsertPoint is PostActivateForm
    
    if(CurrentForm == 1) //if Form = 1
            snd_Volume(80);
            file_PlayWAV("HOTROD.wav");
            while(snd_Playing());
            pin_LO(AUDIO_ENABLE);
    endif
    I hope this helps.
    Best Regards,
    Kevin

    Comment


    • #3
      Been busy ... just getting back to this noise issue.

      I tried the code you provided above in the PostActivateForm. The sound plays when the form loads, but then noisy. Voltage at AUDENB stays at 3V.

      Please help!!
      Thanks!!

      Comment


      • John Kevin
        John Kevin commented
        Editing a comment
        Hi Jeremy,

        Can you try to set the pin to High - pin_HI(AUDIO_ENABLE);, and see if it makes a difference?

    • #4
      I put this in Main Loop:

      Code:
      // enable audio amp (active High)
      if (snd_Playing()==0)
          pin_LO(AUDIO_ENABLE);
          pin_LO(PA15);
      else
          pin_HI(AUDIO_ENABLE);
          pin_HI(PA15);
      endif

      AUDIO_ENABLE never toggles, so I cut the AUDIO_ENABLE trace on the pcb and routed PA15 to the amp. Works great!

      Comment


      • John Kevin
        John Kevin commented
        Editing a comment
        Hi Jeremy,

        I am glad you managed to sort it out.

        Best Regards,
        Kevin
    Working...
    X