AppliedAcousticsChalmers / sound_field_analysis-py

Analyze, visualize, and process sound field data recorded by spherical microphone arrays.
https://appliedacousticschalmers.github.io/sound_field_analysis-py/
MIT License
94 stars 16 forks source link

Generating sine sound field? #19

Open DvDream opened 4 years ago

DvDream commented 4 years ago

Hi, is there a way of generating a simple signal sound wave, even a simple sine, using this library? Because as I could have seen in the ideal_wave example there is no signal that can be put in input. Thank you in advance :)

HaHeho commented 4 years ago

To clarify first what you are looking for. In the simulation of what kind of sound field are you interested in:

These are all different stages that build on top of each other. In any of the scenarios, the idea of the simulations is that one generates some impulse responses, which can then be convolved with an arbitrary source signal.

DvDream commented 4 years ago

For a first study I would say the 1st one and maybe later the 2nd one. I would like to generate a dataset of some given signals wave decomposition into sperical harmonics.

JensAhrens commented 4 years ago

What sfa-py primarily does is evaluating the transfer function (a.k.a. frequency response) of a given system at a given frequency. This could be, for example, the transfer function from a plane wave to a location on the surface of a spherical scatterer. The result is a single complex number in this case. Let's call it H(\omega_0), whereby \omega_0 is the radian frequency of interest.

If the plane wave were to carry a sine wave that is given in complex notation as exp(i \omega_0 t), then the signal that would arise at the given location on the surface of the scatterer will be H(\omega_0) exp(i \omega_0 t).

If you want the plane wave to carry a broadband audio signal such as speech, you'll have to sample the transfer function H(\omega) at a sufficient amount of equi-spaced frequencies so that you may interpret H(\omega) to be the result of a Discrete Fourier Transform. I'll need to impose all the symmetry that DFT spectra have by hand. Then, you can perform an inverse DFT and you'll get an impulse response that represents the transfer path from the wave to the location on the spherical scatterer. Convolve your speech signal with this impulse response, and you'll obtain the signal that a microphone at the given location on the scatterer would sense due to the plane wave that carries the speech.

DvDream commented 4 years ago

Thank you so much for the tips! So if I'm understanding well the plane/spherical waves that I'm "creating" are going to be the same (from the decomposition point of view) unless I change the "acquisition properties" or I decide to make them carry a signal whatever it is, right?

Moreover, let's assume that I want to reproduce the obtained sound field in a reproduction area, where the pressure at the m-th matching point generated by the n-th speaker is defined as p_nm(f) = w_n(f) * g_mn(f), where w_n(f) is the n-th loudspeaker excitation in time domain, g_mn(f) denotes the impulse response between the n-th loudspeaker and the m-th matching point, both in the frequency domain. I know that as ATF (g(f)) I can use the Green's function, while I was wondering if I could use either the obtained impulse response of the sound field captured from the microphone or the Spherical Fourier Coefficients as the excitation signal.

JensAhrens commented 4 years ago

Thank you so much for the tips! So if I'm understanding well the plane/spherical waves that I'm "creating" are going to be the same (from the decomposition point of view) unless I change the "acquisition properties" or I decide to make them carry a signal whatever it is, right?

Yes.

Moreover, let's assume that I want to reproduce the obtained sound field in a reproduction area, where the pressure at the m-th matching point generated by the n-th speaker is defined as p_nm(f) = w_n(f) * g_mn(f), where w_n(f) is the n-th loudspeaker excitation in time domain, g_mn(f) denotes the impulse response between the n-th loudspeaker and the m-th matching point, both in the frequency domain.

I don't understand. You write w_n(f) but term it time-domain signal. Then, g_mn(f) is an impulse response in frequency domain? Isn't an impulse response a time-domain concept?

I know that as ATF (g(f)) I can use the Green's function,

What is ATF?

while I was wondering if I could use either the obtained impulse response of the sound field captured from the microphone or the Spherical Fourier Coefficients as the excitation signal.

Certainly. Yet, I don't fully understand what you want to do. Please send me an email with more comprehensive information, and maybe some papers as references or so. You'll find my email address here: http://www.ta.chalmers.se/people/jens-ahrens/