Post Go back to editing

Loading into DSP, processing and playing externally prepared audio samples

Hello everybody!

Recently I started a topic on a possibility of loading and playing/processing an external audio sample in SS (adau1701 in my case). Since new questions appeared, I decided to bring all that into a separated topic and hope that the moderators wont object. Thanks to Brett, I found out that such thing was possible, the major problem was conversion of a, say, wav file into a set of values, suitable for loading into a lookup table. I think there is a quite simple way, which I will put here in details. Meanwhile please somebody help me with some additional questions. Say, I have the data values, I start a new projects, which just takes the values from memory and plays them through an output. Could anybody please help me with blocks, before I have done something foolish? I believe, I should take a stopwatch (w/external reset if I need the sample to be repeated), connect it to the "index lookup table" block and then... Should I simply connect the out pin of the lookup table right to the output? Or there must be some additional block "X" in between? Other words, if the lookup table will simply shoot the data values from its output, then I believe I am simply to connect the table to the output of the 1701, right? Or I missed something... Anyways, many thanks in advance for help and here is the detailed guide how to convert an audio file into them data values.

1. Create or open a sound file in Cool Edit pro (versions 1.0-2.1 will work)

2. Press "Save as" and choose .txt file as an output. The out file will have numbers, but much greater than 1 to -1  integers, shortly speaking.

3. Copy all the values into the clipboard.

4. Open Excel and paste all the values.

5. Now it is time to remove the empty cells (caused by line changes in the txt file)

6. Select all the cells, press Edit>Go To>Special, select "blanks" and press OK  Now all the blank cells are selected

7. Press edit>delete to delete the empty cells.

8. Now, in a new cell, type a constant by which you want to divide the data values (in case of a 16-bit sound file the constant is 32767)

9. Copy the cell with the constant into the clipboard.

10. Select all cells you want to process.

11. Press Edit>Paste Special, select "Divide" and press ok.

12. Done!! The values are ready!

Parents
  •      Hello Skfir,

         Thanks for the tutorial on how to get a sampled sound into numeric form, I'm sure this will be helpful to the community.

         It's OK to branch from your previous post to continue an answered discussion.  Doing this differs from duplicating the original question just to get attention, which is generally frowned upon.  In your first post at http://ez.analog.com/message/131125#131125 Brett suggested a counter and a lookup table to output your sound file.  All we need do now is to load your sound into the lookup table and then realize the rest of his design.

         The lookup table needs a simple text file with just a list of values like this (six decimal places is enough, as you said):

         To produce your text file from Excel, use its export function and choose text file (tab delimited).  Look at the resulting file in Notepad to see if it appears OK.

         To output your sound, load your text file into a lookup table and have a counter step through all its values.  As usual there are several possible circuits, one is shown below:

         In this particular circuit the sound repeats as long as the switch is ON, but single-shot playback and various logic triggers are also possible.  My sound file is just one cycle of a sine wave, 500 samples at fs = 48KHz.  It repeats at f = 48000 / 500 = 96 Hz.  Of course, you're playing something more interesting than that.  The comparator sets how much of the LUT is played before it repeats.

         The lookup table only fits up to 800 samples, or 16.6 mS at 48KHz.  If your project runs at 192KHz, you only get about 4.1mS.  If that's too short for the job, and your sound has a normal audio bandwidth, you can modify this circuit to step through the LUT at a slower rate.  For example, the circuit below runs at 192K while playing the same sound sampled at 48K.  The circuits sound alike::

         The LUT's output is "DAC ready", but I suggest adding a lowpass filter to smooth things out a bit.  The sound file and the circuit are attached.

         Best regards,

         Bob

    attachments.zip
Reply
  •      Hello Skfir,

         Thanks for the tutorial on how to get a sampled sound into numeric form, I'm sure this will be helpful to the community.

         It's OK to branch from your previous post to continue an answered discussion.  Doing this differs from duplicating the original question just to get attention, which is generally frowned upon.  In your first post at http://ez.analog.com/message/131125#131125 Brett suggested a counter and a lookup table to output your sound file.  All we need do now is to load your sound into the lookup table and then realize the rest of his design.

         The lookup table needs a simple text file with just a list of values like this (six decimal places is enough, as you said):

         To produce your text file from Excel, use its export function and choose text file (tab delimited).  Look at the resulting file in Notepad to see if it appears OK.

         To output your sound, load your text file into a lookup table and have a counter step through all its values.  As usual there are several possible circuits, one is shown below:

         In this particular circuit the sound repeats as long as the switch is ON, but single-shot playback and various logic triggers are also possible.  My sound file is just one cycle of a sine wave, 500 samples at fs = 48KHz.  It repeats at f = 48000 / 500 = 96 Hz.  Of course, you're playing something more interesting than that.  The comparator sets how much of the LUT is played before it repeats.

         The lookup table only fits up to 800 samples, or 16.6 mS at 48KHz.  If your project runs at 192KHz, you only get about 4.1mS.  If that's too short for the job, and your sound has a normal audio bandwidth, you can modify this circuit to step through the LUT at a slower rate.  For example, the circuit below runs at 192K while playing the same sound sampled at 48K.  The circuits sound alike::

         The LUT's output is "DAC ready", but I suggest adding a lowpass filter to smooth things out a bit.  The sound file and the circuit are attached.

         Best regards,

         Bob

    attachments.zip
Children
No Data