0

I'm a program developer. I'm interested in sound these days.

I know I can synthesize the sound with a synthesizer. I don't have a synthesizer but I can do that with programming code.

I made an organ sound with wave synthesis. (I also made a siren sound.)

This link explains how to create drum sounds with waves. I understand all that and can make it.

The problem is I don't have the trick to make a good sound myself. It does not mean that I want to analyze the sound spectrum better with FFT formulas than it is now.

What do I need to know to have good tips? (Maybe the problem is I don't know what I don't know.)

I hope that this ability does not increase only through long periods of practice. Thank you :)

10
  • 4
    I'm wondering what your motivation is. Aside from that, have you thought about doing some reverse engineering? Start with known beautiful sounds, and see what their wave forms are? – aparente001 Feb 4 '20 at 5:58
  • 1
    Audacity can show you amplitudes for the frequency content at different points in time, just investigate the behavior of your instrument and set up envelopes for the different frequencies. My guess is it won't sound nice unless you have a few octaves above and some noise to give it timbre. But I think it would be easier to use machine learning. – Emil Feb 4 '20 at 7:09
  • 1
    @Emil the noise can be generated just by mixing a bunch of sine waves together too. – topo Reinstate Monica Feb 4 '20 at 7:27
  • 2
    @user3235 i just mean it in the usual sense. Yes, you need a lot of sine waves to make noise, but that's true to some degree of most additive synthesis, so I'm not sure what you mean by "does not work well"? – topo Reinstate Monica Jul 1 '20 at 3:58
  • 2
    @user3235 Dozens or even hundreds of sine waves is fairly straightforward these days - and I haven't found much patience needed, my approach has been to space them fairly evenly and give each of them a little pitch modulation of its own. As to the quality of the white noise - that could be an interesting conversation - I guess I'll have to post some and see what improvements you think are needed! – topo Reinstate Monica Jul 2 '20 at 14:18
6

I've done this in the past both with software and hardware/firmware devices.

To get a realistic instrument sound from sine waves you need to have the FFT spectrum of the instrument but you need more than that. You also need to see how this spectrum evolves in time. There are three basic temporal elements to an instrument sound,

  1. Attack

  2. Sustain

  3. Decay

If you FFT an entire sound file of a guitar or piano, etc, playing just one note you will have all this behavior mixed together. If all you did was create a superposition of sine wave components with the correct frequency, amplitude, and phase from this it would likely sound nothing like the real instrument.

The attack is very distinct for different instruments, perhaps the sustain is as well, but all instruments have damping which is frequency dependent. Over time the fundamental is the last tone to die out.

If you really want a high quality replication of an instrument you want to cut the spectrum up into small time windows, zero pad and window the data then FFT this. You will then create a synthesized sound with different components as a function of time.

You can control many factors using this technique.

5
  • The explanation sounds a bit strange to me because of the musical terms, but otherwise it has very good (basic) information. +1 – virolino Sep 16 '20 at 5:32
  • @virolino I don't see any musical terms here. Which terms were you thinking of? – phoog Sep 16 '20 at 12:40
  • I think these are mostly physics terms but they relate to music – ggcg Sep 16 '20 at 15:36
  • I must have had something else in my mind. I re-read the answer and it does not look "frightening" :) I will delete both comments later today, after you have a chance to read them. Thanks for pointing out my mistake. The up-vote remains, though. – virolino Sep 17 '20 at 5:40
  • No need to delete comments. They are helpful – ggcg Sep 17 '20 at 10:23
4

An instrument sound is made up by different characteristics. One of them is the spectral component (as in harmonics...) but others are related to attack (for instance, a guitar always has a strong attack whereas a violin can be bowed to have a low attack).

This has more to do with amplitude as a function of time.

When it comes to an instrument's tonality, the sound an instrument makes is made up of the fundamental tone and a series of harmonics (notes of higher frequency which are a multiple of the fundamental tone). The number and relative amplitudes of the harmonics are what allows you to tell one instrument from another. Unfortunately, I do not know of any reference that can tell you exactly what are the harmonics' relative amplitude for each instrument. Good luck and keep us posted!

-1

You can consider every sound as being made up of a number of sine waves, each with variable amplitude and frequency.

I hope that this ability does not increase only through long periods of practice.

Sorry, but there will be a lot of learning to do! You could start with a program that is able to analyse sounds from the point of view i mentioned. One example is http://www.klingbeil.com/spear/.

-1

@ggcg already provided very good information, which I will not repeat. I just want to add the following:

  1. A very cheap way to play the synthesized sounds you make is to use the sound card of a computer. The same sound card, together with the appropriate software, can be used for sound acquisition and processing (calculating FFTs), wave forms (oscilloscope), frequency distribution (spectrum analyzer)... You play the sounds from the instruments you want to mimic into the microphone connected to the soundcard, and then start the analysis and synthesis.

  2. It is a very common practice that the sounds of the instruments are no longer synthesized from sine waves. They just record the sounds made by the instruments, clean them a bit if necessary, and they play them as needed. Additionally, you might be interested to learn more about SoundFonts (and other similar technologies):

MIDI files do not contain any sounds, only instructions to play them. To play such files, sample-based MIDI synthesizers use recordings of instruments and sounds stored in a file or ROM chip.

With this approach in mind, you will be able to play not only music instruments, but also bird sounds, forest sounds, machinery working...


The problem is I don't have the trick to make a good sound myself.

"Good sound" is quite incompatible with "trick". What you want is actually real science, and to provide a proof, think about the Fraunhofer Institute. Read here about their most known technologies, including the ubiquitous mp3 music file format.

1
  • Is the brave down-voter kind enough to explain the reason for down-voting, please? – virolino Sep 17 '20 at 5:42

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