A microporcessor based digital sampler and processor (processor is defined in this ..... The primary purpose of the effects unit is for recording a short rift (up to ...
DEVELOPMENT OF A LOW-COST DIGITAL SAMPLING AND PROCESSING SYSTEM FOR MUSICAL INSTRUMENT APPLICATION
By John E. Lane P.O.Box 9204 University, MS 38677 April 18, 1987
I.
INTRODUCTION A microporcessor based digital sampler and processor
defined
in
derived
from the input,
has
(processor
this context as a digital transformation where the
but is not necessarily a duplicate of the
the undeniable advant·age of simplicity,
functional
versiti1ity.
advantage
of
speed.
output
The
analogous as
However,
ease of
pure wil l
be
shown
system in
is
input)
implementation,
hardware
is
has
Section
and the II,
microprocesser speeds are fast enough for most audio sampling applications. The
simp1iest example of microprocessor based sampling and
processing
is
the time delay , implemented by the following a lgorithm (See Figure 1):
•
The sampled data is read from an initially blank memory location.
1 2
_
Write
3 4
•
New sampled data is then written to that same location.
•
Both the READ and WRITE indexes are incremented.
•
This process is continued until the end of the buffer is reached, at which point both indexes are reset to the start of the buffer.
· · · ·
N
Figure 1. Schematic of timedelay algorithm.
The resulting processed effect is a time delay:
t
where the
t
s
length
d
=
N
t
s
is the sample rate (inverse of the sample frequency) and N is of
the
The
buffer.
above
process
can
be
symbolically
represented by t he following: (1)
2
where
it is imp lied that a buffer of length
N is used and that the
Read
Write indexes are continuously cycled through the buffer at the sample
and rate
t. s
W k
and
~
are thought of as process operators.
As is
true
with conventional operator notation, the operators are evaluated from right to
left.
The
subscript
k
indicates the number by which the
incremented for the next read or write operation. cancels the operation, is
useful
index
is
A bar above the operator
thus producing a null operator.
The null operator
for purposes of padding the assembly code with time
delays
to
insure balanced code (all branches result in the same execution time). In order to demonstrate the usefulness of this notation, the previous process can be written as: (2)
which
produces the same result.
described equivalent
by
Equation
(1)
transformation.
Equation (2) describes two operations as
in
sequence,
Note that the
which
'+'
generates
an
entirely
does not indicate a sum but
simply connects the two operators into a string of operations. Another
useful
process is generated,
described
by
commuting
the
operators in Equation (2): (3)
This
digital trsnsformation has no apparent effect,
duplicate of the input.
However,
i.e.
the output is a
the buffer is continuously updated with
new data, thus a sampled signal of duration
td
is recorded in memory.
If
this process is continued until the end of the buffer, then replaced by the following process:
3
the
contents
of
the buffer will be
continually
repeated.
The
process
produced is a continous play-back of the recorded signal. Other possibilities are: (5)
which
reduces
octave).
the
play-back
speed by half (notes
are
lowered
by
one
The process, (6)
doubles the play-back speed (notes are doubled in frequency) . and (7)
repeats the recorded phrase at a speed increase of 1.5 (notes are raised by a fifth). Other combinations can be immediately generated such as the following which is closely related to Equation (2), the delay effect: (8)
produces a frequency doubling delay effect.
The transformation described by, (9)
produces
a half frequency delay.
Other possibilities are
number of which may be useful remains to be discovered.
4
numerous,
the
Applications
for
this
type
of digital processing
as
applied
to
musical instruments include: •
Learning aids for students (similar to the use of a metronome).
•
Audio effects applications for the preformer .
•
Entertainment for the novice musician.
Section
II
examines the speed limitations imposed on
the
sampling
rate by the software implementation of these processes.
II.
PRELIMINARY RESULTS Equation
(1)
can
be implemented in 6809 (4 MHz) assembly
code
as
follows: time (microseconds)
Ll
LDX
IIBufadr
3
L2
LDA STA LDA STA
,X DAC ADC ,X+
4 5 5 6
CMPX BHI BRA
liN L1 L2
4 3 3 (f/2 = 16.7 kHz)
30 With
N = 64k and a
t
Appendix
I
seconds. processes.
s
= 30 microseconds, examines
the
the maximum delay time is
assembly
coding
of
other
In most cases the sampling rate imposed by the software
1.9
useful (6809
at 4 MHz) is in the 25 to 35 kHz range which corresponds to a maximum audio frequency
(f/2)
of 12.5 to 17.5 kHz.
A faster CPU would
increase
this
range by a proportional amount. Appendix
II
contains
a
description
5
of
the
DX6
experimental
processing system. This
allowed
for
Note that the internal sampling has been set to 8 kHz. simpler
hardware design
and
less
critical
software
implementation.
PHASE 1 PROPOSAL
III.
A.
Immediate Goals Improvement
accomplished increasing
can
be
by extending the sampling rate to the 25 to 35 kHz range
and
of
the
existing
OX6
sampling
available memory to multiple banks of 64k.
system
The interface
and
control
functions must also be improved to accommodate a wider variety
of
users.
Once
to
t his is accomplished,
the product should be turned over
manufacturing for final development.
A short-term design cycle followed by
near-term market introduction would hopefully yield a profit, part of which could
be
immediately reinvested in this type of research and
development
activity. The probably
immediate
development
and
enhancement
of
the
be limited to the already chosen system components,
OX6
should
since
these
parts are very inexpensive as compared to components of greater capability. Specifically, an 8-bit processor along with an 8-bit AtoO/OtoA will yield a relatively low cost unit.
Greater capabilities utilizing 16-bit processors
and a 12 or 16 bit AtoO/OtoA could be incorporated into a second generation system.
B.
Extension of Immediate Goals The
processing
general
aim
of
this
of any natural instrument.
6
phase of
the
project
is
to
allow
The instrument thereby remains
in
the hands of the musician, but it' s function s and capabilities are modified and By
enhanced through digital signal processing and microprocessor control. combining the capabilities of a small microprocessor system along
with
basic DSP techniques, many exciting possibilities of digital processing can be utilized and applied to musical instruments.
c.
Terms of Phase 1 As is true with most projects of this nature,
have not been solved.
However,
all of the problems
a significant amount of preliminary
has already been completed in the direction of a marketable product.
work These
present accomplishments include one possibility of digital audio processing (in the form of a working prototype), and
audio
as well as microprocessor,
digital,
building blocks which have been designed and implemented
in
a
modular set of circuit boards (See Appendix III). Of
course,
non-disclosure agreement s will be signed at the
start,
and all work done under this proposal will be of strict proprietary nature, belonging
Included in this agreement,
solely to PEAVEY.
all work up
to
present could conceivably be turned over to PEAVEY.
IV.
PHASE 2 AND BEYOND A.
General The
and
Long-range
general purpose of this research will be to develop new ideas
principals
related to digital audio,
instrument control, of
synthesis,
primary importance,
music
system.
Goals
The
specifically aimed
and analysis.
at
musical
The human interface will be
unlike that of a stand-alone programmable computer
musician
will
not
be
replaced
by
developments, rather, his capabilities will only be expanded. 7
any
of
these
The primary areas of development will be: 1)
Digital Sampling snd Processing - applications include
effects,
harmony accompaniment,
and sampling percussion
digital
synthesis.
This
is an extension of Phase I. Digital Sampling and Analysis - This area of work involves
2)
analysis
along
with
parameterization.
frequency
Applications
and
envelope
include tuners,
FFT
extraction
and
pitch analyzers and
some
forms of audio synthesis. Microprocessor
3)
Control and Switching of Realtime
This
work examines the human to microprocessor interface for
such
as
syncronization,
parameters
and
triggering,
processes
and switching.
by methods convenient
to
Processes applications
Control the
of
audio
musician,
i.e.
footswitch arrays, keypad arrays, and signals directly from the instrument. A certain amount of this is also incorporated in Phase I.
More On Digital Sampling and AnalysiS
B.
Analysis
based
on
the seperation and
parameterization
of
the
frequency and envelope components of the musical instrument signal can lead to
new
processing
Assume
possibilities.
that
the
input
signal
is
represented by the following: N
set)
E(t)F(t) n n
a
(10)
n-O where
E (t) n
is the envelope snd
the form: 8
F (t) is purely a sum of frequencies n
of
M
b
F (t) =
m
n
sin(mw t)
(11)
n
m=O E
n
and F
could be digitized data stored in memory tables.
n
Al ternstively,
this functions could be reduced to s set of parameters which could then used
by hardware equivalents of the ADSR and VCO.
The pluck of a
be
string
for example could be represented in an approximate form by:
... where
Ae
-at
function These
and
sin(wt)
is
(12)
EO(t) is a
etc.
(square or triangular single pulse to model the initisl
parameters
minimized
can
be
used for control and
synthesis
parameteric description of the input
separating
the
independently,
and
frequency
and
recombining,
envelope many
signal.
by
pulse
attack). using
the
Furthermore,
portions,
processing
by them
new and interesting functions
and
effects can be created.
C.
Other Applications
•
An FFT Tuner and Bridge Adjustment Meter - Realtime FFT
could
be
applied
instruments secondary
over function
specifically
to
the design of a
low-cost
the entire musical instrument of
the
microprocessor
tuner, range.
based
designed to adjust the guitar bridge,
FFT
analysis
compatible
with
In
addition,
a
tuner
could
be
an application that is
in great need of fullfilling. • standard
A Programmable
Sampling Percussion
percussion system control software, 9
System
- By
incorporating
DSP can be used to turn
any
instrument into an electronic percussion system by sampling and storing the input
signal.
Using
this digitizied data,
along with
percusive envelope functions,
the
appropriate
processing
algorithms,
and rhythm
editing
utilities,
a very sophisticated yet low-cost percusion processor could
be
implemented with a microprocessor based system.
D.
Far-Reaching Applications Real-time
directly
from
applications. almost
control and processing based on FFT analysis of signals
the
instrument
Every
could
lead
to
a
limitless
number
note could be defined to act as a switch to
any other audio process.
of
trigger
Any instrument could be transformed into
any other instrument through realtime DSP techniques.
V.
AVAILABLE RESOURCES My background and experience includes the following: •
Experienced in working with instruments and equipment.
musicians
•
Strong background in math, physics and engineering.
•
Familiarity with microprocessor software as well as hardware.
•
Experienced in the procedures involving a project of secret proprietary nature (held a Secret Clearance from 1983-1987).
•
Experience working with engineers electronics and computer industries.
and
and
users
programmers
of
in
musical
or the
Also of great benefit is the instant access to an excellent science and engineering library at the University .
10
APPENDICES
APPENDIX I Sampling Rates of Other 6809 Algorithms PROCESS R1 WITH MEMORY BANK SWITCHING: time (microseconds) L1
LDX
IIBuf adr
3
L2
LDA STA
III Membank
2
LDA NOP STA CMPX BRA BRA
,X DAC liN L3 L4
5 4 3 3
LDA STA
112 Membank
5
LDA STA CMPX BHI BRA
,X+ DAC liN L1 L2
6 5 4 3 3
L3 L4
L5
5
4 2
2
(pe r sample) 28 With
N
64k and
ts
28 microseconds,
the maximum delay time
seconds per 64k bank (3.6 seconds for two banks; course
(f/2
is
1.8
7.2 for four banks).
Of
the sample rate can be slowed through software control to
the record/playback time at the sacrifice of frequency response.
12
17.9 kHz)
increase
PROCESS
(Doubling Delay Effect)
WI RI + Wo RI
time
(microseconds)
LDY
I/Bufadr
4
Ll
LDU BRA
I/Bufadr L3
4 3
L2
LDY BRA
IIBufadr L3
4 3
L3
LDA STA LDA STA NOP
,U+ DAC ADC ,Y
6 5 5 4 2
CMPU BHI NOP NOP BRA
lIN LI L4
5 3 2 2 3
LDA STA LDA STA
,U+ DAC ADC ,Y+
6 5 5 6
CMPY BHI NOP NOP BRA
ItN L2
5 3 2 2 3
L4
L3
(per sample) 37 With
N
64k and
t
B
= 37
microseconds,
seconds.
13
(f/2 = 13.5 kHz)
the maximum delay time
is
2.4
APPENDIX II User Instructions for DX6 Sampling System The DX6 is a combination audio recorder (8 to 20 seconds typical) and delay (milliseconds to seconds). for
a low octative instrument.
jack
It was designed specifically
The instrument is plugged into the
INPUT
and the OUTPUT connects to any standard musical instrument amplifier.
Note that two outputs are available for stereo effect. The rift
purpose of the effects unit is for recording
(up to several measures),
playing
a
conversion DX6
primary
counterpoint
or
a
short
and then playing this rift back while also
harmony part.
Since the
internal
is relatively slow as compared to standard digital
A to
delays
is limited to lower octave instruments such as bass guitar.
the
However,
the slow conversion has the benefit of allowing relatively long record delay
times
(up to 20 seconds or so) yet utilizing an
D
inexpensive
and 8-bit
microprocessor architecture. The record
main difficulty in using the system is learning to trigger
and
accomplished
playback
functions in exact time with
the
music.
the
This
is
easiest by using a quick tapping movement with the toe of the
foot, much like one would tap the trigger pad of a computer drummer . INITIAL CHECKOUT Plug DC adaptor into back of the DX6 unit where indicated. Foot
Switch module with supplied cable.
cable into place. should supplied
Switch power on.
on (red = SV,
be by
a
yel = 9V,
For best
results,
screw
All three LEDs on front panel grn
=
-9V).
battery in bottom section of
14
Plug in
unit
The -9 volts which
must
is be
changed LEDs
approximately every 100 hours of operation.
on
Foot
Switch
module should be blinking
The 5
very
status
rapidly
sequence (the blinking rate is proportional to sample rate).
in
If any
of these conditions are not true, check unit for shipping damage.
Switch
off
panel.
power.
Plug
Plug in headphones where
indicated
in guitar (or keyboard) into input.
on
front
The two
output
sockets go to the inputs of amplifier one and two.
However, this is
not
power
necessary
instrument
for testing at this time.
should
Volume control A adjusts
The LED status should now show
only
The digitized signal from the DX6
unit
right)
on foot switch panel.
Now,
should now be heard in the headphones along with the direct The
volumes
of
the
independently adjusted. will
bypass
signal.
sampling
for
from
of direct input signal.
right ones on.
The
press switch B (second
level
three
on.
be heard through the headphones (both sides
MIXED mode or one side for UNMIXED mode).
the
Switch
direct
and
digitized
portions
signal. can
be
Pressing switch E (all the way to the left) of the input and kill that
portion
of
the
Refer to Function Flow Chart for details.
OPERATING MODE 1 Assuming
unit is initialized to starting point (LEDs on foot switch
blinking in sequence indicating FUNCTION mode), press switch B which takes it to ECHO mode. of three commands: was on).
recorded). The
record
The digitized signal is now waiting for one
RECORD, PLAY, or PLAY2 (plays twice the speed it Pressing A starts RECORD mode (note green time
is approximately 7 seconds
15
(this
LED
is
can
be
adjusted
and will be discussed later).
automatically up
saves
goes back to ECHO.
the
recorded signal.
Pressing C
indefinitely.
portion
at twice the recorded speed
and
PLAY2
can
appropriate switch. switch
(E)
be
D (PLAY2)
entered
During RECORD,
restarts
record/play track.
Pressing
long,
it
Pressing ECHO (B) before time is
portion
PLAY,
If you wait too
(PLAY)
repeats
repeats
indefinitely. at any PLAY,
time
the
recorded
ECHO,
RECORD,
by
pressing
and PLAY2,
the current mode from the
that
the
the
RESYNC
beginning
of
the
Pressing switch E while in the ECHO mode returns
the system to FUNCTION mode. OPERATING MODE 2 While
in FUNCTION mode,
causes this
s ystem mode
press switch D (second from
to enter the DELAY mode.
is press MARK (A),
relates t o the
syncronized drummer, press
then count to 4 (or
This way,
press
E
From here,
signal can be delayed in one of three ways by pressing 2f,
and
f
C,
modes, press
Now,
press
the digitized A,
B, or C.
D, retu;rning the system to
DELAY where a new time interval can be set with MARK and SET. very important to study the Function Flow Chart and experiment 16
then
Repeating the scaling operation reduces
thus entering the SELCT mode.
To exit f/2,
electric
or D for dividing by 3
the time interval to a very small delay if so desired. Switch
which
Press SET (B) at
metronome,
To rescale the delay,
B for dividing time interval by 2,
(A takes you to EXIT mode.)
anything
in
the delay can be very accurately
with other instruments (such as a
or a live band).
This
The first thing to do
timing of the delay desired).
the end of this count.
left).
It is with
the
DX6 system in order to thoroughly understand the operation
and
characteristics of the DELAY and the RECORD/PLAY modes. OPERATING MODE 3 Pressing
switch
A from the FUNCTION mode enters the OPTIONS mode.
There are three choices. By pressing
VOLUME CHECK:
A)
D from the OPTIONS
system will enter the volume check mode.
mode,
the
Here, all LEDs go out.
If a signal is sampled that overdrives the A to D, all LEDs go on sampling stops.
and
the case.
You must RESET by pressing
is
The ideal adjustment is to have only the very loudest
notes slightly overdrive the A to D. level
A if this
This can be adjusted by the
of the signal from the instrument,
or R29 of the A to
D
board. B) mode
REVERSE:
Pressing
B from the OPTIONS mode enters the
ECHO
where now everything that is played back will be backwards.
Otherwise, all modes are the same as before (RECORD, PLAY, PLAY2, and ECHO).
Pressing
E from ECHO mode returns to FUNCTION mode
and cancels the REVERSE option. C)
DOUBLE BUFFER:
Pressing
E
from the OPTIONS mode enters the
Double buffer mode where two record and playback tracks are used. Pressing PLAY
are
previous
B goes to ECHO where the playback tracks for PLAY2 and separate. playback
The mode.
wipes out the PLAY track, PLAY mode.
17
current RECORD track is
set
NOTE that recording the
PLAY2
so that PLAY2 must be recorded
by
the track
before
SAMPLE RATE ADJUSTMENT To adjust the sample rate, enter the FUNCTION mode. (E and D), and D).
E, then
then some combination of (A and B and C) while still holding (E The rate of the blinking LEDs will indicate the relative sampling
rate beinbg selected. D,
Now hold down
the release
A,
To store this new sample rate, B,
should now be stored.
and/or
C.
Finally release
first release E.
only
The new sampling
The following shows the approximate sample rates and
maximum frequencies that can be sampled by chosing the (A B C) switches:
ABC
---
o
1 1 1 00 1 0 1 110 111
Sample Time (msec)
Total Record Time (sec)
Max Freq (kHz) (1/2T)
7
4.0 3.0 2.0 1.3 0.7
0.125 0.165 0.245 0.400 0.720
9
13.5 22 40
Values of ABC less than 0 1 1 are valid but the change in sample rate is slight. FUNCTION FLOW CHART
R..,~
LiFun~t'onl
Li
~hol
Li!!!!J
0
0 18
0
0
0
APPENDIX III PRO TYPE CIRCUIT BOARD SET 6809 CPU Board
~C6\::l ()+
C3C1
R1
0 OR2 ~R3
~
I. =
U1
U4
'8
I EJ:C8 r:l. tl9
CS·i;.R5,...,R7=----------I
~OOO ~ L1
'~
.------, OI. I
Cl
U LJ
R6
Vee
dC4
U3
U2
'~
;::»Gnd
OClO
19
'~
•
•
Memory Expansion Board
Gnd
c:
U4
VO
U2
R100Cl 0
•
•
OC.
OC3
• U1
20
OC7 •
us
c:: vee
Oc' OCB
Oes •
•
L1
u.
'8 '8
Analog to Digital/Digital to Analog Board
vee~: vV of~ r~I'!II' . 1 00
V
db
:l
13
~~
J202B
..
•
Q . ~ •
S:..J.9
t
~~ ~rIJ: ~ iJ~J
FL
21
1985
Digital Input/Output Controller Board
Jl078
1/0 Port
22