User Tools

Site Tools


minimizing_20sound_20clicks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

minimizing_20sound_20clicks [2018/03/31 13:19]
127.0.0.1 external edit
minimizing_20sound_20clicks [2018/04/15 12:47] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Minimizing sound clicks===== =====Minimizing sound clicks=====
  
-//by Richard Russell, January 2010//\\ \\  When generating music using the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwin7.html#​sound|SOUND]] statement, **clicks** may sometimes be audible at the start and/or end of notes. These clicks are likely to be more noticeable when listening in high-quality,​ such as on headphones or when feeding the PC's sound output to a hi-fi system.\\ \\  ​There are four main causes of such clicks; these are listed below along with methods for minimizing the effect.\\ \\ +//by Richard Russell, January 2010//\\ \\  When generating music using the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwin7.html#​sound|SOUND]] statement, **clicks** may sometimes be audible at the start and/or end of notes. These clicks are likely to be more noticeable when listening in high-quality,​ such as on headphones or when feeding the PC's sound output to a hi-fi system. 
 + 
 +There are four main causes of such clicks; these are listed below along with methods for minimizing the effect. 
 + 
 ===== Using SOUND OFF ===== ===== Using SOUND OFF =====
-\\  ​Never use SOUND OFF to terminate a playing note; this shuts down the entire BB4W sound system and is likely to result in a large output transient. To terminate a note before its duration has been completed (or when the duration has been set to '​infinite'​) use the **flush** bit.\\ \\  ​Instead of:\\ + 
 +Never use SOUND OFF to terminate a playing note; this shuts down the entire BB4W sound system and is likely to result in a large output transient. To terminate a note before its duration has been completed (or when the duration has been set to '​infinite'​) use the **flush** bit. 
 + 
 +Instead of: 
 + 
 +<code bb4w> ​
         SOUND OFF         SOUND OFF
-Use:\\ +</​code>​ 
 + 
 +Use: 
 + 
 +<code bb4w>
         SOUND &10, 0, 0, 0         SOUND &10, 0, 0, 0
         SOUND &11, 0, 0, 0         SOUND &11, 0, 0, 0
         SOUND &12, 0, 0, 0         SOUND &12, 0, 0, 0
         SOUND &13, 0, 0, 0         SOUND &13, 0, 0, 0
-\\ +</​code>​ 
 ===== Sudden amplitude changes ===== ===== Sudden amplitude changes =====
-\\  ​If you are using the '​constant amplitude'​ form of the SOUND statement (where the second parameter is negative) then, when you need to change the amplitude, do so gradually.\\ \\  ​Instead of doing this:\\ + 
 +If you are using the '​constant amplitude'​ form of the SOUND statement (where the second parameter is negative) then, when you need to change the amplitude, do so gradually. 
 + 
 +Instead of doing this: 
 + 
 +<code bb4w>
         SOUND 1,​-15,​148,​20         SOUND 1,​-15,​148,​20
         SOUND 1,​-10,​148,​20         SOUND 1,​-10,​148,​20
-Do this:\\ +</​code>​ 
 + 
 +Do this: 
 + 
 +<code bb4w>
         SOUND 1,​-15,​148,​18         SOUND 1,​-15,​148,​18
         SOUND 1,-14,148,1         SOUND 1,-14,148,1
Line 22: Line 44:
         SOUND 1,-11,148,1         SOUND 1,-11,148,1
         SOUND 1,​-10,​148,​18         SOUND 1,​-10,​148,​18
-Or consider using envelopes to achieve a similar effect:\\ +</​code>​ 
 +    
 +Or consider using envelopes to achieve a similar effect: 
 + 
 +<code bb4w>
         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​120,​0         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​120,​0
         ENVELOPE 2,​1,​0,​0,​0,​0,​0,​0,​-20,​0,​0,​-20,​80,​0         ENVELOPE 2,​1,​0,​0,​0,​0,​0,​0,​-20,​0,​0,​-20,​80,​0
         SOUND 1,1,148,20         SOUND 1,1,148,20
         SOUND 1,2,148,20         SOUND 1,2,148,20
-\\ +</​code>​ 
 ===== Excessive attack or release rates ===== ===== Excessive attack or release rates =====
-\\  ​If you are using an amplitude envelope (where the second parameter of the SOUND statement is positive) don't make the attack and release rates too great.\\ \\  ​For example, instead of using:\\ + 
 +If you are using an amplitude envelope (where the second parameter of the SOUND statement is positive) don't make the attack and release rates too great. 
 + 
 +For example, instead of using: 
 + 
 +<code bb4w>
         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​127,​0,​0,​-127,​126,​0         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​127,​0,​0,​-127,​126,​0
-Use:\\ +</​code>​ 
 + 
 +Use: 
 + 
 +<code bb4w> ​
         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​126,​0         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​126,​0
-(where the attack and release rates have been reduced from 127 to 20).\\ \\ +</​code>​ 
 +(where the attack and release rates have been reduced from 127 to 20). 
 ===== Rests (silent notes) ===== ===== Rests (silent notes) =====
-\\  ​If you need a period of silence on a particular channel (a **rest**) use one or other of the following techniques, depending on whether you are using a constant amplitude or an envelope:\\ \\ + 
 +If you need a period of silence on a particular channel (a **rest**) use one or other of the following techniques, depending on whether you are using a constant amplitude or an envelope: 
 ==== Constant amplitude ==== ==== Constant amplitude ====
- Set the //pitch// to zero, **not** the //​amplitude//​.\\ \\  Instead of:\\ + 
 +Set the //pitch// to zero, **not** the //​amplitude//​.\\ \\  Instead of: 
 + 
 +<code bb4w>
         SOUND 1,​-15,​148,​10         SOUND 1,​-15,​148,​10
         SOUND 1,0,148,10 : REM rest         SOUND 1,0,148,10 : REM rest
         SOUND 1,​-15,​100,​10         SOUND 1,​-15,​100,​10
-Use:\\ +</​code>​ 
 + 
 +Use: 
 + 
 +<code bb4w>
         SOUND 1,​-15,​148,​10         SOUND 1,​-15,​148,​10
         SOUND 1,-15,0,10 : REM rest         SOUND 1,-15,0,10 : REM rest
         SOUND 1,​-15,​100,​10         SOUND 1,​-15,​100,​10
-\\ +</​code>​ 
 ==== Amplitude envelope ==== ==== Amplitude envelope ====
- Use the **hold** bit to allow the sound to decay rather than stop suddenly:\\ \\  Instead of:\\ + 
 +Use the **hold** bit to allow the sound to decay rather than stop suddenly:\\ \\  Instead of: 
 + 
 +<code bb4w>
         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​126,​0         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​126,​0
         SOUND 1,1,148,10         SOUND 1,1,148,10
         SOUND 1,1,0,10 : REM rest         SOUND 1,1,0,10 : REM rest
         SOUND 1,1,100,10         SOUND 1,1,100,10
-Use:\\ +</​code>​ 
 + 
 +Use: 
 + 
 +<code bb4w>
         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​126,​0         ENVELOPE 1,​1,​0,​0,​0,​0,​0,​0,​20,​0,​0,​-20,​126,​0
         SOUND 1,1,148,10         SOUND 1,1,148,10
         SOUND &​1001,​1,​0,​10 : REM rest         SOUND &​1001,​1,​0,​10 : REM rest
         SOUND 1,1,100,10         SOUND 1,1,100,10
 +</​code>​
minimizing_20sound_20clicks.1522502369.txt.gz · Last modified: 2018/03/31 13:19 by 127.0.0.1