+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Full Member level 1
    Points: 1,228, Level: 7

    Join Date
    Jun 2014
    Posts
    109
    Helped
    0 / 0
    Points
    1,228
    Level
    7

    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...

  2. #2
    Advanced Member level 5
    Points: 21,474, Level: 35
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,122
    Helped
    907 / 907
    Points
    21,474
    Level
    35

    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.

    •   AltAdvertisment

        
       

  3. #3
    Full Member level 1
    Points: 1,228, Level: 7

    Join Date
    Jun 2014
    Posts
    109
    Helped
    0 / 0
    Points
    1,228
    Level
    7

    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: 246,552, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,863
    Helped
    13046 / 13046
    Points
    246,552
    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 1
    Points: 1,228, Level: 7

    Join Date
    Jun 2014
    Posts
    109
    Helped
    0 / 0
    Points
    1,228
    Level
    7

    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: 246,552, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,863
    Helped
    13046 / 13046
    Points
    246,552
    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.

    •   AltAdvertisment

        
       

  7. #7
    Super Moderator
    Points: 48,299, Level: 53

    Join Date
    Apr 2011
    Location
    Minneapolis, Minnesota, USA
    Posts
    12,023
    Helped
    2361 / 2361
    Points
    48,299
    Level
    53

    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.

  8. #8
    Full Member level 1
    Points: 1,228, Level: 7

    Join Date
    Jun 2014
    Posts
    109
    Helped
    0 / 0
    Points
    1,228
    Level
    7

    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: 63,207, Level: 61
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,926
    Helped
    2980 / 2980
    Points
    63,207
    Level
    61

    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: 21,474, Level: 35
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,122
    Helped
    907 / 907
    Points
    21,474
    Level
    35

    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?



--[[ ]]--