Start the server to begin!
s.boot;
Loudness depends upon the amplitude of a sound. If we take two sine waves of the same frequency, the wave with the higher amplitude will sound louder to us.
var amp = 0.1; // change the amplitude to test
x = {SinOsc.ar(440, mul: amp) ! 2}.play;
x.free;
Does loudness depend upon the frequency? To be sure, open up the meter to see the sound level from your speakers and try different frequencies between 20Hz and 20000Hz. What conclusions can you draw?
s.meter;
var freq = 2000; // Start at 20Hz and go up to around 20,000Hz
x = {SinOsc.ar(freq, mul: 0.1) ! 2}.play;
x.free;
Try sweeping the entire frequency spectrum. Is the loudness consistent across all frequencies. The frequencies are polled. Follow along in the post window and try to match your perception with the current frequency.
x = {SinOsc.ar(XLine.ar(20, 20000, 20).poll, mul: 0.1) ! 2}.play;
x.free;
Does loudness depend upon the duration of the sound? Here we will play two sine waves but one of them will be played for a split second and the other will be played for a longer time. Which one sounds louder? Do they sound the same?
x = {
var sig, env, dur;
dur = 0.01; // Change between 0.01 and 1
sig = SinOsc.ar(2000, mul: 0.1);
env = EnvGen.kr(Env([0, 1, 1, 0], [0.05, dur, 0.05]), doneAction: 2);
sig * env
}.play
Loudness increases as duration increases up to about 0.2 seconds.