Sound design tricks

Sound design tip & tricks, gathered through experience.

Adding dynamics to the sound using parallel modulation of the synth’s main amplitude envelope.

The curve of modulation aligns naturally with the curve of the sound’s amplitude.

SynthDef(\x,
	
	{
		|rate 864 bus 0|
		
		// initially define main envelope 
		
		var env = 
		
		(
			Env xyc: // [ time, level, curve ]
			
			[
				[ 0, 0, 'sin' ],
				
				[ 0.515625, 1, 'sin' ],
				
				[ 1.03125, 0, 'sin' ]
			]
		)	
		
		;
		
		Out.ar
		
		(
			bus, 
			
			Pan2.ar
			
			(
				level:
				
				(
					AmpComp.kr
					
					(
						freq: rate, 
						
						root: 27, 
						
						exp: 0.25
					) 
					
					* 
					
					env.ar
					
					(
						doneAction: 
						
						(
							Done.freeSelf
						)
					)
				),
				
				pos:
				
				(
					0	// -1..1
				),
				
				in:
				
				(
					Resonz.ar
					
					(
						in:
						
						(
							Saw ar: rate
						),
						
						freq:
						
						(
							rate / 2
						),
						
						bwr: // bandwidth ratio
						
						(
							// compare the envelope against purely static values
							
							env.ar
							
							(
								levelBias: 0.1 // docs warn about values close to zero
							)
							
							// 0.5
							// 1.0
						)
					)
				)
			)
		)
	}
)

.play

Forcibly working around values close to zero for the bandwidth ratio at the end of the SynthDef, a separate EnvGen is used with slightly offset level values.

The envelope of the sound’s amplitude is often the most sensible choice for dynamic modulation, while maintaining a sense of cohesion.

hey, maybe its just me. but im really having a hard time to read the code. This makes it more difficult than it has to be imo.

2 Likes

It isn’t only you. Code style has been discussed before. On the one hand, it was proposed that a vertical-whitespace style breaks up the syntactic units to improve readability. The other hand was that syntactical preferences far outside more common styles are likely to alienate readers (i.e. “I’m having a hard time to read it”).

Just like free speech – one is free to write as one likes, but one also hasn’t any right to others’ attention.

hjh

2 Likes

It’s certainly not just you :slight_smile: People (including myself) have told @Rainer that his coding style is very idiosyncratic - which is not a problem in itself - but if one expects their code to be read and understood, it’s a good idea to use a somewhat familiar style.

Imagine

posting

on

a

forum

and

writing

all

your

sentences

like

this.

2 Likes

The difference sounded subtle to me at first, but on second hearing one can hear a difference between the enveloped version and the static versions. It perhaps adds a bit more “life” or “dynamism” to the sound.

3 Likes

Thanks everyone.

Thanks @shihhs.

Parallel envelope assignment is arguably “rule number one”, in this case, and I would love to see some more advanced or experimental ideas take the stage.