+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Full Member level 2
    Points: 1,374, Level: 8

    Join Date
    Jun 2014
    Posts
    131
    Helped
    0 / 0
    Points
    1,374
    Level
    8

    Problem hearing to sound generated by DAC on Arduino MEGA 2560

    After a lot of searching I managed to play a 22kHz 16-bit audio track stored to an SPI SDcard, from the MPC4725 DAC (I2C connected) connected to an Arduino MEGA 2560 R3, but it is too noisy and too loud...! I mean I can understand the volume variations, but not the song. I used a 10K pot to lower the current and then the sound wasn't to loud but I had a lot of noise and I couldn't understand a word from the song. Is there any solution to this? The code I use is this:
    https://github.com/deltabeard/MCP472...dac/wavdac.ino

    Thank you...

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 22,103, Level: 36
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,229
    Helped
    936 / 936
    Points
    22,103
    Level
    36

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    i'm not really a software guy, but do you have that address for the DAC set correctly (0x60)? Also, it's not clear to me: what controls the speed at which the data is written to the DAC? It looks to me like there's a WHILE loop that's just going to write data to the DAC as fast as it can.


    1 members found this post helpful.

  3. #3
    Full Member level 2
    Points: 1,374, Level: 8

    Join Date
    Jun 2014
    Posts
    131
    Helped
    0 / 0
    Points
    1,374
    Level
    8

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    I have set it to 0x62. Ok, I will take a look at the library...



    •   AltAdvertisment

        
       

  4. #4
    Super Moderator
    Points: 249,021, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,336
    Helped
    13173 / 13173
    Points
    249,021
    Level
    100

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    file.read() reads bytes, not 16 bit words. I don't think that the code is right for 16 bit .wav file.



    •   AltAdvertisment

        
       

  5. #5
    Full Member level 2
    Points: 1,374, Level: 8

    Join Date
    Jun 2014
    Posts
    131
    Helped
    0 / 0
    Points
    1,374
    Level
    8

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    Quote Originally Posted by FvM View Post
    file.read() reads bytes, not 16 bit words. I don't think that the code is right for 16 bit .wav file.

    Thank you. So how do I fix this?



  6. #6
    Super Moderator
    Points: 249,021, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,336
    Helped
    13173 / 13173
    Points
    249,021
    Level
    100

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    Use 8 bit wave, or change the code.


    1 members found this post helpful.

  7. #7
    Super Moderator
    Points: 49,637, Level: 54

    Join Date
    Apr 2011
    Location
    Minneapolis, Minnesota, USA
    Posts
    12,274
    Helped
    2421 / 2421
    Points
    49,637
    Level
    54

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    Digitized audio has become tricky because so many things need to be right. If one of several options is set incorrectly, then music sounds like noise.
    A free program called Audacity is useful to play and record digitized sounds. It can help you check your data. It displays waveforms, imports many popular formats, and understands the various options:

    * 22kHz or 44 kHz
    * 8 bit or 16 bit
    * mono or stereo
    * big endian or little endian
    Etc.


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  8. #8
    Full Member level 2
    Points: 1,374, Level: 8

    Join Date
    Jun 2014
    Posts
    131
    Helped
    0 / 0
    Points
    1,374
    Level
    8

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    I tried (with Audacity) a 22Khz, 8-bit,mono sound, again the same thing ---> a lot of noise! What changes should I make to the code?



  9. #9
    Super Moderator
    Points: 66,832, Level: 63
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    13,637
    Helped
    3121 / 3121
    Points
    66,832
    Level
    63

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    Hi,

    8 bit simply isnīt good audio quality.
    Use better resolution.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  10. #10
    Advanced Member level 5
    Points: 22,103, Level: 36
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,229
    Helped
    936 / 936
    Points
    22,103
    Level
    36

    Re: Problem hearing to sound generated by DAC on Arduino MEGA 2560

    When you say "noise" do you mean nothing BUT noise, or noise on top of your expected audio?



--[[ ]]--