Home » Archimedes archive » Acorn User » AU 1998-02 A.adf » PDScheme » ArtToSpr/WavePlayer/Help/TextHelp/4c-Samples

ArtToSpr/WavePlayer/Help/TextHelp/4c-Samples

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-02 A.adf » PDScheme
Filename: ArtToSpr/WavePlayer/Help/TextHelp/4c-Samples
Read OK:
File size: 08A6 bytes
Load address: 0000
Exec address: 0000
File contents
+---------------------------------------------------------------------------+
|                                WAVE PLAYER                                |
|                          � 1997, Matthew Wilson                           |
+---------------------------------------------------------------------------+
|                                  SAMPLES                                  |
+---------------------------------------------------------------------------+

  In order to create sound, your computer must constantly alter the voltage
across the sound output, so that your speaker(s) can move. Traditional
systems use an analogue system to record the relative voltage, and thus the
relative position of the speaker. However, computers cannot store analogue
numbers, and thus store a number relating to the voltage.

  The first important idea is that the speaker has a rest position, and can
move both forward and backward from that point. Therefore, the number stored
must either have a biased added (ie. unsigned), or be signed.

  The second idea is that these numbers are discrete; that is to say, they
represent the voltage at a particular instant. Therefore, a large number of
numbers, or /samples/, are required per second. This is usually referred to
as the frequency, or sample rate. CD systems use a rate of 44.1kHz - 44,100
samples per second. However, for most purposes, a rate of nearer 20kHz is
adequate.

  The third idea is that these numbers are integers (whole numbers) and have
a maximum and minimum. Therefore, there is a limit to the accuracy to which
they can be stored. The causes of the difference between the stored value and
the true value is called quantisation. Sound effects are fine stored with 256
values (8 bit), but higher quality requires 12 or 16 bits (4096 and 65536
values respectively).

  The graphs in the drawfile �4z-graph� show a set of samples taken with
relative displacements of -6 to +6. Note the very sharp edges when played
back - even if this were possible, then the entire spectrum of frequencies
would be produced, creating a �singing� effect. In fact, the sharp edges are
impossible to achieve, as the voltage would have to change infinitely
quickly.
00000000  2b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |+---------------|
00000010  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2b 0a 7c 20  |------------+.| |
00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 57  |               W|
00000070  41 56 45 20 50 4c 41 59  45 52 20 20 20 20 20 20  |AVE PLAYER      |
00000080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000090  20 20 20 20 20 20 20 20  20 20 7c 0a 7c 20 20 20  |          |.|   |
000000a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000000b0  20 20 20 20 20 20 20 a9  20 31 39 39 37 2c 20 4d  |       . 1997, M|
000000c0  61 74 74 68 65 77 20 57  69 6c 73 6f 6e 20 20 20  |atthew Wilson   |
000000d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000000e0  20 20 20 20 20 20 20 20  7c 0a 2b 2d 2d 2d 2d 2d  |        |.+-----|
000000f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000130  2d 2d 2d 2d 2d 2d 2b 0a  7c 20 20 20 20 20 20 20  |------+.|       |
00000140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000150  20 20 20 20 20 20 20 20  20 20 20 53 41 4d 50 4c  |           SAMPL|
00000160  45 53 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ES              |
00000170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000180  20 20 20 20 7c 0a 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  |    |.+---------|
00000190  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000001d0  2d 2d 2b 0a 0a 20 20 49  6e 20 6f 72 64 65 72 20  |--+..  In order |
000001e0  74 6f 20 63 72 65 61 74  65 20 73 6f 75 6e 64 2c  |to create sound,|
000001f0  20 79 6f 75 72 20 63 6f  6d 70 75 74 65 72 20 6d  | your computer m|
00000200  75 73 74 20 63 6f 6e 73  74 61 6e 74 6c 79 20 61  |ust constantly a|
00000210  6c 74 65 72 20 74 68 65  20 76 6f 6c 74 61 67 65  |lter the voltage|
00000220  0a 61 63 72 6f 73 73 20  74 68 65 20 73 6f 75 6e  |.across the soun|
00000230  64 20 6f 75 74 70 75 74  2c 20 73 6f 20 74 68 61  |d output, so tha|
00000240  74 20 79 6f 75 72 20 73  70 65 61 6b 65 72 28 73  |t your speaker(s|
00000250  29 20 63 61 6e 20 6d 6f  76 65 2e 20 54 72 61 64  |) can move. Trad|
00000260  69 74 69 6f 6e 61 6c 0a  73 79 73 74 65 6d 73 20  |itional.systems |
00000270  75 73 65 20 61 6e 20 61  6e 61 6c 6f 67 75 65 20  |use an analogue |
00000280  73 79 73 74 65 6d 20 74  6f 20 72 65 63 6f 72 64  |system to record|
00000290  20 74 68 65 20 72 65 6c  61 74 69 76 65 20 76 6f  | the relative vo|
000002a0  6c 74 61 67 65 2c 20 61  6e 64 20 74 68 75 73 20  |ltage, and thus |
000002b0  74 68 65 0a 72 65 6c 61  74 69 76 65 20 70 6f 73  |the.relative pos|
000002c0  69 74 69 6f 6e 20 6f 66  20 74 68 65 20 73 70 65  |ition of the spe|
000002d0  61 6b 65 72 2e 20 48 6f  77 65 76 65 72 2c 20 63  |aker. However, c|
000002e0  6f 6d 70 75 74 65 72 73  20 63 61 6e 6e 6f 74 20  |omputers cannot |
000002f0  73 74 6f 72 65 20 61 6e  61 6c 6f 67 75 65 0a 6e  |store analogue.n|
00000300  75 6d 62 65 72 73 2c 20  61 6e 64 20 74 68 75 73  |umbers, and thus|
00000310  20 73 74 6f 72 65 20 61  20 6e 75 6d 62 65 72 20  | store a number |
00000320  72 65 6c 61 74 69 6e 67  20 74 6f 20 74 68 65 20  |relating to the |
00000330  76 6f 6c 74 61 67 65 2e  0a 0a 20 20 54 68 65 20  |voltage...  The |
00000340  66 69 72 73 74 20 69 6d  70 6f 72 74 61 6e 74 20  |first important |
00000350  69 64 65 61 20 69 73 20  74 68 61 74 20 74 68 65  |idea is that the|
00000360  20 73 70 65 61 6b 65 72  20 68 61 73 20 61 20 72  | speaker has a r|
00000370  65 73 74 20 70 6f 73 69  74 69 6f 6e 2c 20 61 6e  |est position, an|
00000380  64 20 63 61 6e 0a 6d 6f  76 65 20 62 6f 74 68 20  |d can.move both |
00000390  66 6f 72 77 61 72 64 20  61 6e 64 20 62 61 63 6b  |forward and back|
000003a0  77 61 72 64 20 66 72 6f  6d 20 74 68 61 74 20 70  |ward from that p|
000003b0  6f 69 6e 74 2e 20 54 68  65 72 65 66 6f 72 65 2c  |oint. Therefore,|
000003c0  20 74 68 65 20 6e 75 6d  62 65 72 20 73 74 6f 72  | the number stor|
000003d0  65 64 0a 6d 75 73 74 20  65 69 74 68 65 72 20 68  |ed.must either h|
000003e0  61 76 65 20 61 20 62 69  61 73 65 64 20 61 64 64  |ave a biased add|
000003f0  65 64 20 28 69 65 2e 20  75 6e 73 69 67 6e 65 64  |ed (ie. unsigned|
00000400  29 2c 20 6f 72 20 62 65  20 73 69 67 6e 65 64 2e  |), or be signed.|
00000410  0a 0a 20 20 54 68 65 20  73 65 63 6f 6e 64 20 69  |..  The second i|
00000420  64 65 61 20 69 73 20 74  68 61 74 20 74 68 65 73  |dea is that thes|
00000430  65 20 6e 75 6d 62 65 72  73 20 61 72 65 20 64 69  |e numbers are di|
00000440  73 63 72 65 74 65 3b 20  74 68 61 74 20 69 73 20  |screte; that is |
00000450  74 6f 20 73 61 79 2c 20  74 68 65 79 0a 72 65 70  |to say, they.rep|
00000460  72 65 73 65 6e 74 20 74  68 65 20 76 6f 6c 74 61  |resent the volta|
00000470  67 65 20 61 74 20 61 20  70 61 72 74 69 63 75 6c  |ge at a particul|
00000480  61 72 20 69 6e 73 74 61  6e 74 2e 20 54 68 65 72  |ar instant. Ther|
00000490  65 66 6f 72 65 2c 20 61  20 6c 61 72 67 65 20 6e  |efore, a large n|
000004a0  75 6d 62 65 72 20 6f 66  0a 6e 75 6d 62 65 72 73  |umber of.numbers|
000004b0  2c 20 6f 72 20 2f 73 61  6d 70 6c 65 73 2f 2c 20  |, or /samples/, |
000004c0  61 72 65 20 72 65 71 75  69 72 65 64 20 70 65 72  |are required per|
000004d0  20 73 65 63 6f 6e 64 2e  20 54 68 69 73 20 69 73  | second. This is|
000004e0  20 75 73 75 61 6c 6c 79  20 72 65 66 65 72 72 65  | usually referre|
000004f0  64 20 74 6f 0a 61 73 20  74 68 65 20 66 72 65 71  |d to.as the freq|
00000500  75 65 6e 63 79 2c 20 6f  72 20 73 61 6d 70 6c 65  |uency, or sample|
00000510  20 72 61 74 65 2e 20 43  44 20 73 79 73 74 65 6d  | rate. CD system|
00000520  73 20 75 73 65 20 61 20  72 61 74 65 20 6f 66 20  |s use a rate of |
00000530  34 34 2e 31 6b 48 7a 20  2d 20 34 34 2c 31 30 30  |44.1kHz - 44,100|
00000540  0a 73 61 6d 70 6c 65 73  20 70 65 72 20 73 65 63  |.samples per sec|
00000550  6f 6e 64 2e 20 48 6f 77  65 76 65 72 2c 20 66 6f  |ond. However, fo|
00000560  72 20 6d 6f 73 74 20 70  75 72 70 6f 73 65 73 2c  |r most purposes,|
00000570  20 61 20 72 61 74 65 20  6f 66 20 6e 65 61 72 65  | a rate of neare|
00000580  72 20 32 30 6b 48 7a 20  69 73 0a 61 64 65 71 75  |r 20kHz is.adequ|
00000590  61 74 65 2e 0a 0a 20 20  54 68 65 20 74 68 69 72  |ate...  The thir|
000005a0  64 20 69 64 65 61 20 69  73 20 74 68 61 74 20 74  |d idea is that t|
000005b0  68 65 73 65 20 6e 75 6d  62 65 72 73 20 61 72 65  |hese numbers are|
000005c0  20 69 6e 74 65 67 65 72  73 20 28 77 68 6f 6c 65  | integers (whole|
000005d0  20 6e 75 6d 62 65 72 73  29 20 61 6e 64 20 68 61  | numbers) and ha|
000005e0  76 65 0a 61 20 6d 61 78  69 6d 75 6d 20 61 6e 64  |ve.a maximum and|
000005f0  20 6d 69 6e 69 6d 75 6d  2e 20 54 68 65 72 65 66  | minimum. Theref|
00000600  6f 72 65 2c 20 74 68 65  72 65 20 69 73 20 61 20  |ore, there is a |
00000610  6c 69 6d 69 74 20 74 6f  20 74 68 65 20 61 63 63  |limit to the acc|
00000620  75 72 61 63 79 20 74 6f  20 77 68 69 63 68 0a 74  |uracy to which.t|
00000630  68 65 79 20 63 61 6e 20  62 65 20 73 74 6f 72 65  |hey can be store|
00000640  64 2e 20 54 68 65 20 63  61 75 73 65 73 20 6f 66  |d. The causes of|
00000650  20 74 68 65 20 64 69 66  66 65 72 65 6e 63 65 20  | the difference |
00000660  62 65 74 77 65 65 6e 20  74 68 65 20 73 74 6f 72  |between the stor|
00000670  65 64 20 76 61 6c 75 65  20 61 6e 64 0a 74 68 65  |ed value and.the|
00000680  20 74 72 75 65 20 76 61  6c 75 65 20 69 73 20 63  | true value is c|
00000690  61 6c 6c 65 64 20 71 75  61 6e 74 69 73 61 74 69  |alled quantisati|
000006a0  6f 6e 2e 20 53 6f 75 6e  64 20 65 66 66 65 63 74  |on. Sound effect|
000006b0  73 20 61 72 65 20 66 69  6e 65 20 73 74 6f 72 65  |s are fine store|
000006c0  64 20 77 69 74 68 20 32  35 36 0a 76 61 6c 75 65  |d with 256.value|
000006d0  73 20 28 38 20 62 69 74  29 2c 20 62 75 74 20 68  |s (8 bit), but h|
000006e0  69 67 68 65 72 20 71 75  61 6c 69 74 79 20 72 65  |igher quality re|
000006f0  71 75 69 72 65 73 20 31  32 20 6f 72 20 31 36 20  |quires 12 or 16 |
00000700  62 69 74 73 20 28 34 30  39 36 20 61 6e 64 20 36  |bits (4096 and 6|
00000710  35 35 33 36 0a 76 61 6c  75 65 73 20 72 65 73 70  |5536.values resp|
00000720  65 63 74 69 76 65 6c 79  29 2e 0a 0a 20 20 54 68  |ectively)...  Th|
00000730  65 20 67 72 61 70 68 73  20 69 6e 20 74 68 65 20  |e graphs in the |
00000740  64 72 61 77 66 69 6c 65  20 90 34 7a 2d 67 72 61  |drawfile .4z-gra|
00000750  70 68 91 20 73 68 6f 77  20 61 20 73 65 74 20 6f  |ph. show a set o|
00000760  66 20 73 61 6d 70 6c 65  73 20 74 61 6b 65 6e 20  |f samples taken |
00000770  77 69 74 68 0a 72 65 6c  61 74 69 76 65 20 64 69  |with.relative di|
00000780  73 70 6c 61 63 65 6d 65  6e 74 73 20 6f 66 20 2d  |splacements of -|
00000790  36 20 74 6f 20 2b 36 2e  20 4e 6f 74 65 20 74 68  |6 to +6. Note th|
000007a0  65 20 76 65 72 79 20 73  68 61 72 70 20 65 64 67  |e very sharp edg|
000007b0  65 73 20 77 68 65 6e 20  70 6c 61 79 65 64 0a 62  |es when played.b|
000007c0  61 63 6b 20 2d 20 65 76  65 6e 20 69 66 20 74 68  |ack - even if th|
000007d0  69 73 20 77 65 72 65 20  70 6f 73 73 69 62 6c 65  |is were possible|
000007e0  2c 20 74 68 65 6e 20 74  68 65 20 65 6e 74 69 72  |, then the entir|
000007f0  65 20 73 70 65 63 74 72  75 6d 20 6f 66 20 66 72  |e spectrum of fr|
00000800  65 71 75 65 6e 63 69 65  73 0a 77 6f 75 6c 64 20  |equencies.would |
00000810  62 65 20 70 72 6f 64 75  63 65 64 2c 20 63 72 65  |be produced, cre|
00000820  61 74 69 6e 67 20 61 20  90 73 69 6e 67 69 6e 67  |ating a .singing|
00000830  91 20 65 66 66 65 63 74  2e 20 49 6e 20 66 61 63  |. effect. In fac|
00000840  74 2c 20 74 68 65 20 73  68 61 72 70 20 65 64 67  |t, the sharp edg|
00000850  65 73 20 61 72 65 0a 69  6d 70 6f 73 73 69 62 6c  |es are.impossibl|
00000860  65 20 74 6f 20 61 63 68  69 65 76 65 2c 20 61 73  |e to achieve, as|
00000870  20 74 68 65 20 76 6f 6c  74 61 67 65 20 77 6f 75  | the voltage wou|
00000880  6c 64 20 68 61 76 65 20  74 6f 20 63 68 61 6e 67  |ld have to chang|
00000890  65 20 69 6e 66 69 6e 69  74 65 6c 79 0a 71 75 69  |e infinitely.qui|
000008a0  63 6b 6c 79 2e 0a                                 |ckly..|
000008a6