Shop OBEX P1 Docs P2 Docs Learn Events
Finally I am ready to try a DAC resistor ladder But... — Parallax Forums

Finally I am ready to try a DAC resistor ladder But...

metron9metron9 Posts: 1,100
edited 2005-09-16 18:50 in General Discussion
What is the best way to take a sound sample from sound forge or a wav file and store it as ascii bytes I am using 8 nit and 2 bit files. Maby a free program that converts wav to ascii files?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-16 12:00
    You'll probably have to create your own utility to read the data out of a WAV file. My question is how you're going to store the data and then play it back. Are you going to put it into an EEPROM and then use an SX to play it back? In order to faithfully reproduce the sound you have to have very precise timing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-09-16 13:10
    Most modern windows programming languages have the ability to read WAV files and create a structure for the metadata (file size, sample rate, bits/sample, etc) and WAV data. You can use this to strip the data to create a custom format. To get accurate playback you have to play it back at the sample rate the WAV file was recorded, as Jon says. Use an audio editor to change the sample rate before extracting the data if needed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • metron9metron9 Posts: 1,100
    edited 2005-09-16 13:58
    Yes I am using sony sound forge, It has no binary output that I know of but I did find this :
    www.sigview.com/download.htm

    Sound forge can resize the sample rate to 2000 and bit depth of 8. Looking at a blowup of the data at these rates it looks like a 4 bit dac will do the job (see picture of 1S ms of data) I understand I need to send 4000 voltage signals per second or 4 per mS so I am using my mega48 (4MHz) it has 16 and 8 bit interrupt timers. (the only stamp I have is the BS2 right now but in the learning process it is very handy and it is what got me started from knowing nothing about IC chips)

    The resistors I have not figured out yet as the high and low pictures show a low of 15.86 to a high of 554.49 mV (without the 8ohm resistor (speaker simulatior) 0 to 3 volts)
    Note* I think a regular speaker has inductance to think about as well but I have not got that far yet)

    Then there is the amplifier circuit (I have not got that far yet, Op amps of some sort I would guess will be used and that I will need some help on, but I am still going to give my brain a few days to absorb the reading I have done on them.)


    So using 4 bit DAC I can get 16 voltage levels from 0 to 3 volts
    Note* (the 15.86 to 554.49 shown in the pictures and stated above is with an 8 ohm speaker attached as a simulation, as I dont have a amplifier figured out yet)

    Now I guess the signals below the 0 line are actually negative voltages. Today I start the journy of how to do that. I could use some pointers in that respect. So I would gess I would be working with 7 negative and 8 positive voltages using the 4 bit dac. I think I need an inverter for this or maby the op amp circuit can do this too but I am getting ahead of myself.

    Remember this excercise is just to get the fundamentals of how PWM and DACs and amplifiers work. To me a working wxample I make myself no matter how crude or lousy the sound output will meke me jump for joy and another notch to the light bulb will be in place.

    I know sometimes it looks like I know what I am doing but reallly slap a mask on me and a blue gown and I can look like a brain surgen too) yeah.gif
    322 x 654 - 23K
    483 x 399 - 20K
    476 x 383 - 17K
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-09-16 15:42
    I think you are going to need what is called an "R2R ladder" to really do what you want to do, what you have in your schematic is basically a "RR ladder".

    Do a google search for "R2R" and "DAC" and see what you get.

    Here is something that I did once upon a time using a UVEPROM ... I used the EPROM burner software itself to "strip" off the 54 byte WAV file header.

    http://webpages.charter.net/schwabelove/BasicStamp/

    ....follow the above·link to "Standalone EPROM *.WAV player"



    Note: If you do not strip off the 54 byte WAV file header, you will hear an audible "click" everytime you initiate playing your WAV file.









    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • metron9metron9 Posts: 1,100
    edited 2005-09-16 18:08
    Thanks Beau, Do you have a summary of the function of this circuit, the eeprom was a good read (datasheet) but I dont know what the 4040 is but I did revise my circuit and you can see it here: http://www.stickerpub.com/circuit.avi

    Got to get some work done now (i am at work never enough time....
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-09-16 18:50
    metron9 said...
    ...Do you have a summary of the function of this circuit...
    There is tons of literature on the theory, methods, and applications of an R2R ... That is why I suggested Google.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    675 x 987 - 262K
Sign In or Register to comment.