Generate sound file from Db or SPL graph

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

Qwerty

Posted 2014-05-22T09:52:51.307

Reputation: 23

1How 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 – 2014-05-22T14:53:14.917

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 – 2014-05-22T15:03:02.767

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 – 2014-05-22T15:04:49.880

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 – 2014-05-22T15:14:09.827

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 – 2014-05-22T15:20:41.323

At this moment is the sound at this point the thing I wanted to know and/or calculate. The SPL, Db, Pressure, etc. are the results I get from the simulations, and the next step is to know the sound/noise I would hear if it was in reality. – Qwerty – 2014-05-22T15:43:26.637

This makes it sound like this is more a physics question than a sound design one. – AJ Henderson – 2014-05-22T15:47:02.487

As said before, the problem is that, even having all these values, I don't know how / I'm not be able to create a sound clip. Is in the last part where I have problems/doubts, not about getting these parameters. – Qwerty – 2014-05-22T16:07:47.050

Answers

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.

EMV

Posted 2014-05-22T09:52:51.307

Reputation: 2 853

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 – 2014-05-22T15:47:02.703

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 http://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 – 2014-05-23T05:13:50.763

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 – 2014-05-23T06:16:02.840

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

MaTECmatica

Posted 2014-05-22T09:52:51.307

Reputation: 111