Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    45
  • comments
    67
  • views
    16837

Nerd Alert!

Sign in to follow this  
Stagz

282 views

Well, I guess I should explain how my little sound synthesizer work, considering that I have put it here for the world to see.

How it works
The SynthGraph application is kind of a mixture between a synthesizer (ie one of those keyboard things with all the buttons and dials), and a scene graph (you know.. the ones that you use in your graphics apps).

You build your sound by placing "Sound Nodes" into a tree structure, and then the application will generate a WAV file, and simply play it using the winmm PlaySound() function. (I know there are other ways, but this was the easiest at the time, and it doesn't require real time processing, so there should be no problems).

What is a sound anyway?
A sound is simply a compression wave that travels through the air. When it reaches your ear, your brain will interpret the wave as a particular sound. Sound waves are meaured in "Hz", or as normal people like to call them "waves per second". The slower waves will be interpreted as low pitch sounds, while the faster ones will be interpreted as high pitch sounds.

I read somewhere that the normal frequencies for human hearing is between 40 Hz and 14,000 Hz, but it varies from person to person. For example, using this applicaiton, I was able to hear as low as about 32 Hz, and as high as about 18,600 Hz. Other animals are able to hear much higher or lower frequency sounds, for example, most dog whistles emit a 22,000 Hz sound :).

Sound Nodes
I have implemented several types of "Sound Node" into the system, and intend to implement more. A sound node is the basic building block for a sound in the SynthGraph applicaiton. It can either produce a sound, or modify a sound that it is attached to. In the majority of cases, a sound node will simply add the child waveform(s) to it's own waveform, but in some cases (such as the combiner node), special rules have been implemented.

A list of sound nodes that currently exist in the application can be found below:

Oscillator Node
This node will produce a wave form of the specified frequency. It can be used in two ways. Primarerily, it can be used to produce a sound of the specific frequency (eg. Middle C is 261.6 Hz). Secondly, slower waveforms (eg 0.5 hz) can be used in conjunction with the "Multiplier" function of the "Combiner Node" to produce some interesting effects.

Combiner Node
This node will combine it's child nodes in several different ways, to produce different results.

Add - This will add the child wave forms togeather, effectively playing each sound at full strength at the same time (note: if the sum of all sound volumes is greater than 100% the the amplitude will be capped at this level, causing a distortion in the sound)

Subtract - This will perform the same function as the add function, but produce an exact inverse of the wave add function's wave form.

Multiply - This function will multiply all of the wave forms togeater, causing some interesting sound effects as the amplituce (volume) of each wave form is multiplied togeater.

Average - This function will add all of the child wave forms, then divide by the total. It is useful for producing a sound that will not be distorted by volume.

ADSR Node
The ADSR node is another node that will affect the wave's volume levels. It effectively implemets the ADSR function found on many Synthesizers. ADSR is an acronym specifigying the following constants:

Attack - This is the amount of time that the sound wave takes to reach full volume.

Decay - The amount of time that the sound wave takes to reach the "sustain" volume level.

Sustain - The volume level that the child sound wave will remain static. The amount of time to sustain is also specified at this point, as normal synthesizers would use the keyboard to specify the sustain time.

Release - The amount of time that it takes for the wave form to reach the 0 volume leve.

Repeater Node
This node will repeat the initial segment (in milliseconds) of the child wave form continuously.

Silence Node
This node will cause a silence of the specified time to be played, then play the child wave form from the start.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!