2

I have a chart that shows values of the sound amplitude (in Db and SPL) measured in one point of the space as a function of the time. Could be possible to generate an audio file using these values? If so, how could I do it? Would be better to calculate the FFT?

Thank you very much!

Regards

  • 1
    How high precision is the chart? I was initially figuring you meant reading from a general SPL meter that averages the overall pressure over time. If it is actually instantaneous pressure, then it isn't really a measure of SPL so much as a recording, normally an SPL meter is averaging though so that the reading is a little more stable and meaningful. A dynamic mic just records the overall sound pressure changes over time, that's what a waveform is. I'd expect an SPL chart to be made of averages and less frequent sampling. – AJ Henderson May 22 '14 at 14:53
  • When you say accuracy, you mean the time-step between two values of SPL or Db are measured, don't you? In that case, I could achieve any accuracy I need, because these values are results from a CFD (Computational Fluid Dynamics) transient simulation, and if more accuracy is needed, the only thing I have to do is to reduce the time-step. – Qwerty May 22 '14 at 15:03
  • both the sampling frequency and the length of time used for the sample. But if you are taking 44 thousand samples a second and only using the duration of the sample to make up the sample, you are no longer recording SPL, you are recording audio. – AJ Henderson May 22 '14 at 15:04
  • At this moment I'm taking 2000 samples per second (time-step=0.0005 seconds), but there would be no problem to modify this value. The problem (or more precisely, the doubt) I have, is that I can export all those values in a csv table, but I don't know how to transform it in a sound file. – Qwerty May 22 '14 at 15:14
  • why not simply record a sound file at that point and work the other direction to get SPL measurements from it? A sound file is just a collection of samples (possibly encoded in some way that makes it smaller than that, but it still decodes to a series of samples). – AJ Henderson May 22 '14 at 15:20
1

If you can create points representing instantaneous amplitude (or pressure, doesn't really matter as long as you save it as a linear number rather than logarithmically) centered around a 0-line where the system is in its static state, rather than SPL, and make 44100 points per second, you have audio. The frequencies arise from the varying amplitude over time.

Digital audio. Source: wikipedia

Basically you're storing the position of a loudspeaker membrane (or ear drum) over time.

With matlab or any programming language, you can write this array of values as a WAV-file and listen to it.

  • Thanks for your answer! Yes, that is what I get from my acoustics simulations. Could you explain a bit more the creation of this array? Could I create a WAV file from scratch? – Qwerty May 22 '14 at 15:47
  • Yes, you can create the WAV-file from scratch. In Matlab you can just import the csv file and tell it to save as a WAV-file, in another programming language you need to build the file with its different 'chunks' yourself (see en.wikipedia.org/wiki/WAV). Some sound editing software lets you read any data as a sound file, (in Audacity, I believe there is a 'read as RAW' option too), perhaps this works after fiddling with the way your data is formatted - I've never tried. – EMV May 23 '14 at 5:13
  • OK! I will try to create it with Matlab. Also, I have seen that it has a specific command to do that (wavwrite), so it should be even more easy to create the file. Thanks for your help! Regards – Qwerty May 23 '14 at 6:16
1

I believe it can be very clear in the programing language Mathematica, because you can graph and listen to a function with very similar commands. You can graph a function with this command: Plot[Sin[2*Pi*440*t],{t,0,0.003}] On the other hand, you can listen to the function if you replace Plot with Play, and replace the 0.003 (which means 3 milliseconds in this context) with, for example, a 2 (so you listen the sound for two seconds): Play[Sin[2*Pi*440*t],{t,0,2}] When you "Play" a function in Mathematica, the values of the function are sampled and transformed to voltages, and those voltages are transformed into movement of the loudspeaker membrane, as EMV pointed out. For your question, you would use ListPlot and ListPlay, which let you graph and listen data http://reference.wolfram.com/mathematica/ref/ListPlay.html I am doing some material (most of the site is under construction) to teach exactly these concepts, you can read the PDF version in this link http://matecmaticaacustica.weebly.com/graph-and-sound-of-sine-waves.html and if you have either Mathematica or the free CDFPlayer, you can see the CDF version and interact with it, listening to functions and I have there a small app that might be useful. regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.