If we have to create a computer software which produces different pitches of a musical instrument, then, according to musicians is there a minimum time (in seconds or milliseconds) sound of that pitch should stay and audible? Is there any rule about that like if we press a key in software it should produce a pitch for ¼ second or ½ second or so? If we produce a computer software which produces desired pitch for 1⁄10000 second it will be useless, won't it? Then what is the minimum /maximum time in seconds a software should produce a pitch?
2 Answers
No, there is no single fixed constant time. It depends.
Pretty much all instruments allow the player to vary the time for which notes are held. In some cases very extreme (a Hammond organ allows you to trivially hold notes indefinitely, but also allows millisecond-short staccato), in some case only subtly (a xylophone or bass drum doesn't have much sustain to begin with, but with active damping can you make the sound yet a bit shorter).
A sound that only lasts for 1⁄10000 s is indeed pretty useless, it certainly won't have any distinguishable pitch – basically, it'll just sound like a very sharp snap/clap. But a sound that lasts for multiple seconds is also not often very useful, because it allows hardly any musical movement without everything ending up as just a cacophonic jumble.
Even what range of durations is desirable depends highly on what musical setting the tones are to be used in. For very sombre or æthereal music, there may be only few notes most of which last a second or upwards, whereas virtuousic pieces may have countless very short notes of mostly only tens of milliseconds each, which normally gives a pretty restless, energetic result. (Clever use of such short notes may give you an end result that's again rather dreamily-textured though.)
If I were to give any concrete bounds on what note lengths should be considered, I'd say 30 ms − 10 s, but really I don't think it makes much sense to use that in any rigid way. It is possible to start music with a fixed grid of, say, 32th notes of 60 ms each, but that's pretty limiting – it makes anything that's not pretty hectic more complicated than necessary, whilst on the other hand still not allowing truely sharp staccato.
The minimum and maximum really depends on taste and what you are trying to do. It depends greatly on what instrument you're dealing with to the extent that the sustain (as well as attack) is a large part of what gives each instrument its unique character. It's not just the length but also the "shape".
So a piano has a sharp attack, no sustain, but then starts decaying slowly while you hold down the key. A bowed string might have a slower attack followed by a sustain while the player is still bowing and quick release when they stop. A banjo has a fast attack, a fast decay, and almost no sustain. The times (both overall as well as the "shape") are not only different for each instrument but they are a large part of what make that instrument sound like that instrument.
On that note—and I'd think you'd want to know this anyway to create such software—I'd read up on the concept of ADSR envelopes. That stands for attack, decay, sustain, and release. Synthesizers, samplers, and such use these parameters to make changes to the volume of a note over time to emulate the same type of changes that happen in real instruments. Learning how to tweak a synth's ADSR params so that it emulates a real instrument will teach you a ton about the length and shape of the volume of "a note".
-
1Though in synthesizer ADSR terminology one might say a piano has “no sustain”, this would elsewhere be misunderstood as “the sound decays instantly”. ADSR isn't such a great model for real instruments IMO – they either have basically instant attack followed by one natural exponential decay curve (plucked strings, percussion...), or they can freely choose their loudness over the entire duration, in which case you may well have far more complex shapes like “rather quiet but fast attack, then held at low level save for a crescendo towards the end”. That would require multiple ADSRs. Commented Mar 17, 2018 at 20:08
-
1Yes, fair points, I definitely don't disagree. I'm always going back and forth on when to use "sustain". As a guitarist first, I tend to use it as "the length of the decay" but I tried to stay consistent given that I was mentioning ADSR in the same breath. And while it's not a perfect model, I still think OP would benefit from playing with an ADSR envelope or something like it. There's nothing like having to create instrument patches yourself. Commented Mar 17, 2018 at 21:03