Conference PaperPDF Available

Designing Synthetic Reverberators in Kronos

Authors:

Abstract

Kronos is a special purpose programming language in-tended for musical signal processing tasks. The central aim is to provide an approachable development environ-ment that produces industrial grade signal processors. The system is demonstrated here in the context of de-signing and building synthetic reverberation algorithms. The classic Schroeder-Moorer algorithm is presented, as well as a feedback delay network, built with the abstrac-tion tools afforded by the language. The resulting signal processors are evaluated both subjectively and in raw per-formance terms.
DESIGNING SYNTHETIC REVERBERATORS IN KRONOS
Vesa Norilo
Sibelius Academy
Centre for Music & Technology, Helsinki, Finland
vnorilo@siba.fi
ABSTRACT
Kronos is a special purpose programming language in-
tended for musical signal processing tasks. The central
aim is to provide an approachable development environ-
ment that produces industrial grade signal processors.
The system is demonstrated here in the context of de-
signing and building synthetic reverberation algorithms.
The classic Schroeder-Moorer algorithm is presented, as
well as a feedback delay network, built with the abstrac-
tion tools afforded by the language. The resulting signal
processors are evaluated both subjectively and in raw per-
formance terms.
1. INTRODUCTION
The Kronos package consists of a language specification
as well as an optimizing compiler. The compiler can be
paired with several back ends. Currently the main focus is
on a just in time compiler for the x86 architecture, while
a C-language generator is also planned.
Syntactically Kronos is inspired by high level func-
tional languages[1]. The syntax of functional languages
is ideally suited for visualization; this match is demon-
strated by another source of inspiration, Faust[6]. Even-
tually, Kronos aims to combine the ease of use and ap-
proachability of graphical environments like Pure Data[7]
and PWGL[3] with the abstraction and rigour typical of
functional programming languages.
Kronos programs are generic, meaning that signal pro-
cessing blocks can be written once and used in any num-
ber of type configurations. For example, a digital filter
could be designed without specifying single or double pre-
cision sample resolution or even if the data is numerically
real or complex, monophonic or multichannel. The type
system used in Kronos is more thoroughly discussed in[5].
When a Kronos patch is connected to a typed source,
like an audio input, the patch is specialized. The generic
algorithm description is type inferred[ref]. Following this,
the execution is deterministic, which faciliates drastic com-
piler optimization[ref]. The system could be summarized
as a type-driven code generator that produces highly op-
timized, statically typed code from high level, functional
source code.
The rest of this paper is organized as follows. Sec-
tion 2, Implementing a Reverberator, discusses the imple-
mentation of various primitives and algorithms in Kronos.
Section 3, Tuning, discusses additions and enhancements
to the basic algorithms. The results are evaluated in Sec-
tion 4, Evaluation, before the paper’s Conclusion, Section
5.
2. IMPLEMENTING A REVERBERATOR
Reverberation is a good example case, as the algorithms
are straightforward yet complicated enough to stress the
development environment and provide opportunities for
utilization of several language features. They are also well
suited for performance benchmarks.
2.1. Primitives for Reverberation
The example cases start with the primitives that are essen-
tial to synthetic reverberation. Delay lines, comb filters,
and allpass filters will be examined.
2.1.1. Delay
While the functional programming paradigm intuitively
matches the signal flow graph widely used for describing
signal processing algorithms, there is an apparent clash.
Functional programs do not support program state, or mem-
ory, a fundamental part of any processor with delay or
feedback.
The solution to this problem offered by Kronos is a
integrated delay operator. Called rbuf, short for a ring
buffer, the operator receives three parameters: an initial-
izer function, allowing the user to specify the contents of
the ring buffer at the start of processing, the size of the
buffer or delay time and finally the signal input. In Listing
1, a simple delay function is presented. This delay line is
10 samples long and is initialized to zero at the beginning.
Listing 1. Simple delay
Delay ( s i g )
{
Delay = r b u f ( ’ 0 #10 s i g )
}
2.1.2. Comb filter
A delay line variant with internal feedback, a comb filter,
is also widely used in reverberation algorithms. For this
configuration, we must define a recursive connection. The
rbuf operator allows signal recursion. As in all digital
systems, some delay is required for the recursion to be
finitely computable. A delay line with feedback is shown
in Listing 2. In this example, the symbol output is used as
the recursion point.
Listing 2. Delay with feedback
Delay ( s i g f b d el a y )
{
d e l a y e d = r b u f ( ’ 0 d e l a y s i g + f b d e l a y e d )
Delay = d e l a y e d
}
2.1.3. Allpass-Comb
An allpass comb filter is a specially tuned comb filter that
has a flat frequency response. An example implementa-
tion is shown in Listing 3, similar to the one described by
Schroeder[8].
Listing 3. Allpass Comb filter
A l l p a s s Comb( s i g f b d e l a y )
{
d e l a y e d = r b u f ( ’ 0 d e l a y s i g f b d e l a y e d )
A l l p a s s Comb = 0 . 5 ( s i g + d e l a y e d + f b d e l a y e d )
}
2.2. Multi-tap delay
As a precursor to more sophisticated reverberation algo-
rithms, multi-tap delay offers a good showcase for the
power of generic programming.
Listing 4. Multi-tap delay
Mu l t i Tap ( s i g d e l a y s )
{
Use A l g o r i t h m
Mu l t i Tap = Red uce ( Add Map ( Cur r y ( Delay s i g ) d e l a y s ) )
}
The processor described in Listing 4 can specialize to
feature any number of delay lines. The well known higher
order functions Map and Reduce define the functional lan-
guage equivalent to a loop[1]. Map applies a caller sup-
plied mapping function to all elements of a list. Reduce
combines the elements of a list using caller-supplied re-
duction function.
In this example, another higher order function, Curry,
is used to construct a new mapping function. Curry re-
duces the two argument Delay function into an unary func-
tion that always receives sig as the first argument. Curry
is an elementary operator in combinatory logic.
This curried delay is then used as a mapping function
to the list of delay line lengths, resulting in a bank of de-
lay lines, all of them being fed by the same signal source.
The outputs of the delay lines are finally summed, using
Reduce(Add ...). The remarkably short yet highly useful
routine is a good example of the power of functional ab-
straction in Kronos.
A reader familiar with developing real time signal pro-
cessing code might well be worried that such high level
abstraction will adversely affect the performance of the
resulting processor. Fortunately this is not the case, as
the language is designed around constraints that allow the
compiler to simplify all the complexity extremely well.
Detailed performance results are shown in Section 4.
2.3. Schroeder Reverberator
Expanding upon the concepts introduced in Section 2.2,
the classic diffuse field reverberator described by Schroeder
can be implemented. Listing 5 implements the classic
Schroeder reverberation[8]. Please refer to Section 4.1 for
sound examples.
Listing 5. Classic Schroeder Reverberator
Feedb a c k f o r RT60 ( r t 6 0 d e l a y )
{
Feedb a c k f o r RT60 = Cr t : pow ( # 0 . 0 0 1 d e l a y / r t 6 0 )
}
B a s i c ( s i g r t 6 0 )
{
Use A l g o r i t h m
a l l p a s s p a r a m s = ( ( 0 . 7 # 2 21) ( 0 . 7 # 7 5) )
d e l a y t i m e s = ( # 1 310 #16 36 #1813 # 192 7 )
f e e d b a c k s = Map (
Cu r r y ( Feedbackf o r RT60 r t 6 0 )
d e l a y t i m e s )
comb s e c t i o n = Red uce ( Add
Zi pWith (
Cu r r y ( De l a y s i g )
f e e d b a c k s
d e l a y t i m e s ) )
B a s i c = C asc a d e ( A l l p a s s Comb comb s e c t i o n a l l p a s s
params )
}
All the tuning parameters are adapted from Schroeder’s
paper[8]. The allpass parameters are constant regardless
of reverberation time, while comb filter feedbacks are cal-
culated according to the specified reverberation time. The
comb section is produced similarily to the multi tap delay
in Section 2.2. Since the delay function requires an ex-
tra feedback parameter, we utilize the Zip-With function,
which is similar to Map, but expects a binary function and
two argument lists. The combination of Curry and Zip-
With generates a bank of comb filters, all fed by the same
signal, but separately configured by the lists of feedback
coefficients and delay times.
The series of allpass filters is realized by the higher or-
der Cascade function. This function accepts a parameter
cascading function, Allpass-Comb, signal input, sig, and
a list of parameters, allpass-params. The signal input is
passed to the cascading function along with the first ele-
ment of the parameter list. The function iterates through
the remaining parameters in allpass-params, passing the
output of the previous cascading function along with the
parameter element to each subsequent cascading function.
Perhaps more easily grasped than explained, this has the
effect of connecting several elements in series.
While the same effect could be produced with two
nested calls to Allpass-Comb, this formulation allows tun-
ing the allpass section by changing, inserting or removing
parameters from the allpass-params list, with no further
code changes, regardless of how many allpass filters are
specified.
2.4. Feedback Delay Network Reverberator
Feedback delay network is a more advanced diffuse field
simulator, with the beneficial property of reflection den-
sity increasing as a function of time, similar to actual acous-
tic spaces. The central element of a FDN algorithm is the
orthogonal feedback matrix, required for discovering the
lossless feedback case and understanding the stability cri-
teria of the network. For a detailed discussion of the the-
ory, the reader is referred to literature[2]f.
Listing 6. Basic Feedback Delay Network reverberator
Use A l g o r i t h m
Feedb a c k Mtx ( i n p u t )
{
Feedb a c k Mtx = i n p u t
( even odd ) = S p l i t ( i n p u t )
evenmtx = Recur ( even )
oddmtx = R e c u r ( odd )
Feedb a c k Mtx = Append ( ZipWith ( Add evenmtx oddmtx )
Zi pWith ( Sub e ven mtx oddmtx ) )
}
B a s i c ( s i g r t 6 0 )
{
d e l a y t i m e s = ( # 1 310 #16 36 #1813 # 192 7 )
n o r m a l i z e c o e f = 1. / S q r t ( Co unt ( del a y t i m e s ) )
l o s s c o e f s = Map ( Cur r y ( Mul n o r m a l i z e c o e f )
Map( Cu r r y ( Fe edbackf o r RT60 r t 6 0 ) d e l a y
t i m e s ) )
f e e d b ac k v e c t o r = z 1( ’( 0 0 0 0 ) ZipWith ( Mul l o s s
c o e f s Fee d b ackMtx ( d e l a y v e c t o r ) ) )
d e l a y v e c t o r = ZipWith ( De l a y Map( C u r r y ( Add s i g )
f e e d b ac k v e c t o r ) d e l a y t i m e s )
B a s i c = Red uce ( Add Re s t ( d e l a y v e c t o r ) )
}
In Listing 6, functional recursion is utilized to gener-
ate a highly optimized orthogonal feedback matrix, the
Householder feedback matrix. The function Feedback-
Mtx recursively calls itself, splitting the signal vector in
two, computing element-wise sums and differences. This
results in an optimal number of operations required to
compute the Householder matrix multiplication[9].
Note that Feedback-Mtx has two return values; one of
them simply returning the argument input. This is a case
of parametric polymorphism[5], where the second, spe-
cialized form is used for arguments that can be split in
two.
The feedback paths in this example are outside the
bank of four delay lines. Instead, a simple unit delay re-
cursion is used to pass the four-channel output of the delay
lines through the feedback matrix and back into the delay
line inputs. Because all the delay lines are fed back into
all the others, the feedback must be handled externally.
The final output is produced by summing the outputs
of all the delay lines except the first one, hence Rest(delay-
vector). The first delay line is skipped due to very promi-
nent modes resulting from the characteristics of the House-
holder feedback.
3. TUNING
The implementations in Section 2 do not sound very im-
pressive; they are written for clarity. Further tuning and
a greater number of delay lines are required for a modern
reverberator. The basic principles of tuning these two al-
gorithms are presented in the following Sections 3.1 and
3.2. The full code and sound examples can be accessed on
the related web page[4].
3.1. Tuning the Schroeder-Moorer Reverberator
A multichannel reverberator can be created by combin-
ing several monophonic elements in parallel with slightly
different tuning parameters. Care must be taken to main-
tain channel balance, as precedence effect may cause the
reverberation to be off-balance if the delays on one side
are clearly shorter. Reflection density can be improved by
increasing the number of comb filters and allpass filters
while maintaining the basic parallel-serial composition.
Frequency-dependant decay can be modeled by utilizing
loss filters on the comb filter feedback path, and overrall
reverberation tone can be altered by filtering and equaliza-
tion.
The tuned example[4] built for this paper features 16
comb filters and 4 allpass filters for both left and right
audio channel. Onepole lowpass filters are applied to the
comb filter feedback paths and further to statically adjust
the tonal color of reverberation.
3.2. Tuning the Feedback Delay Network Reverbera-
tor
Likewise, the number of delay lines connected in the feed-
back network can be increased. Frequency dependent de-
cay is modelled similarily to the Schroeder-Moorer rever-
berator. Since a single network produces one decorrelated
output channel for each delay line in the network, multi-
channel sound can be derived by constructing several dif-
ferent sums from the network outputs. Allpass filters can
be used to further increase sound diffusion.
The tuned example[4] features 16 delay lines connected
in a Householder feedback matrix. Each delay line has a
lowpass damping filter as well as an allpass filter in the
feedback path to improve the overrall sound. A static tone
adjustment is performed on the input side of the delay net-
work.
4. EVALUATION
Firstly, the results of implementing synthetic reverbera-
tors in Kronos is evaluated. Evaluation is attempted ac-
cording to three criteria; how good the resulting rever-
berator sounds, how well suited was the Kronos language
to program it and finally, the real time CPU performance
characteristics of the resulting processor. The following
abbreviations, in Table 1 are used to refer to the various
processors described in this paper.
Key Explanation
S4 Classic Schroeder reverberator, Section 2.3
S16 Tuned Schroeder reverberator [4]
FDN4 4-dimensional Feedback Delay Network, Section 2.4
FDN16 16-dimensional tuned FDN [4]
Table 1. Keys used for the processors
4.1. Sound
Sound quality is highly subjective measure; therefore, the
reader is referred to the actual sound examples[ref]. Some
observations by the author are listed here.
Unsuprisingly, S4 is showing its age; the reverberation
is rather sparse and exhibits periodicity. The modes of the
four comb filters are also spread out enough that they are
perceptible as resonances. However, the sound remains
respectable for the computational resources it consumes.
FDN4 is also clearly not sufficient by itself. The dif-
fuse tail is quite an improvement over s-cl, although some
periodicity is still perceived. The main problem is the lack
of diffusion in the early tail. This is audible as a sound
resembling flutter echo in the very beginning of the rever-
beration.
S16 and FDN16 both sound quite satisfying with the
added diffusion, mode density and frequency dependant
decay. FDN16 is preferred by the author, as the mid-tail
evolution of the diffuse field sounds more convincing and
realistic, probably due to the increasing reflection density.
4.2. Language
It is our contention that all reverberation algorithms can be
clearly and concisely represented by Kronos. Abstraction
is used to avoid manual repetition such as creating all the
delay lines one by one. The delay operator inherent in the
language allows the use of higher order functions to create
banks and arrays of delay lines and filters. In the case of
the feedback delay network, a highly effective recursive
definition of the Householder feedback matrix could be
used.
4.3. Performance
The code produced by Kronos exhibits excellent perfor-
mance characteristics. Some key features of the reverber-
ators are listed in Table 2, along with the time it took to
process the test audio.
A realtime CPU stress is computed by dividing the
processing time with the play time of the audio, 5833 mil-
liseconds in this test case. The processor used for the
benchmark is an Intel Core i7 running at 2.8GHz. The
CPU load caused by the algorithms presented ranges from
1.2 permil to 1.5 percent.
5. CONCLUSION
This paper presented a novel signal processing language
and implementations of synthetic reverberation algorithms
Key Delays Allpass LPFs Fmt Time CPU
S4 4 2 0 mono 6.9ms 0.12%
S16 32 8 33 stereo 89ms 1.5%
FDN4 4 0 0 mono 7.1ms 0.12%
FDN16 16 20 17 stereo 84ms 1.4%
Table 2. Features and performance of the processors
in it. The algorithms were then tuned and evaluated by
both sound quality and performance criteria.
The presented algorithms could be implemented on a
high level, utilizing abstractions of functional program-
ming. Nevertheless, the resulting audio processors exhibit
excellent performance characteristics.
Kronos is still in development into a versatile tool, to
allow real time processing as well as export to languages
such as C. Graphical user interface is forthcoming. Kro-
nos is also going to be used as the next-generation synthe-
sizer for the PWGL[3] environment. Interested parties are
invited to contact the author should they be interested in
implementing their signal processing algorithms in Kro-
nos.
6. REFERENCES
[1] P. Hudak, “Conception, evolution, and application of
functional programming languages, ACM Comput-
ing Surveys, vol. 21, no. 3, pp. 359–411, 1989.
[2] A. Jot Jean-Marc; Chaigne, “Digital Delay Networks
for Designing Artificial Reverberators, in Audio En-
gineering Society Convention 90, 1991.
[3] M. Laurson, M. Kuuskankare, and V. Norilo, “An
Overview of PWGL, a Visual Programming Environ-
ment for Music, Computer Music Journal, vol. 33,
no. 1, pp. 19–31, 2009.
[4] V. Norilo, “ICMC2011 Examples, 2011. [On-
line]. Available: http://www.vesanorilo.com/kronos/
icmc2011
[5] V. Norilo and M. Laurson, “A Method of Generic Pro-
gramming for High Performance DSP, in DAFx-10
Proceedings, Graz, Austria, 2010, pp. 65–68.
[6] Y. Orlarey, D. Fober, and S. Letz, “Syntactical and
semantical aspects of Faust, Soft Computing, vol. 8,
no. 9, pp. 623–632, 2004.
[7] M. Puckette, “Pure data: another integrated computer
music environment, in Proceedings of the 1996 In-
ternational Computer Music Conference, 1996, pp.
269–272.
[8] M. R. Schroeder, “Digital Simulation of Sound Trans-
mission in Reverberant Spaces, Journal of the Acous-
tical Society of America, vol. 45, no. 1, p. 303, 1969.
[9] J. O. Smith, “A New Approach to Digital Reverber-
ation Using Closed Waveguide Networks, 1985, pp.
47–53.
... Schroeder reverberation is a classic example of a signal-processing problem combining parallel and serial routing (Schroeder 1969). An example implementation is given in Figure 5 Further examples of advanced reverberators written in Kronos can be found in an earlier paper by the author (Norilo 2011a). ...
Article
Full-text available
Kronos is a signal-processing programming language based on the principles of semifunctional reactive systems. It is aimed at efficient signal processing at the elementary level, and built to scale towards higher-level tasks by utilizing the powerful programming paradigms of "metaprogramming" and reactive multirate systems. The Kronos language features expressive source code as well as a streamlined, efficient runtime. The programming model presented is adaptable for both sample-stream and event processing, offering a cleanly functional programming paradigm for a wide range of musical signal-processing problems, exemplified herein by a selection and discussion of code examples.
Thesis
Full-text available
Musical signal processing is an avenue of creative expression as well as a realm for commercial innovation. Composers require unheard digital instruments for creative purposes, sound engineers apply novel algorithms to further the recording arts, musicologists leverage exotic mathematics for sophisticated music information retrieval, while designers and engineers contribute exciting products to the vibrant scene of amateurs and autodidacts. Signal processor design is luthiery in the digital age. Design of signal processors by musicians is a topic that has attracted a lot of research since the seminal MUSIC III in the 1960s. The activity in this field suggests that the related questions are not satisfactorily resolved. This study presents Kronos, a programming language based on the paradigms of metaprogramming and reactive multirate systems, aimed for expressive, streamlined description of digital musical instruments and sonic transformations.
Article
Full-text available
This paper presents some key concepts for a new just in time programming language designed for high performance DSP. The language is primarily intended to implement an updated version of PWGLSynth, the synthesis extension to the vi-sual musical programming environment PWGL. However, the system is suitable for use as a backend for any DSP plat-form. A flow control mechanism based on generic program-ming, polymorphism and functional programming practices is presented, which we believe is much better suited for vi-sual programming than traditional loop constructs found in textual languages.
Article
Full-text available
This paper presents some syntactical and semantical aspects of FAUST (Functional AUdio STreams), a programming language for real-time sound processing and synthesis. The programming model of FAUST combines two approaches: functional programming and block-diagrams composition. It is based on a block-diagram algebra. It as a well defined formal semantic and can be compiled into efficient C/C++ code.
Article
Full-text available
A new software system, called Pure Data, is in the early stages of development. Its design attempts to remedy some of the deficiencies of the Max program while preserving its strengths. The most important weakness of Max is the difficulty of maintaining compound data structures of the type that might arise when analyzing and resynthesizing sounds or when recording and modifying sequences of events of many different types. Also, it has proved hard to integrate non-audio signals (video, for instance, and also audio spectra) into Max's rigid "tilde object" system. Finally, the whole issue of maintaining two separate copies of all data structures (one to edit and one to access in real time) has caused much confusion and difficulty. Pd's working prototype attempts to simplify the data structures in Max to make them more readily combined into novel user-defined data structures. Also, the relationship between the graphical process and the real-time one (which is handled in one way on the Maci...
Article
Digital computers, through their capability for accurate simulation of complex phenomena, have permitted new insights into a number of important problems arising in sound transmission in reverberant spaces: (1) Reverberation theories, based on the geometrical acoustics, are being refined by ray-tracing studies on digital computers. These studies have revealed significant discrepancies in existing reverberation-time formulas and unexpected large dependencies of the decay rate on the shape of the enclosure and the dis-tribution of sound-absorbing materials. (2) Starting with reverberation-free speech or music signals as inputs, computers can add echoes and reverberation with specified delays, spectral content, and decay characteristics. The computer produces several output signals that--when radiated from loudspeakers in an anechoic chamber--produce, at a listener's ears, sound-pressure waves resembling those in real halls. To ensure "externalization" and proper directions of echo arrivals, the computer program is based on the measured sound diffraction around the listener's head. This digital simulation method is useful to "preaudit" architectural designs before construction and to investigate subjective correlates of a wide variety of re-verberation processes. (3) Digital computers have made possible the simulation of frequency and space response of stationary sound fields and the calculation of their statistical properties. These properties are important for the design of electroacoustic systems and the evaluation of measurements in reverberant enclosures.
Article
The foundations of functional programming languages are examined from both historical and technical perspectives. Their evolution is traced through several critical periods: early work on lambda calculus and combinatory calculus, Lisp, Iswim, FP, ML, and modern functional languages such as Miranda1 and Haskell. The fundamental premises on which the functional programming methodology stands are critically analyzed with respect to philosophical, theoretical, and pragmatic concerns. Particular attention is paid to the main features that characterize modern functional languages: higher-order functions, lazy evaluation, equations and pattern matching, strong static typing and type inference, and data abstraction. In addition, current research areas—such as parallelism, nondeterminism, input/output, and state-oriented computations—are examined with the goal of predicting the future development and application of functional languages.
Article
The PatchWork Graphical Language (PWGL) is a visual programming that is a free Lisp-based cross-platform which can be used for computer-aided composition, music analysis, and sound synthesis. PWGL is a programmed ANSI Common Lisp that is compatible to source-code across several different operating systems that includes Macintosh OS X, Microsoft Windows, and Linux. PWGL has the ability to integrate several programming paradigms which include functional, object-oriented, and constrained-based one with high-level visual representation of data while also having the capability of solving a wide range of musical problems. A comparison between PWGL and two other Lisp-based composition environments has been made while the text-based and visual programming in general have also been compared to determine how PWGL is positioned within these categories. The main visual components of the system is then presented while the primary principles which allow users to manipulate a visual patch while the programming interface allows the extension of the system with user libraries, boxes, and menus. Finally, a short survey of the PWGL Tutorial concept has been given that can be used for demonstrations, pedagogical purposes and even for private study.
A Method of Generic Programming for High Performance DSP
  • V Norilo
  • M Laurson
V. Norilo and M. Laurson, "A Method of Generic Programming for High Performance DSP," in DAFx-10 Proceedings, Graz, Austria, 2010, pp. 65-68.