Simulating music

Posted By: agreenknight

Simulating music - 05/07/04 23:22

I was wondering, now is there some way to simulation music in 3dgs? Playing music your blowing air through a instrument really is a physics thing. I learned about it in a physics class I took. Thing is too, the tone of the instrument too, and the pitch.
Posted By: ventilator

Re: Simulating music - 05/07/04 23:24

no, you can't do that with a6's physics engine.

but i think there are physical sound modeling algorithms which can do such stuff! they simulate swinging guitar strings or air in an organ pipe and produce sound out of that...
Posted By: fastlane69

Re: Simulating music - 05/08/04 01:54

Well now that not entirely true Vent. YOu obviously can't do it on a simulation level, but you can emulate it:

a) Create a musical your musical instruments. Lets take a hollow cylinder with one end closed; This will be our "pan flute"; thus you blow air across the lip of the open side and a tone will hopefully ensues.

b) Pick a fixed spot where you want to hear the sound produced. Lets keep the spot fixed for now and not make it dynamic for ease of discussion and computation.

c) In a bid to finite element analysis, pepper the inside of the flute with as many single quant entities you can and place them a fixed distance apart, say for example 3 or 4 quants. Register these entities with the PE with zero friction, zero drag, and zero gravity. Since we are considering a homogenous gas, mass and molecule volume are irrelavant and thus set mass to unity. This internal grid will be the "air".

d) Take the entities that are at the lip of the flute and vibrate them by giving them pushes and pulls. This will drive the open lip of the cylinder and depending on which and how many lip air molecules you drive , you will emulate diffrent air flow patterns across the lip. These lip air molucles must be constantly vibrating to work.

e) Assuming your grid size is adequate and allows for air molecule collision (ie. the air is dense enough to transmit sound), the driven air particles collide with their neightbor and on down the line, all the other air particles inside the flute as well as the walls of the flute itself. This in and of itself will not produce a tone since all the particles are moving and colliding randomly. You will need to drive teh lip of the flute properly to get resonance....

f) So far this has been an accurate simulation of what happens inside an instrument. Now we need to emulate the sound aspect. Remember we are at a fixed position relative to the flute. The key is that everytime one air entity collides with another, we would mathematically calculate teh waveform that I would receive at my fixed postiont and add that to the waveform from every other collision. It is this resultant waveform that is then player to the listener at the fixed spot. This last bit of coding is the fuzziest to me, but we are in essesnse relying on the air particle simulation to give us an idea of what is "sounding" and what isn't and then we use the Principle of Superposition to put these tones together at our fixed point and hopefully "hear" a sound.


Just an idea of the top of my head!
Posted By: agreenknight

Re: Simulating music - 05/08/04 02:32

I've read a webpage that suggested several ways to do it, including what you just mentioned.
Posted By: fastlane69

Re: Simulating music - 05/08/04 02:45

Right, and this is entirely within the realm of 3DGS capabilities.
Posted By: agreenknight

Re: Simulating music - 05/09/04 18:38

How do i go from the particle simulation to having it generate music though?
Posted By: fastlane69

Re: Simulating music - 05/10/04 02:02

Quote:

How do i go from the particle simulation to having it generate music though?





From above:
Quote:

f) So far this has been an accurate simulation of what happens inside an instrument. Now we need to emulate the sound aspect. Remember we are at a fixed position relative to the flute. The key is that everytime one air entity collides with another, we would mathematically calculate teh waveform that I would receive at my fixed postiont and add that to the waveform from every other collision. It is this resultant waveform that is then player to the listener at the fixed spot. This last bit of coding is the fuzziest to me, but we are in essesnse relying on the air particle simulation to give us an idea of what is "sounding" and what isn't and then we use the Principle of Superposition to put these tones together at our fixed point and hopefully "hear" a sound.





The idea is that you have a waveform with a basic air molecule on air molecule sound. Then as the particle simulation progresses, upon each collision a new waveform is added and the result of this waveform is what is played.

Its very possible with 3DGS, but as you can see, it requires that you will have to have some pretty deep mathematical and physical foundation to actually pull it off and code it. Ideas such as the principle of supperposition and waveform addition, fourier transforms, inverse r squared dependence of sound, the decibel equation...if you want to attempt to perform a simulation, you need to be well versed in ALL aspects of the physics.

This approach is the most hardcore however. You can create all manner of approximations to make your project work, such as instead of a particle simulation, have an AREA simulation whereupon once a AREA is stimulated, it plays a tone. Stimulate diffrent areas and add the tones, boom you have a note. Simulate diffrent NOTES, and voila! Music!

If you have a specific app in mind it would help make this more concrete. As it stands that are many many wasy to acheive your result and thus which one you may want to take is project dependent.
Posted By: agreenknight

Re: Simulating music - 05/10/04 03:07

Quote:

This last bit of coding is the fuzziest to me, but we are in essesnse relying on the air particle simulation to give us an idea of what is "sounding" and what isn't and then we use the Principle of Superposition to put these tones together at our fixed point and hopefully "hear" a sound.




Well, the first thing I need to do is get that to work, then. I was looking at the particle effects generator, on the download page, would that help me with it.
Posted By: fastlane69

Re: Simulating music - 05/10/04 03:23

This has nothing to do with the 3DGS particle.
When I use particle, I mean it in the scienfici sense, a mass point source.
The particles are actually 1 to 2 quant entities...otherwsie attaching behaiviour such as sounding would be impossible
Posted By: agreenknight

Re: Simulating music - 05/10/04 07:48

Okay, glad we sorted that out, so would I have to make a plugin for this?
© 2023 lite-C Forums