Transcript
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound Thomas De Cnudde
Promotoren: prof. dr. ir. Jean-Pierre Martens, dhr. Hubert Kaeslin Masterproef ingediend tot het behalen van de academische graad van Master in de ingenieurswetenschappen: elektrotechniek
Vakgroep Elektronica en Informatiesystemen Voorzitter: prof. dr. ir. Jan Van Campenhout Faculteit Ingenieurswetenschappen en Architectuur Academiejaar 2012-2013
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound Thomas De Cnudde
Promotoren: prof. dr. ir. Jean-Pierre Martens, dhr. Hubert Kaeslin Masterproef ingediend tot het behalen van de academische graad van Master in de ingenieurswetenschappen: elektrotechniek
Vakgroep Elektronica en Informatiesystemen Voorzitter: prof. dr. ir. Jan Van Campenhout Faculteit Ingenieurswetenschappen en Architectuur Academiejaar 2012-2013
Acknowledgements
I wish to offer my special thanks to my advisor and co-advisor, Dr. Norbert Felber and Michael Schaffner, for their patience and useful advice. I am very grateful for the subject of this thesis. The practical DSP knowledge and research insights in the field of virtual analog have been of great value for me. Furthermore, the openness of the KVR Audio community members has been greatly appreciated. Their experience and insights in audio algorithms have been a good guidance.
Finally, I wish to thank Professor Dr. Ir. Roel Baets and Ann Vanoutryve for making this erasmus exchange year possible.
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound Thomas DE CNUDDE
Faculteit Ingenieurswetenschappen en Architectuur Universiteit Gent Vakgroep Elektronica en Informatiesystemen Voorzitter: prof. dr. ir. JAN VAN CAMPENHOUT Promotoren: prof. dr. ir. JEAN-PIERRE MARTENS, dhr. HUBERT KAESLIN Masterproef ingediend tot het behalen van de academische graad van Master in de ingenieurswetenschappen: elektrotechniek Academiejaar 2012-2013
Trefwoorden Virtual analog, audio signal processing, anti-aliasing, digital signal processor, moog, hammond
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound Thomas De Cnudde Supervisor(s): Norbert Felber, Michael Schaffner
Abstract- This article describes the implementation of two synthesizer models on a Digital Signal Processor. The main design choices, the implementation and the main results are discussed. Keywords- Virtual analog, audio signal processing, antialiasing, digital signal processor, moog, hammond
I. INTRODUCTION Virtual Analog (VA) tries to recreate the behavior of analog instruments in the digital domain. Two analog instruments, the Minimoog from Moog Music and the Hammond B-3 Tone wheel organ have been implemented in assembly using a Analog Devices ADSP21369 SHARC Digital Signal Processor (DSP). For the minimoog, two approaches were considered. One is based on a student Application Specific Integrated Circuit (ASIC) Synth on Chip system which is controlled by the DSP, the other is based on the DSP itself. In this article, the two models are converted to the digital domain and algorithms for this purpose are described. Aliasing is considered for the generation of the sound . Virtual analog algorithms are then applied to modify the waveforms to get a closer copy of the analog ones. For the Hammond organ, polyphony is the main concern. Imperfections of the original design are also discussed and ways to mimic that behavior are proposed. II.
DESIGN OF THE SYNTHESIZER ENGINES
A.Overview of the minimoog The sound sources of this subtractive synthesizer are built from sawtooth, triangle and pulse waveforms. A white and pink noise add additional sonic possibilities. These waveforms go to a 4-pole ladder filter after passing through a mixer. A voltage controlled filter (VCF) can vary the filter cutoff frequency over time. Before the sound gets output, it passes through a Voltage Controlled Amplifier (VCA) which changes the volume over time. Furthermore, extra possibilities including glide, pitch modulation and cutoff frequency modulation are present. B.Overview of the Hammond B-3 This instrument creates it’s sound by mixing sine wave harmonics, essentially creating an additive synthesizer. The sine waves are created by 91 tone wheels, which gives the instrument full five octave polyphony. Different intensities of chorus and vibrato can be added to the signal path to add interest to the sound. A percussion switch adds a greater or
lesser amount of the either the second or third harmonic to the attack of the sound. Keyclick, an imperfection arising from the closing of key contact, is added at the attack of each note. Another design imperfection, tone wheel leakage, originates from magnetic leakage by adjacent tone wheel pickups. A Leslie rotary speaker is added to create extra depth in the sound. Rotation happens in either a fast or slow mode. III.
MINIMOOG IMPLEMENTATION
A. Oscillators Several oscillator algorithms were considered. The best two sounding ones were evaluated with respect to computational efficiency. For the sawtooth waves, a fourth order Differentiated Polynomial Waveform (DPW) is used. The pulse waves are derived from the saw by subtracting two phase shifted version. As the triangle wave has a higher rolloff than the square wave (1/f2 instead of 1/f), only a first order DPW algorithm is used. Continuous white noise is achieved by interpreting the first eight bits of a 16-bit Linear Feedback Shift Register (LFSR) as a binary number. A filter is applied to get pink noise. B. Filter The filter implemented is a nonlinear 4-pole lowpass filter with feedback as described in [2]. The conversion from a analog 1-pole filter section to the digital is done using a bilinear transform. Four of these are then chained together and feedback is applied. A cutoff frequency warping is necessary to match the analog value to the digital one. C. Other Functions The right routing is set up and the extra features are programmed and added including: Envelope generators (EG), gate behavior, Musical Instrument Digital Interface (MIDI) functionality, User Interface (UI) through a Liquid Crystal Display (LCD), glide and modulation. D.ASIC Version For the ASIC version, the DSP is set up as a controller. Functions to send configurations to the chip are implemented. The noise is implemented on the DSP in the same way as the other version. All other sound is generated on the Integrated Circuits (IC).
IV.
HAMMOND IMPLEMENTATION
A. Tone Wheels The tone wheels are approximated by a 3rd order sine wave generated from Matlab’s polyfit function. To achieve fill five octave polyphony, an audio interrupt routine has to generate up to 91 sine wave samples. Using this approximation eases on the computational cost. Different approaches towards optimizing the sound generation part of the audio interrupt have been tried. Single Instruction Multiple Data (SIMD), multiple instructions per clock cycle and the Super Harvard Architecture have been used to achieve of a certain amount polyphony. The key for increasing the polyphony is to apply all these features while considering the relation of two adjacent octaves. B. Effects Chorus and vibrato are implemented as in [3]. Tone wheel leakage is achieved by adding a small amount of white noise to the output. To implement keyclick, [4] proposed the addition of an extra sine wave to the output. A proposed way is to achieve this effect by starting the amplitude envelope from a different value than zero, creating a short transient audio click. The Leslie speaker is implemented as in [4]. C. Other functions The MIDI driver is set up, the UI is programmed and the different modes of percussion are implemented. V.
EVALUATION
A. Minimoog The minimoog models are evaluated against a commercial emulation [5]. The waveforms are checked to evaluate the post-filtering. Aliasing is graphed and a comparison is made. The quality of the sound from the ASIC and the DSP are finally evaluated by listening. B. Hammond The Hammond model is evaluated by the amount of polyphony achieved. The two implementations of key click are compared by listening. The chorus, vibrato, tone wheel leakage and Leslie speaker are checked for the right sonic behavior. VI. RESULTS The result is a working prototype that can be played through MIDI using an external keyboard or sequencer. A. Minimoog The minimoog oscillators sounded better on the DSP version than on the asic version. The achievable frequency range on the DSP is also higher (~0 to 20kHz as opposed to ~0 to ~11kHz ). The filter on both the ASIC and the DSP is not able to go in a self oscillation. The frequency range of the cutoff frequency is substantially higher for the DSP implementation (18kHz instead of 10kHz). Both filters can become unstable, but by limiting the parameter values, a safe zone of stability can be achieved. A filter sweep sounds smooth and comes reasonably close to the original filter sweep.
After tweaking the routing parameters, the synth sounds as expected. The synthesizer model has full working coverage of the functions of its analog counterpart. B. Hammond For the hammond organ, two implementations resulted. In one, the polyphony is considered as the goal. Two octaves (55 sine waves) of full polyphony were achieved. The effects can not be used due to the overhead they create. Another implementation focusses on the effects and imperfections. The Leslie speaker is output in mono and sounds dry due to the lack of reverb. The chorus and vibrato sound as they should but some tweaking of the parameters is needed to match the effects of the original organ. The keyclick from [4] sounds good for in the mid range of the keyboard. The sounds get unrealistic low in the bass range. The proposed method of using the audio clicks as an advantage generates the high frequencies for all notes. Changing the initial value of the attack influences the sound and character of the keyclick. The keyclick on a real Hammond could be analyzed to tweak this initial value. VII. CONCLUSION The prototype can use improvement on the filter of the minimoog and the polyphony of the Hammond. Multiple DSPs could be used to create more polyphony and increase the quality of the effects. A reverb could be added to simulate the room reflections. Polyphony of the minimoog can be considered, as this is a main advantage of a digital implementation. Furthermore, additional features could be programmed including: a low frequency modulator (LFO), standard effects, temperature instability effect for even more analog character. Further MIDI functionality could be programmed with communication choices in the user interface. REFERENCES [1] J. Pekonen, V. Lazzarini, J. Timoney, J. Kleimola, and V. Välimäki, [2]
Discrete-Time Modelling of the Moog Sawtooth Oscillator Waveform. EURASIP Journal on Ad- vances in Signal Processing, 2011. V. Zavalishin, The Art of VA Filter Design, 2012.
[3] L. S. Aksu, Chorus Effect Through Audio DSP. University of Utah, 2006-2007.
[4] J. Pekonen, T. Pihlajamäki, and V. Välimäki, Computationally Efficient Hammond Organ Synthesis. Proc. of the 12th International Conference on Digital Audio Effects, 2011.
[5] Arturia MiniV [Online; accessed 17-August-2013]. [Online]. Available: intro.html
http://www.arturia.com/evolution/en/products/minimoogv/
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound Thomas De Cnudde Supervisor(s): Norbert Felber, Michael Schaffner
Abstract- Dit artikel beschrijft de implementatie van twee sunthesizer modellen op een Digitale Signaal Processor (DSP). De belangrijkste ontwerpsbeslissingen and resulatten worden besproken. Keywords- Virtual analog, audio signal processing, antialiasing, digital signal processor, moog, hammond
I. INTRODUCTIE Virtual Analog (VA) probeert het gedrag van alanoge instrumenten te imiteren in het digitaal domein. Twee analoge instrumenten, de Minimoog van Moog Music en de Hammond B-3 orgel werden geimplementeerd in assembly op een Analog Devices ADSP21369 SHARC DSP. De implementatie van de minimoog werd op twee manieren aangepakt. Een gebaseerd op een Application Specific Integrated Circuit (ASIC) Synth on Chip systeem dat ontwikkel werd door studenten. In deze aanpak zorgt de DSP voor de stuursignalen naar de ASICs. De andere aanpak is volledig op de DSP gebaseerd. In dit artikel wordt de omzetting van de twee modellen naar het digitaal domein besproken en de nodige algorithmes worden aanhaald. Er werd rekening gehouden met aliasing voor het genereren van de klank. Virtual analog algoritmes worden dan gebruikt om een betere kopie te verkrijgen van de analoge golfvormen. Voor de Hammond orgel is polyphonie het uitgangspunt. Imperfecties van het origineel omtwerp worden besproken en manieren om dit gedrag te imiteren worden voorgesteld. II.
ONTWERP VAN DE SYNTHESIZER
A.Overzicht van de minimoog De geluidsbronnen van deze subtractieve synthesizer zijn of zijn samenstellingen van volgende golfvormen: zaagtand, driehoe en puls. Een witte en roze ruisbron zijn ook aanwezig. Na een mixer worden deze gefilterd door een vier polige ladder filter. Een Voltage Controlled Filter (VCF) varieert de afsnijfrequentie met de tijd. Voor dat het geluid naar de uitgang gaat, wordt het nog door een Voltage Controlled Amplifier (VCA) gestuurd. Deze varieert de amplitude van het signaal over de tijd. Andere functies zijn glide, toonhoogte modulatie en afsnijfrequentie modulatie. B.Overzicht van de Hammond B-3 Dit instrument maakt geluid door het mixen van sinusgolven en harmonischen. Dit vormt een additieve
synthesizer. De sinusgolven worden opgewekt door 91 toon wielen, samen geven zij dit instrument een polyphonie van 5 octaven. Verschillende intensiteitsniveau’s van chorus en vibrato effecten kunnen verder toegevoegd worden. Een percussion knop kan een grotere of kleinere hoeveelheid van of de tweede of de derde harmonische toevoegen. Keyclick, het gevolg van het sluiten van mechanische contacten van de toetsen. Een andere imperfectie is toon wiel lek. Dit is het gevolg van magnetische lek van nabuurige toon wielen. Een Leslie rotary speaker kan worden toegevoegd om diepte in het geluid te brengen. III.
MINIMOOG IMPLEMENTATIE
A. Oscillatoren Verschillende oscillatoren werden beschouwd. De twee met het beste geluid werden afgewogen op computationele efficiëntie. Voor de zaagtanden werd een vierde orde Differentiated Polynomial Waveform (DPW) gebruikt. De puls worden kunnen gevormd worden uit twee phaseverschoven versies van deze zaagtand. Aangezien de harmonischen van de driehoek sneller dalen in vermogen naarmate de frequentie stijgt (met 1/f2 in plaats van met 1/f), werd enkel een eerste orde DPW algoritme gebruikt. Continue witte ruis is verkregen door het interpreteren van de eerste 8 bits in een is achieved by interpreting the first eight bits of a 16-bit Linear Feedback Shift Register (LFSR) als een binair getal. Een filter wordt dan toegepast om roze ruis te verkrijgen. B. Filter De vier polige laagdoorlaat filter met terugkoppeling is geîmplementeerd als in [2]. Een bilineaire transformatie van een eerste orde laagdoorlaatfilter is gebruikt om van het analoog model naar het digitale domain over te schakelen. Vervolgens worden vier van deze gecascadeerd en terugkoppeling wordt toegepast. De afsnijfrequentie moet nog geschaald worden om het juiste gedrag van deze parameter te verkrijgen. C. Andere Functies De juiste routing wordt opgesteld en extra functies worden geprogrammeerd. Deze zijn: Envelope generators (EG), gate gedrag, Musical Instrument Digital Interface (MIDI) functionality, User Interface (UI) op een Liquid Crystal Display (LCD), glide en modulatie. D.ASIC Version Voor de versie op de ASIC wordt de DSP opgesteld om de chips te besturen. De ruis wordt op de DSP gegenereerd op
dezelfde wijze als hiervoor besproken. Alle andere geluiden worden op de Integrated Circuits (IC) gegenereerd. IV.
HAMMOND IMPLEMENTATIE
A. Toon Wielen De toon wielen worden benaderd door een derde orde approximatie van een sinusgolf. Deze werd gegenereerd met behulp van de matlab functie polyfit. Om 5 octaven polyphonie te verkrijgen moet elke audio iterrupt routine tot 91 sinusgolf samples genereren. Door een approximatie te gebruiken daalt het computationele vermogen nodig om dit te realiseren. Verschillende manieren om deze geluidsgeneratie mogelijk te maken werden geprobeerd. Single Instruction Multiple Data (SIMD), meerdere instructies per klok cyclus en de Super Harvard Architecture werden gebruikt om een zeker e hoeveelheid polyphony te verkrijgen. De oplossing om het aantal te doen stijgen ligt erin gebruik te maken van al deze mogelijkheden en de relaties van octaafparen uit te buiten. B. Effecten Chorus en vibrato zijn geïmplementeerd volgens [3]. Toon wiel lek wordt verkregen door het toevoegen van een kleine hoeveelheid witte ruis. Om keyclick te implementeren werd een voorstel uit [4] gebruikt. Hier wordt een extra sinus toegevoegd aan de uitgang. Deze sinus staat is een harmonische van de gespeelde noot. Een andere manier is om de evelope van een gespeelde toon van een van nul verschillende waarde te starten om zo een klik in de audio te verkrijgen. De Leslie speaker is geïmplementeerd als in [4]. C. Andere Functies De MIDI driver werd opgesteld, de UI programmed en de verschillende mogelijkheden voor percussion werden geïmplementeerd. V.
EVALUATIE
A. Minimoog De twee modellen van de minimoog werden geëvalueerd ten opzichte van een bestaande emulatie [5]. De golfvormen worden gecontrolleerd om het effect van het post-filter na te gaan. Aliasing is werd in geplot en vergelijkingen van de spectra werden gemaakt. Tot slot werden de twee modellen geëvalueerd door middel van luisteren. B. Hammond Het model voor de Hammond model werd geëvalueerd op basis van het aantal polyphony verkregen werd. De twee manieren om keyclick te implementeren werden vergeleken door te luisteren. Chorus, vibrato, toon wiel lek en de Leslie speaker werden gecontrolleerd op het juiste sonische gedrag. VI. RESULTATEN Het resultaat is een werkend prototype dat kan bespeeld worden met behulp van MIDI. A. Minimoog De minimoog oscillatoren waren van geluidskwaliteit beter op de DSP versie dan op de ASIC. Het frequentiebereik op de
DSP is bovendien hoger (~0 tot 20kHz in tegestelling tot ~0 tot ~11kHz ). De filters op beide versies kunnen niet in zelfoscillatie treden. Het frequentiebereik van de afsnijfrequentie is substantieel hoger op de DSP versie (18kHz in plaats van 10kHz). Beide filters kunnen instabiel worden maar door grenzen op de parameters te leggen, kan een veilige zone gevormd worden waarin de frequenties stabiel zijn. Een filter sweep klinkt goed en komt redelijk dicht bij de klank van een sweep op het origineel analoog model. Na aanpassing van de routeringsparameters, klinkt de synth zoals verwacht wordt. Het synthesizer model werkt volledig en alle functies komen overeen met het oorspronkelijke model. B. Hammond Voor het model van de Hammond zijn twee implementaties verkregen. In een ervan is polyphonie als doel beschouwd. Twee octaven polyphony resulteert in 55 sinus golven. De extra effecten kunnen niet worden aangezet wegens gebrek aan computationeel vermogen. Het ander model focust op de implementatie van de effecten en imperfecties. De Leslie speaker uitgang is mono en klinkt droog door een gebrek aan reverberatie. De chorus en vibrato klinken zoals verwacht maar enkele aanpassingen aan de parameters is nodig om hetzelfde gedrag te verkrijgen als de originele Hammond. De keyclick implementatie van [4] klinkt goed in de middelste registers van het toetsenbord. De klank wordt onrealistisch voor de lage tonen. Het uitbuiten van audioclicks heeft het voordeel van dezelfde frequenties te genereren voor alle noten. De startwaarde van de envelope kan aangepast worden om het karakter van deze imperfectie te wijzigen. Het gedrag van keyclick op een echte Hammond kan geanalyseerd worden om deze startwaarde aan te passen. VII. CONCLUSION Het prototype kan verbeterd worden met een beter filter. De Hammond polyphony zou verhoogd kunnen worden om dit model beter te maken. Meerdere DSPs zouden kunnen gebruikt worden om polyphonie te doen stijgen en beter effecten verkrijgen. Polyphonie voor de minimoog kan overwogen worden aangezien dit een voordeel is van digitale implementatie. Verder kan extra functionaliteit toegevoegd worden in de vorm van: een meer flexibele low frequency oscillator (LFO), effecten, een temperatuur instabiliteit effect voor een realistischer analoog karakter. MIDI functionaliteit kan uitgebreid worden en een toegewijd menu op de UI zou kunnen worden geprogrammeerd. REFERENTIES [1] J. Pekonen, V. Lazzarini, J. Timoney, J. Kleimola, and V. Välimäki, [2]
Discrete-Time Modelling of the Moog Sawtooth Oscillator Waveform. EURASIP Journal on Ad- vances in Signal Processing, 2011. V. Zavalishin, The Art of VA Filter Design, 2012.
[3] L. S. Aksu, Chorus Effect Through Audio DSP. University of Utah, 2006-2007.
[4] J. Pekonen, T. Pihlajamäki, and V. Välimäki, Computationally Efficient Hammond Organ Synthesis. Proc. of the 12th International Conference on Digital Audio Effects, 2011.
[5] Arturia MiniV [Online; accessed 17-August-2013]. [Online]. Available: intro.html
http://www.arturia.com/evolution/en/products/minimoogv/
Contents
Acronyms
xvi
1. Introduction 1.1. Analog versus Digital . . . . . . . . . . . 1.2. Initial Setup . . . . . . . . . . . . . . . . 1.2.1. Project Practica Seminar-Board . 1.2.2. Analog Devices ADSP-21369 . . 1.2.3. Student Contributions . . . . . . 1.3. Outline . . . . . . . . . . . . . . . . . .
. . . . . .
. . . . . .
2. Synthesizer Models 2.1. Subtractive Synthesis Model: Minimoog . . 2.1.1. Overview . . . . . . . . . . . . . . . 2.1.2. Related Work . . . . . . . . . . . . . 2.2. Additive Synthesis Model: Hammond Organ 2.2.1. Overview . . . . . . . . . . . . . . . 2.2.2. Audio Effects . . . . . . . . . . . . . 2.2.3. Related work . . . . . . . . . . . . . 3. Virtual Analog Algorithms 3.1. Moog Minimoog . . . . . . . . . . 3.1.1. Oscillators . . . . . . . . . . 3.1.2. Filter . . . . . . . . . . . . 3.2. Hammond Organ & Leslie Speaker 3.2.1. Tone Wheels . . . . . . . . 3.2.2. Drawbars . . . . . . . . . . 3.2.3. Leslie Speaker . . . . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . . . . . . . . . . . & Leslie . . . . . . . . . . . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . . . . . . . . . . . Speaker . . . . . . . . . . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
. . . . . . .
. . . . . .
1 1 2 2 2 2 3
. . . . . . .
5 5 5 8 8 9 11 12
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
14 14 14 20 23 23 23 23
4. Implementation 4.1. Musical Instrument Digital Interface (MIDI) 4.1.1. Hardware . . . . . . . . . . . . . . . 4.1.2. Protocol . . . . . . . . . . . . . . . . 4.1.3. Implementation . . . . . . . . . . . . 4.2. Liquid-crystal Display (LCD) . . . . . . . . 4.3. Minimoog . . . . . . . . . . . . . . . . . . . 4.3.1. DSP Implementation . . . . . . . . . 4.3.2. ASIC Implementation . . . . . . . . 4.4. Hammond Implementation . . . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
30 30 30 31 33 33 35 35 38 41
. . . . . . .
. . . . . . .
. . . . . . .
xii
. . . . . . .
Contents 4.4.1. Menu Update Routines (MUPs) . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2. Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. Results 5.1. Minimoog . . . . . . . . 5.1.1. Oscillators . . . . 5.1.2. Evaluation . . . . 5.1.3. Additional Sound 5.2. Hammond . . . . . . . . 5.2.1. Sine Wave . . . . 5.2.2. Effects . . . . . . 5.2.3. Additional Sound
. . . . . . . . . Files . . . . . . . . . Files
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
6. Conclusion and Future Work 6.1. Minimoog . . . . . . . . . . . . . . . . . . . . 6.1.1. Application-Specific Integrated Circuit cessor (DSP) . . . . . . . . . . . . . . 6.2. Hammond . . . . . . . . . . . . . . . . . . . . 6.3. Final word . . . . . . . . . . . . . . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . . . . . . . . . . . . . . (ASIC) versus Digital Signal Pro. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41 41 44 44 44 52 52 52 52 53 54 55 55 55 56 56
A. Task Description
57
B. Declaration of Authorship
61
C. Programming the ASIC C.1. Programming the ASICs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2. ASIC Anomalies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63 63 64
xiii
List of Figures
2.1. 2.2. 2.3. 2.4.
Front panel of the minimoog. (Source: www.cchrispeters.com) . . . Drawbar harmonics. (Source: www.hammond-organ.com) . . . . . Foldback of the harmonics. (Source: http://www.electricdruid.net) Structure of the Leslie speaker. (Source: www.soundonsound.com)
3.1. Oscillator aliasing. . . . . . . . . . . . . . 3.2. Oscillator waveforms. . . . . . . . . . . . . 3.3. Noise spectra comparison. . . . . . . . . . 3.4. ADSR Envelope. . . . . . . . . . . . . . . 3.5. 3rd order sine approximation comparison. 3.6. 3rd order sine approximation spectrum. . 3.7. Drawbar volume approximations. . . . . . 3.8. Leslie speaker signal flow. (Source: [1]) . 3.9. High-pass and low-pass filter. . . . . . . . 3.10. Chorus signal flow. Source: [2] . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
4.1. 4.2. 4.3. 4.4.
MIDI electrical specification diagram. (Source: LCD Layout. . . . . . . . . . . . . . . . . . . Chip 7 configuration of modulationsmatrix. . Chip 8 configuration of modulationsmatrix. .
5.1. 5.2. 5.3. 5.4. 5.5. 5.6. 5.7. 5.8. 5.9.
Spectra for different versions of the triangle wave. . . . . . . Spectra for different versions of the sawtooth triangle wave. Spectra for different versions of the sawtooth wave. . . . . . Spectra for different versions of the square wave. . . . . . . Spectra for different versions of the wide pulse wave. . . . . Spectra for different versions of the narrow pulse wave. . . . Spectra for the LFSR and Mini V white noise. . . . . . . . . Spectra for the LFSR and Mini V pink noise. . . . . . . . . THDN of a sine wave with frequency 370Hz. . . . . . . . . .
xiv
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
6 10 11 12
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
15 17 21 21 24 25 25 26 27 28
http://www.midi.org/techspecs/electrispec.ph . . . . . . . . . . . . . . . . . . . . 34 . . . . . . . . . . . . . . . . . . . . 39 . . . . . . . . . . . . . . . . . . . . 40 . . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
45 46 47 48 49 50 51 51 53
List of Tables
2.1. Minimoog oscillator frequency ranges. . . . . . . . . . . . . . . . . . . . . . . . . 2.2. Hammond frequencies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3. Hammond keyboard ranges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6 9 10
3.1. Coefficients for DPW4 Post-filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2. Parameter values for the Leslie effect. . . . . . . . . . . . . . . . . . . . . . . . . . 3.3. Typical values for the chorus/vibrato parameters. . . . . . . . . . . . . . . . . . .
18 26 28
4.1. Implemented messages and their type . . . . . . . . . . . . . . . . . . . . . . . . .
31
C.1. C.2. C.3. C.4. C.5. C.6.
63 64 64 64 64 65
Source Adresses . . . . . . . . . . . Target Adresses . . . . . . . . . . offsetReg Dataformat . . . . . . adsrReg Parameter Adresses . . . adsrReg Dataformate . . . . . . . Register format for the instruction
. . . . . .
. . . . . .
. . . . . .
xv
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
List of Acronyms
I 2S
. . . . . . . .Inter-Integrated Circuit Sound
ADC . . . . . . . .Analog-to-Digital Converter ADSR . . . . . . .Attack Decay Sustain Release ASIC
. . . . . . .Application-Specific Integrated Circuit
BLEP . . . . . . .Band Limited Step BLIT
. . . . . . .Band Limited Impulse Train
CERN . . . . . . .European Organisation for Nuclear Research CPU . . . . . . . .Central Processing Unit CV . . . . . . . . .Control Voltage DAC . . . . . . . .Digital-to-Analog Converter DPI . . . . . . . .Digital Peripheral Interface DPW
. . . . . . .Differentiated Polynomial Waveforms
DSP . . . . . . . .Digital Signal Processor DVD-Audio . . . .Digital Versatile Disc-Audio EG . . . . . . . . .Envelope Generator FPGA . . . . . . .Field Programmable Gate Array IC . . . . . . . . .Integrated Circuit IIR . . . . . . . . .Infinite Impulse Response IIS . . . . . . . . .Integrated Systems Laboratory LCD . . . . . . . .Liquid-crystal Display LED . . . . . . . .Light-Emitting Diode
xvi
Acronyms LFO . . . . . . . .Low Frequency Oscillator LFSR . . . . . . .Linear Feedback Shift Register LSB . . . . . . . .Least Significant Bit MIDI
. . . . . . .Musical Instrument Digital Interface
MSB . . . . . . . .Most Significant Bit MUP
. . . . . . .Menu Update Routine
PCB . . . . . . . .Printed Circuit Board PPS-Board . . . .Project Practica Seminar-Board SDF . . . . . . . .Spectral Delay Filter SRU . . . . . . . .Signal Routing Unit THDN . . . . . . .Total Harmonic Distortion plus Noise UART . . . . . . .Universal Asynchronous Receiver/Transmitter USB . . . . . . . .Universal Serial Bus VA . . . . . . . . .Virtual Analog VCA . . . . . . . .Voltage Controlled Amplifier VCF . . . . . . . .Voltage Controlled Filter VCO . . . . . . . .Voltage Controlled Oscillator
xvii
Chapter
1
Introduction 1.1. Analog versus Digital With the ever growing computational power and miniaturization of electronic devices, musicians have more resources than ever to translate their ideas to music. An increasing amount of music creation applicatons for tablets, smartphones and computers are at their disposal. When focusing on the sound generating programs, differences between these are functionality and sound quality. Functionality is the result from this increase in processor power and gives extra features that were never possible in the analog field on that small scale. This flexibility is embraced as it gives more possibilities for sound generation. The sound quality of these digital devices, however, can still form an issue and a majority of musicians still prefer the analog instruments. Aliasing, being the most important factor for this lower sound quality, has been researched thoroughly and multiple ways to cope with it have been proposed. Only recently, research has been done to recreate the waveforms that are influenced by imperfections of the analog circuitry [3]. And precisely these deviations make the analog sound so ”warm”. Generating this behaviour using digital algorithms is what is known as Virtual Analog (VA). This thesis considers two analog instruments. Subtractive and additive synthesis are represented by respectively the Minimoog from Moog Music and the Hammond B-3 organ. These models were implemented in the digital domain. For the Minimoog, two approaches were considered. One based on an ASIC project by ETH Züich students, the other one implemented on a DSP. For both realisations, the structure is as close as possible to the original Minimoog. Ways to recreate the original waveforms were researched. For the ladder filter, different models discussed in the literature were considered. Eventhough polyphony is not (yet) implemented on the digital Minimoog prototype, the computational efficiency of these algorithms were always considered along with the heard sound quality. The Hammond B-3 model was only implemented on the DSP as the ASIC did not provide a sine wave oscillator, which is the basic building block for this instrument. The goal for this implementation was to reach full polyphony over five octaves and can be seen as the recreation of one of the three keyboards of the instrument. The Leslie rotary speaker, often found next to this organ, was implemented using an efficient algorithm proposed in a research paper. Vibrato and Chorus effects were added to the model based on their common algorithms. Two extra features, which give the organ sound its distinctive character: keyclick and percussion, were added. Considering the computationally intensive sine wave generation, efficient ways of implementing these are proposed.
1
1. Introduction To play the instruments and to control their parameters, a MIDI was built and the driver was programmed. The interface of the models consists of a LCD. The sound interface consists of a stereo output and a stereo input.
1.2. Initial Setup 1.2.1. Project Practica Seminar-Board The models were built around a Project Practica Seminar-Board (PPS-Board). This is a system used at the Integrated Systems Laboratory (IIS) of ETH Zürich for projects, practica and seminars. The highlights of this board are: • Eight Light-Emitting Diode (LED) bars • A 4x20 LCD • Four directional buttons • An OK button • An auxiliary button • An encoder • An infrared sensor • Four analog and four digital stereo inputs • Four analog and four digital stereo outputs • An Analog Devices ADSP-21369 • A Cirrus Logic, Inc CS5368 8-channel Analog-to-Digital Converter (ADC) • A Cirrus Logic, Inc CS4385 8-channel Digital-to-Analog Converter (DAC) The starting point for the DSP program was based on already existing code from an audio project for measuring a Head Related Transfer Function.
1.2.2. Analog Devices ADSP-21369 This DSP is a high performance 32-bit/40-bit floating point processor and is optimizer for audio processing. More details about this dsp can be found in the datasheet [4], the hardware reference [5] and the programming reference [6]. The DSP is set up to run at 245.76M Hz and an interrupt is called 48000 times a second for the processing and generation of audio. The DSP is programmed in assembly for this project.
1.2.3. Student Contributions For the ASIC part of this thesis, project work of students at ETH was used as starting point. Synth on chip modules and a Printed Circuit Board (PCB) were developped around the PPSBoard in a way that the DSP functions as a controller.
2
1. Introduction ASIC A short overview of the synth on chip will be given here. The full text can be found in [7]. The chip consits of following modules: • 24-Bit resolution • 192kHz Sampling frequency • 128-125xfs Clockfrequency • Two 24-bit stereo audio input • One 24-bit stereo audio output • Inter-Integrated Circuit Sound (I 2 S) Audio format • Four Voltage Controlled Oscillator (VCO) modules with sawtooth, pulse and triangle waves • Two Voltage Controlled Filter (VCF) modules with low-, band- and highpass filters • Two VCF modules with lowpass filters • Four Attack Decay Sustain Release (ADSR) Envelope Generator (EG) modules • Four Voltage Controlled Amplifier (VCA) modules • I 2 S Clock generator • Possibility to cascade chips Information on the programming of the chip can be found in Appendix C. PCB The PCB on which the student ASICs are bonded is made to fit on the PPS-Board. Each PCB can contain 8 ASICs. Maximum four of these PCBs can be stacked, while still being compatible with the PPS-Board, thus creating a chain of 32 chips. With each chip having four oscillators, this adds up to a maximum of 128 monophonic voice polyphony1 . Further information on the PCB can be found in [8].
1.3. Outline The second chapter gives an overview of the features of the two implemented instruments. Related work is also shortly discussed. Chapter three follows the overview of chapter two. The used algorithms needed to implement the functions of the instruments are presented. In chapter four, the implementation of both models is discussed. The MIDI protocol and the layout of the LCD are presented. Afterwards, some highlights of the program structure and decisions for both the ASIC part and the DSP part are presented. Chapter five holds the results. Sound quality is evaluated by measurement and listening. A comparison with related work reveals the value of the implemented algorithms. Conclusion are made and further directions for research and the synth prototype are proposed in chapter six. 1
Monophonic voice polyphony means in this case: one oscillator, one filter and one amplifier per note
3
1. Introduction With this text, a Digital Versatile Disc-Audio (DVD-Audio) is delivered with sound examples. Throughout this work, tracks from this DVD-Audio will be referred to. This way an audible idea of the concepts and the quality can easily be checked.
4
Chapter
2
Synthesizer Models Before converting the analog instruments to the digital domain, the features and functions of the models need to be understood. This chapter gives an overview of the Minimoog and the Hammond organ. Related work is discussed for each of both instruments and their advantages and disadvantages are stated.
2.1. Subtractive Synthesis Model: Minimoog The idea behind subtractive synthesis is to start from a spectrally rich waveform and filter specific frequencies to create a desired sound. Extra interest can then be added by varying filter and/or amplitude parameters. For the subtractive synthesis model, the legendary Minimoog was chosen. As opposed to huge modular synthesis systems, the minimoog was intended to provide a portable monophonic performance instrument for a wider range of musicians. It provides a hardwired signal path of some classic modular synthesizer units. The VCOs generate the sound and go to a mixer where noise can be added. A VCF then filters the resulting sound before going to the VCA whereafter the sound is output. This chain of sound units has become the standard basic subtractive synthesizer routing and can be found in many monophonic and polyphonic synthesizers, whether they are implemented in software or in hardware [9]. In the following paragraphs, the sections of the minimoog frontpanel will be discussed.
2.1.1. Overview In ??, the front panel of the minimoog can be seen [10]. Oscillator Bank The oscillator bank contains the controls for the three oscillators that serve as sound sources. The waveforms on the first two oscillators are from left to right: triangle, sawtooth-triangle, sawtooth, square wave (50% duty cycle), wide pulse (35% duty cycle) and narrow pulse wave (15% duty cycle). The third oscillator substitutes the sawtooth-triangle waveform with a reversed sawtooth, which makes more sense as a modulation signal. All three oscillators have a range
5
2. Synthesizer Models
Figure 2.1.: Front panel of the minimoog. (Source: www.cchrispeters.com) button, which is used to adjust the offset of the VCOs. The values for these ranges and their interpretation are listed in table 2.1. Table 2.1.: Minimoog oscillator frequency ranges. Value Lo 32’ 16’ 8’ 4’ 2’
Interpretation 9 Octaves below played note 2 Octaves below played note 1 Octave below played note Played note 1 Octaves above played note 2 Octave above played note
Oscillators two and three have and extra frequency knob, with which the VCO frequency can be detuned from −7.5 to 7.5 semitones. This way a thicker sound can be created or even a three note chord can be played with one key. An extra switch, osc. 3 control, is present and is used to decouple the frequency of the third VCO from the keyboard. This way, if the third oscillator is used as a modulation source, it is independent from the keyboard Control Voltage (CV). When activated, the frequency range of the third VCO spans 8 octaves instead of 15 semitones. The oscillators range from 0.1 to 20000Hz [11].
6
2. Synthesizer Models Controllers To the left of the Oscillator bank is the Controllers section. The tune knob is used to tune the VCO to a stable reference frequency, this needs to be done often due to temperature dependency of the oscillator pitches. The glide knob, also called portamento, is used to increase the time to change from one note to a next one. When playing a low note and hitting a higher one, the frequency will be swept from the first initial tone to the last struck one. Values for up and down portamento are different and are 2.6s for playing from the lowest key to the highest and 4.2s for gliding from the highest key to the lowest [12]. This behaviour adds to the character of the minimoog. The modulation mix, mixes the amount of signal from the third oscillator and the chosen noise source to be send as the modulation signal. The oscillator modulation switch then routes this modulation signal to the pitch of oscillators one and two. Mixer The mixer contains 5 potentiometers to regulate the volume of the signals. Up to five signals can be mixed: oscillators 1, 2 and 3, an external input and the chosen noise source. All five sources can be decoupled from the signal path, this way the filter can go in a state of self oscillation to create a sine wave. The noise type can here be switched between pink and white noise. Modifiers The upper part of this section contains the filter controls. The cutoff frequency knob sets the filter cutoff to a frequency in the audible range. With the emphasis knob, the amount of feedback is adjusted, varying the filter behaviour from pure lowpass to actual oscillation. The amount of contour controls the intensity of the filter envelope which is set by its attack time, decay time and sustain level knobs. The filter modulation switch routes the modulation signal to the filter cutoff frequency. The CV of the keyboard can be routed to the cutoff in three intensities using the keyboard control 1 & 2 switches. Both switches on means full routing and the cutoff frequency varies with the same intervals as the keyboard. When only switch 1 or switch 2 are set, only 1/3rd or 2/3rds of the keyboard CV are routed to the cutoff. Using both switches and turning the emphasis knob to the maximum position, an extra oscillator is created through feedback. This way a pitched sine wave can be played. The loudness contour of the VCA can be controlled with the attack time, decay time and sustain level knobs positioned below the filter section. Output This section contains the volume for the main and headphone output. A 440Hz reference signal can be added to the output signal to tune the oscillators. A switch is present to decouple the main output from its socket. This way silent on stage tuning of the instrument can be done through the headphone without annoying the audience.
7
2. Synthesizer Models Keyboard Controls On the left of the keyboard, two switches and two wheels are present. The upper switch turns the glide on or off. The lower one sets the release on or off. When in the on position, the release time is set to the decay time. When off, the release is instantaneous. The pitch bend wheel bends the pitch of the oscillators, the modulation wheel controls the amplitude of the modulation signal. The monophonic keyboard spans 44 notes from F to C, has low note priority and is not velocity sensitive [13]. The gate for the envelope generators is only triggered when a new note is played while no others keys were held. Back Panel The back panel holds the input sockets for the external input and the headphone. The output contains a low level and high level sockets. Three CV inputs control extra parameters. An external pitch control and external filter control input vary the pitch and cutoff frequency in an octave per volt fashion. The external amplifier control input controls the gain in a linear relation to the applied voltage. One external trigger input can control the gate of both frequency and amplifier contour generators [11].
2.1.2. Related Work Dedicated digital minimoog hardware clones are not available. These can be recreated in the more common VA synthesizers. Companies like Korg, Access, Roland, Clavia all have created close copies of the minimoog sound in the presets. Central Processing Unit (CPU) based systems are still popular. During this project was performed, two new clones came on the market. One for iPad (Mini V, Arturia), the other for computers (Monark, Native Instruments ). The porting of this synthesizer to the digital domain is getting better, but work is still done to increase the faithfulness of the sound. Advantages over the analog model include: • Compact • Cost less • More flexibility, more waveforms and modulation options available • Temperature stability
2.2. Additive Synthesis Model: Hammond Organ & Leslie Speaker Additive synthesis relies on sound generation by adding sine waves together. To create more interest sounds, the amplitude of the different components can be made to vary over time. The idea holds a close relation to the Fourier theory. Released in 1934, the Hammond tonewheel organ can be considered as the first additive synthesizer [9]. The model discussed here is the Hammond B-3.
8
2. Synthesizer Models
2.2.1. Overview This section discusses the different features of the Hammond tonewheel organ. Tone Wheels & drawbars The sound of this organ is created electromechanically. A sine wave shaped tonewheel rotates near a magnetic pickup. A coil around the pickup converts the motion of the magnet to an electric signal, which then is amplified and output [14]. Per note, up to nine sine waves can be mixed together using the drawbars as volume controls. Resulting in an additive synthesizer. These drawbars have discrete values ranging from zero (no volume) to eight (maximum volume). Each of the nine drawbars are related to the pitch of the played note. In table 2.2, the classic drawbar notation and the corresponding pitch are listed. Figure 2.2 shows the relation of these harmonics to the middle C. Table 2.2.: Hammond frequencies. Drawbar number 1 2 3 4 5 6 7 8 9
Value 160 51/3 0 80 40 2/3 2 0 20 13/5 0 11/3 0 10
Interpretation Sub-Octave 5th Unison 8th 12th 15th 17th 19th 22nd
Keyboard The Hammond organ has a total of three keyboards. The upper keyboard is referred to as the swell and has nine drawbars. The lower keyboard is called the great, has a set of eight drawbars. Both these keyboards have a five octave range plus an extra upper C. The third keyboard are the pedals at the bottom and have two drawbars. This keyboard contains one octave plus one upper C [15]. The frequency ranges of the keyboards are listed in table 2.3. The swell and great have the same frequency range. The highest note that can be sound is the second F # above the highest playable note and corresponds to 5924.62Hz [16]. The keyboard is has full polyphony but no velocity sensitivity. This means that for the swell, 109 tonewheels are needed: 61 for the playable keys, 12 for the sub-fundamental harmonics and 36 for the harmonics that are three octaves above the highest playable key. To reduce the amount of tonewheels to 91, foldback is applied: a tone that is too high to be generated by the available tonewheels ’folds back’ and gets generated by the available tone that is one octave below it. This behaviour is depicted in figure 2.3. The black dots at the edge of the leyboard are folded back to the red dots.
9
2. Synthesizer Models
Figure 2.2.: Drawbar harmonics. (Source: www.hammond-organ.com) Table 2.3.: Hammond keyboard ranges. Keyboard Swell Great Pedal
Lowest note 65.406Hz 65.406Hz 32.703Hz
Highest note 2093.005Hz 2093.005Hz 65.406Hz
Percussion This effect routes a harmonic through an envelope with a fast attack. This creates a percussive hit on the played note. Either the second or the third harmonic can be chosen in a greater or lesser amount to create this effect. The chosen harmonic will not be sustained at the output and the volume of the others tones are reduced in their sustained part [17]. This percussion is only triggered when a new note is played after all keys are released. Imperfections This section describes several extra effects that have an impact on the sound of the organ. Eventhough these were considered as flaws and imperfections in the design, musicians got used to them and can’t do without these anymore. These imperfections can greatly improve the sound and realism of the model.
10
2. Synthesizer Models
Figure 2.3.: Foldback of the harmonics. (Source: http://www.electricdruid.net) Harmonic Leakage The tonewheels are driven in pairs of two and share the same driving gear. Due to this structure, magnetic leakage occurs and results in extra harmonics and noise [17]. Key Click The signal path flows through the mechanical contacts of the keys. When these contacts close, bouncing occurs and this gives rise to a click sound. The nine drawbar contact also don’t shut simultaneously, spreading these audible clicks in time. This behaviour can be seen as an extra high pitched signal with a short attack and decay time [17].
2.2.2. Audio Effects The Hammond organ also features some effects to create a richer sound. An independently developed external speaker, the leslie speaker, was invented to make the sound even more dynamic [18]. Three different types of chorus, three different types of vibrato and the Leslie cabinet all serve as purpose to add depth and interest to the sound [17]. Chorus & Vibrato Chorus simulates the effect of humans playing the same instruments at the same time. The sound is then spread in time, where a second copy of the played part can be struck before or after the first part. Furthermore, these secondary arrival times are not constant. On the Control panel, three different types of chorus can be chosen when not disabled: C1, C2, C3. The intensity of the effect is increased with the number. Vibrato is frequency modulation where the frequency of the modulatior is in the subaudible range. This results in a periodic change in pitch. Similar to the chorus, when the vibrato effect is not disabled, three intensities can be chosen: V1, V2, V3. The chorus and vibrato can not be used at the same time. Overdrive In the original hammond, overdrive was considered a flaw in the design of the amplifier. But as musicians tend to love these imperfections, modern organ clones add this effect as an option to give the musician a choice.
11
2. Synthesizer Models Delay & Reverb To make the sounds even more interesting, modern versions offer extra processing of the sound with delay and/or reverb. Both are used to create a more dynamic sound and to add depth to the resulting audio. Leslie Rotary Speaker Cabinet The Leslie effect is discribed as: A complex combination of vibrato and tremolo effects [9]. A closer look inside the cabinet is needed to see what exactly is going on.
Figure 2.4.: Structure of the Leslie speaker. (Source: www.soundonsound.com) The signal is split using a lowpass and highpass filter with a crossover frequency of 800Hz. The high frequencies go to one tweater, the other is a dummy tweater to compensate the weight. The low frequencies go to a woofer. This structure rotates creating amplitude modulation by varying the position from the listener and frequency modulation by the doppler effect. Furthermore, reverb is added from reflections in the inside of the cabinet. Additionally the speaker cabinet is usually put in a corner of a room, giving rise to even more complex reflections. The cabinet has a switch for choosing between a fast or slow rotation mode.
2.2.3. Related work Multiple DSP based systems including products by Clavia and Roland have been praised for their realism. By using multiple DSPs, the algorithms for the effects can use more calculations and will sound closer to the real thing. Another hardware hammond clone is based on a Field Programmable Gate Array (FPGA) and is called the HX3 Sound Engine. This Hammond on a Xilinx FPGA is based on principles of physical modeling. It also features an optional Leslie emulation [19]. CPU based clones are the most common digital implementation form. Lots of options are available from free projects to commercial software. The latter having the more realistic clones. Hammond clones have been implemented successfully on all three systems. With the necessary
12
2. Synthesizer Models amount of computational power, a realistic model can be designed. Some advantages of having a great sounding digital model: • Compact and portable • Flexible as imperfections can be turned on or off • Costs less and no maintenance needed
13
Chapter
3
Virtual Analog Algorithms This chapter describes the algorithms used to implement the two models. The algorithms are presented following the same structure as the previous chapter.
3.1. Moog Minimoog 3.1.1. Oscillators Whereas in Additive Synthesis sine waves are used as the building blocks to create a sound, Subtractive Synthesis uses spectrally rich waveforms which can be filtered to obtain a desired sound. Three waveforms are omipresent in subtractive synthesis. These are the triangular, the pulse and the sawtooth wave. These three waveforms will be referred to as the classic waveforms. As stated in the introduction, when generating digital audio, care has to be taken to avoid aliasing. Figure 3.1 depicts the problem of aliasing in a sawtooth waveform when generated by a naïve incremental phase counter. Several possibilities to cope with this problem can be found in the literature. The algorithms for generating the classic waveforms can be divided in three categories [20]. • Band-limited Methods: these only generate harmonics below the Nyquist frequency such as Additive synthesis • Quasi-band-limited Methods: based on the sampling of a low-pass filtered continuous-time function • Alias-suppressing Methods: the presence of aliasing is accepted, but an attempt is made to attenuate them sufficiently, like spectral tilt modification. To choose the algorithm for the oscillators, following listed methods were considered. • Additive synthesis [3] • First, Second and fourth orderDifferentiated Polynomial Waveforms (DPW) [21] [3] • Vector phaseshaping synthesis [22] [23] [24] • Band Limited Step (BLEP) synthesis techniques [25] [3] [26]
14
3. Virtual Analog Algorithms
Figure 3.1.: Oscillator aliasing.
15
3. Virtual Analog Algorithms In [20], a comparison of methods is made, evaluating computational complexity, sound quality and memory consumption. All methods were implemented in Matlab to evaluate the perceived sound quality. A frequency sweep was also checked to evaluate the quality. The soundfiles can be found in the audio folder underChapter_3. The sound files for the naïve saw, additive saw, DPW1 saw, DPW4 saw„ PostFilter DPW4 saw Spline-BLEP saw and PD saw are named in the following way: algorithm_Saw. Two extra files are the frequency sweeps of the spline-BLEP and the DPW4 and are named with the suffix sweep. The additive bandlimited synthesis sounds the best, but is computationally not efficient. As an example, for a 20Hz sawtooth, 11 sine waves have to be generated. Considering that the square waves are derived from two sawtooths and three oscillators are present, 11 ∗ 2 ∗ 3 = 66 sine waves are needed for one single voice with three square waves. With polyphony in mind, this gets computationally infeasible. The next best sounding algorithms are the fourth order DPW and the fourth order spline based BLEP method [3]. In VA not only aliasing matter, but also the waveform itself. Due to imperfections in analog circuitry, the actual waveforms differ from the perfect textbook waveforms. Figure 3.2 shows the difference between actual minimoog waveforms and their ideal versions. Only recently, the recreation of the specific oscillator waveforms based on their analog counterparts have been researched [3]. Post-filtering of the textbook waveforms is proposed to get a closer copy of the original analog waveform. Furthermore, frequency dependencies of the waveform are integrated in the post-filter to reach an even better copy. With the overhead of the post-filtering and still with polyphony in mind, the fourth order DPW was chosen for the sawtooth as it is less computationally intensive than the BLEP synthesis while still sounding very good. Sawtooth oscillator For frequencies above 200 Hz, the used algorithm is shown in algorithm 1. Under 200 Hz, the sawtooth samples are generated directly from the shifted phase counter bphase. The output of this oscillator is post-filtered with following first-order Infinite Impulse Response (IIR) filter: 1 − bz −1 Heg = g (3.1) 1 − az −1 With the coefficients g, a and b being frequency dependent in the following way: {g, b, a}(f0 ) = c2 f02 + c1 f0 + c0
(3.2)
The c values are taken from [3], for DPW4 they are listed in table 3.1. Deriving pulse wave The pulse wave can be derived from the sawtooth by adding two versions with a phase offset. This is shown in algorithm 2.
16
3. Virtual Analog Algorithms
Figure 3.2.: Oscillator waveforms.
17
3. Virtual Analog Algorithms
Algorithm 1: DPW4 sawtooth sample generation input : Three state variables (z1, z2, z3 ), frequency f0 , phase output: sample of sawtooth wave 1 2
3
4
5 6 7 8 9 10
11
// Calculate phase increment delta = f0 /F s; phase = mod(phase + delta, 1); // Rescale to get values in [-1, 1] bphase = 2 ∗ phase − 1; // Apply polynomial function poly = bphase4 − 2 ∗ bphase2 ; // Differentiate three times and update states dpoly = poly − z1; z1 = poly; d2poly = dpoly − z2; z2 = dpoly; d3poly = d2poly − z3; z3 = d2poly; // Scale and output out(1, i) = d3poly ∗ pi3 /(24 ∗ (2 ∗ sin(pi/F s ∗ f 0))3 );
Table 3.1.: Coefficients for DPW4 Post-filter. ci
g
b
a
0 1 2
0.6603 6.600x10−5 0
0.9736 −5.871x10−4 5.272x10−8
0.9959 −4.630x10−4 3.691x10−8
Algorithm 2: Pulse wave sample generation input : Two times three state variables (z1, z2, z3, z4, z5, z6 ), frequency f0 , phase 1 and phase 2 output: sample of pulse wave with dutycycle = phase1 − phase2 1
2
Call DPW4 sawtooth function once for phase1 and once for phase2 ; // Subtract samples & Output Output = Saw1 − Saw2;
18
3. Virtual Analog Algorithms Triangle wave As the triangle waveform has a higher harmonic roll off than the square wave (1/f 2 as opposed to 1/f ), it has less problems to preventing aliasing. The first order DPW algorithm was chosen to use less calculations. This is listed in algorithm 3. Algorithm 3: DPW triangle sample generation input : One state variables (z1 ), frequency f0 , phase output: sample of triangle wave 1
2
3 4 5
6
7
8
9 10 11 12 13 14 15 16
17
18 19
20
// Double the increment delta = 2 ∗ f0 /F s; // Set square wave level to 1 initially sqr = 1; // Stage 1: Phase counter prev_phase = phase; phase = mod(phase + delta, 1); compare = phase − prev_phase; // Rescale to get values in [-1, 1] bphase = 2 ∗ phase − 1; // Stage 2: Square function (sq) as polynomial sq = bphase2 ; // Stage 3: Rescale to get values in [-1, 0] sq = 1 − sq; // Stage 4: Evaluate square wave // Flip sign at sawtooth discontinuity if compare < 0 then if sqr == 1 then sqr = −1; end else sqr = 1; end end // Invert every other half period, to get a triangle between [-1, 1] sq = sqr ∗ sq; // Stage 5: Averaged Differentiator dsq = (sq − z1)/2; z1 = sq; // Scale output Output = F s/(4 ∗ f ∗ (1 − f /F s)) ∗ dsq;
Noise Both white and pink noise are needed. The original file for the head related transfer function project containes a discrete white noise generator with output values being either -1 or 1. A pink noise filter is used to generate the pink noise, which has continuous values. For modulating the cutoff frequency and/or the oscillator pitch, a continuous white noise generator is desired. This is implemented using a Linear Feedback Shift Register (LFSR). A 16-bit Galois LFSR with taps on the 16th , 14th , 13th and 11th position is used for this purpose. The bits at one end of
19
3. Virtual Analog Algorithms the shift register are seen as a binary value and converted to an integer, which is scaled to get values between -1 and 1. The resulting algorithm is listed in 4. The sound file can be found in the Chapter _3 folder under LFSR_Noise.wav. Algorithm 4: White Noise sample generation output: sample of white noise 1 2 3 4 5 6 7 8 9
10
11 12
// Update shift register for i ← 1 to 10 do SR(i) = SR(i + 1); end SR(11) = xor(SR_Output, SR(12)); SR(12) = SR(13); SR(13) = xor(SR_Output, SR(14)); SR(14) = xor(SR_Output, SR(15)); SR(15) = SR(16); SR(16) = SR_Output; // Sum contributions Output = SR(12)∗27 +SR(11)∗26 +SR(10)∗25 +SR(9)∗24 +SR(16)∗23 +SR(15)∗22 +SR(14)∗2+SR(13); // Scale output Output = Output/(28 − 1) − 0.5; Output = 2 ∗ Output;
The resulting spectrum is compared with white noise generated using the rand() function in Matlab and is shown in 3.3.
3.1.2. Filter The Moog four pole low-pass ladder filter has been (an still is) a recurring topic in VA research. In [27], the transfer function for this ladder filter is derived and is given by the following equation: ωc4 H(jω) = (3.3) (jω + ωc ) + kωc4 Different approaches to implement it’ s behavior have been analysed in the literature. Ways to preserve the structure of the analog filter when transorming it to the digital domain have been proposed in [28] and [29] using a bilinear transformation. The non-linear behavior in the form of saturation has been researched in [30] using volterra series, in [31] using hyperbolic functions and in [29] using a simplified saturation function. The filter simple non-linear digital filter model from [29] was chosen to be implemented as it is computationally efficient (no hyperbolic functions, which are expensive on a DSP). Despite it’s simplicity, the author of [29] states that this filter sounds reasonably close to a hardware analog transistor ladder filter. The used algorithm can be found in algorithm 5. Envelope Generators The envelope generator is implemented as in algorithm 6.
20
3. Virtual Analog Algorithms
Figure 3.3.: Noise spectra comparison.
Figure 3.4.: ADSR Envelope.
21
3. Virtual Analog Algorithms
Algorithm 5: Filter input : Audio sample, cutoff frequency, feedback coefficient output: Filtered output sample 1 2 3 4 5 6
7
8
9 10 11
12 13 14
15 16 17
18 19 20 21
// Prewarp cutoff frequency ωd = 2 ∗ π ∗ fd ; ωc = 2/tan(ωd ∗ Ts /2); fc = ωc /2/π; g = 2 ∗ π ∗ fc /F s/s; G = g4; S = g 3 ∗ s1 + g 2 ∗ s2 + g ∗ s3 + s4; // Calculate filter input u = (Input − kS)/(1 + kG); // Input saturation u = u/(1 + abs(u)); // Filter section 1 v1 = (u − s1) ∗ g/(1 + g); y1 = v1 + s1; s1 = y1 + v1; // Filter section 2 v2 = (y1 − s2) ∗ g/(1 + g); y2 = v2 + s2; s2 = y2 + v2; // Filter section 3 v3 = (y2 − s3) ∗ g/(1 + g); y3 = v3 + s3; s3 = y3 + v3; // Filter section 4 v4 = (y3 − s4) ∗ g/(1 + g); y4 = v4 + s4; s4 = y4 + v4; Output = y4;
22
3. Virtual Analog Algorithms Algorithm 6: Envelope Generator input : Audio sample, cutoff frequency, feedback coefficient output: Filtered output sample 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
if gate == 0 then jump Release; end if State_EG == 1 then jump Decay; end Attack : // Linear Attack EG_V alue+ = Attack_F req/48000; if EG_V alue < 1 then jump end; end Decay : State_EG = 1; EG_V alue+ = Decay_F req2π/48000(Sustain_Level − EG_V alue); jump end; Release : EG_V alue+ = Release_F req2π/48000(−EG_V alue); end :
3.2. Hammond Organ & Leslie Speaker This section describes the algorithm used for simulating the tone wheel organ. As the envelope generators and the white noise generator are already discussed, these will be skipped.
3.2.1. Tone Wheels As generating 91 sine waves is computationally heavy, a third order approximation is used for the sine waves. This is implemented as described in algorithm 7. The sound file can be found in the Chapter _3 folder under Sine_3rd_440.wav. The approximated sine wave is compared with Matlab’s sine wave in 3.5. The resulting spectrum of this approximated waveform is depicted in 3.6.
3.2.2. Drawbars As the human perception of sound is logarithmic, the drawbars need to follow a similar curve. Instead of calling an expensive exponential function to calculate the amplification coefficient, an approximation is made to save overhead. Figure 3.7 shows several approximations for the amplitude curve. The coefficient for the volume is easily calculated and is shown in algorithm 8.
3.2.3. Leslie Speaker The Leslie speaker signal flow in figure 3.8 is taken from [1]. Similar to [1], the filter coefficients are 4th order digital Butterworth IIR filters with the cutoff frequency at 800Hz. The spectral delay filters are modulated with a biased modulator: m(n) = Ms m0 (n) + Mb
23
(3.4)
3. Virtual Analog Algorithms
Algorithm 7: Sine wave sample generation input : frequency f, phase output: sample of approximated sine wave 1
2
3 4 5 6 7 8 9 10 11 12 13 14
// Calculate phase increment Dphase = f /F s ∗ 2 ∗ π; // Fs is sampling frequency phase = mod(Dphase + phase, 2 ∗ π); // Evaluate phase for right sine wave quarter if phase <= π/2 then Output = −0.1139 ∗ phase3 − 0.0699 ∗ phase2 + 1.0272 ∗ phase − 0.0023; end else if phase <= π then Output = −0.1139 ∗ (π − phase)3 − 0.0699 ∗ (π − phase)2 + 1.0272 ∗ (π − phase) − 0.0023; end else if phase <= 3 ∗ π/4 then Output = 0.1139 ∗ (phase − π)3 + 0.0699 ∗ (phase − π)2 − 1.0272 ∗ (phase − π) + 0.0023; end else Output = 0.1139∗(2∗π −phase)3 +0.0699∗(2∗π −phase)2 −1.0272∗(2∗π −phase)+0.0023; end
Figure 3.5.: 3rd order sine approximation comparison. Algorithm 8: Drawbar volume coefficient calculation input : Drawbar value {0, 1, 2, 3, 4, 5, 6, 7, 8} output: Amplitude coefficient 1
2
// Get the drawbar interval scaled to a maximum of 1 Scaled_V alue = Drawbar_V alue/8; // Power from approximation order Ampl_Coef f = Scaled_V alueApproximation_order ;
24
3. Virtual Analog Algorithms
Figure 3.6.: 3rd order sine approximation spectrum.
Figure 3.7.: Drawbar volume approximations.
25
3. Virtual Analog Algorithms
Figure 3.8.: Leslie speaker signal flow. (Source: [1]) The two modulators have a frequency of 2Hz for the slow rotation and a frequency of 6Hz for the fast setting. Furthermore, the modulator for the bass section is chosen 0.1Hz lower to simulate the independance of the motors. For the amplitude modulation, an extra scaling is applied to the modulator to get it’s values between 0 and 0.9 [2]. The parameters for theSpectral Delay Filter (SDF) are listed in 3.2. The coefficients for the filters are incorporated in the filter algorithm 9. Table 3.2.: Parameter values for the Leslie effect. Parameter
Treble (SDF 1)
Bass (SDF 2)
4 0.2 −0.75
3 0.04 −0.92
SDF length N Modulator scaler Ms Modulator bias Mb
The corresponding magnitude responses of the filter are shown in figure 3.9. The section with the spectral delay filters and the amplitude modulation is shown in algorithm 10. The resulting sound can be found in the Chapter _3 folder under Leslie.wav. Chorus & Vibrato The chorus and vibrato are implemented as in [2]. Vibrato is implemented similar to the chorus, except that the dry signal is not output. Typical average delay times and delay amplitude swings are listed in table 3.3 [2] [32]. Algorithm 11 shows the processing steps for the chorus and the vibrato. The resulting sound can be found in the Chapter _3 folder under Chorus.wav and Vibrato.wav.
26
3. Virtual Analog Algorithms
Figure 3.9.: High-pass and low-pass filter.
Algorithm 9: Leslie speaker effect Part 1: Filters input : Sample to be filtered output: High and low-pass filtered samples 1 2 3 4 5
6 7 8 9
10 11
12 13 14 15 16
17 18 19
20 21
// High pass filter, Section 1 Hp1 = 0.0068795671573419629 ∗ Input; vhp12 = vhp11; vhp11 = vhp10; vhp10 = Hp1 + 1.7581478932712828 ∗ vhp21 − 0.7774971358899786 ∗ vhp12; Hp1 _Out = 1.0006904802202812 ∗ vhp10 − 2 ∗ vhp11 + 1.0006765701572962 ∗ vhp12; // High pass filter, Section 2 Hp2 = 124 ∗ Hp1 _Out; vhp22 = vhp21; vhp21 = vhp20; vhp20 = Hp2 + 1.7581478932712828 − 0.7774971358899786; // Save previous sample z_Hp2 _Out = Hp2 _Out; Hp2 _Out = 1.0001758065804613 ∗ vhp20 − 2 ∗ vhp21 + 1.0000645546706863 ∗ vhp22; // Low pass filter, Section 1 Lp1 = 0.0034124555174217938 ∗ Input; vlp12 = vlp11; vlp11 = vlp10; vlp10 = Lp1 + 1.9535289842271244 ∗ vlp11) − 0.96170553850948703 ∗ vlp12; Lp1 _Out = 0.22066698655823566 ∗ vlp10 − 0.43121162906691385 ∗ vlp11 + 0.22062865445813754 ∗ vlp12; // Low pass filter, Section 2 vlp22 = vlp21; vlp21 = vlp20; vlp20 = Lp1 _Out + 1.8937755598129984 ∗ vlp21 − 0.89802680517216937 ∗ vlp22; // Save previous sample z_Lp2 _Out = Lp2 _Out; Lp2 _Out = 1.7826781820353519 ∗ vlp20 − 1.1753671236471483 ∗ vlp21 + 0.39808433028973417 ∗ vlp22;
27
3. Virtual Analog Algorithms Algorithm 10: Leslie speaker effect Part 2: Spectral delay filters and amplitude modulation input : Frequency of modulator signals, outputs from the filters output: Sample with Leslie effect 1
2 3 4 5 6
7
8
9 10 11
12
13
// Treble processing Call sine wave function with frequency f1 for modulator 1 and store m1 = 0.2 ∗ modulator1 − 0.75; Save previous states in z_zx z1 = m1 ∗ Hp2 _Out + z_Hp2 _Out − m1 ∗ z_z1; z2 = m1 ∗ z1 + z_z1 − m1 ∗ z_z2; z3 = m1 ∗ z2 + z_z2 − m1 ∗ z_z3; z4 = m1 ∗ z3 + z_z3 − m1 ∗ z_z4; // Amplitude Modulation z4 = z4 ∗ (modulator1 ∗ 0.05 + 0.95); // Bass processing Call sine wave function with frequency f2 for modulator 1 and store m2 = 0.04 ∗ modulator1 − 0.925; Save previous states in z_zx z5 = m2 ∗ Hp2 _Out + z_Lp1 _Out − m2 ∗ z_z5; z6 = m2 ∗ z5 + z_z5 − m2 ∗ z_z6; z7 = m2 ∗ z6 + z_z6 − m2 ∗ z_z7; // Amplitude Modulation z7 = z7 ∗ (modulator2 ∗ 0.05 + 0.95); // Sum and scale outputs Output = (z4 + 2 ∗ z7)/2;
Figure 3.10.: Chorus signal flow. Source: [2] Table 3.3.: Typical values for the chorus/vibrato parameters.
Typical delay amplitude Typical LFO rate Typical delay time
28
Chorus
Vibrato
≈ 2.5ms ≈ 1Hz 10 − 25ms
≈ 2.5ms 5 − 14Hz 5 − 10ms
3. Virtual Analog Algorithms
Algorithm 11: Chorus/Vibrato effect input : Input sample, average delay time avgd elay and amplitude swing ampld elay output: sample with chorus/vibrato effect 1 2 3 4 5
6
7
8
9 10 11
12 13
// Update delay line with length l Delay_Line(1) = Input_Sample; for i ← l to 2step − 1 do Delay_Line(i) = Delay_Line(i − 1); end get modulator by calling sine wave function with frequency f and phase // Calculate tap position j j = f loor(avg_delay ∗ F s) + f loor(ampl_delay ∗ F s ∗ modulator); // Get fractional part f raction = f loor(avg_delay ∗ F s) + ampl_delay ∗ F s ∗ modulator − f loor(f loor(avg_delay ∗ F s) + ampl_delay ∗ F s ∗ modulator); // Sum output if Chorus then // Chorus effect chosen Output = 0.5 ∗ Input + 0.5 ∗ Delay_Line(j) ∗ (1 − f raction) + Delay_Line(j + 1) ∗ f raction; end else // Vibrato effect chosen Output = Delay_Line(j) ∗ (1 − f raction) + Delay_Line(j + 1) ∗ f raction; end
29
Chapter
4
Implementation This chapter discussed the implementation of the MIDI protocol and hardware, the LCD as user interface and the design decisions made for the two instrument models.
4.1. MIDI In the early days of analog synthesizers, CV and gate pulses were the only way to automate parameters [33]. Although these inputs were standard on analog synthesizers, the implementation was not. For pitch control using CV two interpretations are present [33]: • Octaves per volt • Hertz per volt For triggering the gate signal, also two interpretations are available [34]: • Voltage triggers: High voltage level when on, grounded when off • Switch triggers: Grounded when on, high voltage level when off To make matters worse, the high voltage level threshold of the voltage trigger is not standardized. The MIDI protocol was developed as a digital standardized alternative for the incompatible communication between synthesizers and sequencers. It is a hardware and software specification and detailed information can be found in the specifications [35].
4.1.1. Hardware A MIDI Interface usually consists of three ports for communication of the devices. One Input: MIDI IN, and two outputs: a MIDI THRU that just passes the incoming message and a MIDI OUT which sends its own messages from the device. For signaling, current loops of 5mA are used with current on meaning logical zero. Transmitting and receiving devices are separated by an opto-isolator to avoid ground loops and subsequent data errors. The receiver must require less than 5mA to turn on, rise and fall times should be less than 2 microseconds. The shielded twisted pair cables are terminated by 5-pin DIN male plugs, with the shield connected to pin 2 at both ends [36]. Figure 4.1 shows the electrical diagram of the ports.
30
4. Implementation
The opto-isolator used is a Vishay Semiconductors 6N 136 [37]. It’s high speed (1MBit/s) conforms to the timing of the MIDI specification. The DSP is supplied with 3.3V and the maximum voltage it’s peripheral pins can handle is 3.3V+0.5. The 5V input signal from diagram 4.1 thus has to be converted down. To achieve this, instead of the 280Ω resistor Rd , a higher value of 4.7kΩ is used. During development a MIDI OUT port was used to signal the MIDI IN from the DSP itself. The MIDI OUT has no other implemented functionality. A Motorola M C74ACT 04 hex inverter was used for the MIDI OUT [38]. The minimum high level input voltage with a supply voltage of 5V is 2.5V and can thus be driven correctly by the DSP’s 3.3V. To get more driving power three of the six invertors are wired in parallel.
4.1.2. Protocol The interface operates at 31.25(± 1 % ) KBaud and is asynchronous [35]. The data consists of 8 bit with an extra start bit and stop bit added. Messages are sended Least Significant Bit (LSB) first. A MIDI message starts with one status byte and depending on the type of message, a specific number of data bytes follows. Data bytes can be distinguished from status bytes by the most significant bit: data bytes have the Most Significant Bit (MSB) equal to zero while status bytes have this bit equal to one. An action from the receiver should wait until all data bytes required under the current status are received. Five major types of MIDI Messages can be distinguished: Channel Voice, Channel Mode, System Common, System Real-Time and System Exclusive. Each of these messages can be sent over any of 16 channels. For the prototype, only the necessary messages from the Channel Voice category are implemented. As the specification dictates, other messages are ignored. Channel Voice messages have their status byte between 0x80 and 0xEF. The first nibble dictates the type of MIDI message. The second nibble contains the MIDI channel and is ignored in our case as the prototype reads from all the channels. The implemented messages, their number and their type are listed in tabel 4.1. Table 4.1.: Implemented messages and their type . Value high nibble
Interpretation
First data byte
Second data byte
8 9 B E
Note Off Note On Control Change Pitch Wheel
Note number Note number Controller number First 7 bits
Velocity Velocity Controller value Second 7 bits of pitch value
The note off message holds the velocity and note number of a released key. The note on holds this same information for a pressed key. For the control change message, only the one with controller number 1 is implemented and corresponds to the mod wheel position. The pitch wheel encompasses a 14-bit value in it’s data bytes and holds the information for the position of this wheel.
31
4. Implementation
Figure 4.1.: MIDI electrical specification diagram. http://www.midi.org/techspecs/electrispec.php)
32
(Source:
4. Implementation
4.1.3. Implementation The Signal Routing Unit (SRU)s were set up to connect the Digital Peripheral Interface (DPI)s to the MIDI interface. The Universal Asynchronous Receiver/Transmitter (UART) receiver for the MIDI IN is connected to the DPI pin 6 on UART0_RX and the pin buffer is disabled. For the MIDI OUT, the UART1_TX is connected to DPI pin 7 and the pin buffer is enabled. The UART registers are configured by doing the following actions: • With the peripheral clock set to 122.88MHz and the baudrate = P CLK/16/divisor, the divisor is set to 246 • The word length is set to 8 bits • The interrupts are disabled, polling will be used as the protocol is relatively slow • The UART1_TX and UART0_RX are enabled Polling for the UART receive bit is set up and when the receive register is full, a MIDI_collect function is called. This function reads the register and checks for the status bit. If 1, the type of message is analysed an a counter is set depending on the expected data bytes to follow. If the status bit is 0, the data bytes get appended to an array that holds the MIDI message and the counter gets updated. Finally, if the counter matches the amount of expected data bytes, a MIDI_Action function is called. In this function, the type of message is analysed again and the right actions are taken. For a note off message, the gate for the corresponding key is turned off. For a note on message, the frequency and velocity get calculated and stored. For control and pitch wheel message, the corresponding values get updated. In case of the polyphonic Hammond organ, depending on the received note number, a bit in a gate array is turned on or off depending on whether a note on or note off message was received.
4.2. LCD The LCD is programmed to function as the user interface. For the minimoog interface, functions are layed out in a logical way with sound design and the original front panel in mind. For the Hammond, the drawbars and effects are chosen to be only one direction button appart for easy access. Figure 4.2 shows the layout of the screens and the initial values at startup. A first welcome screen gives the option to choose between the two instruments with the OK button. The directional buttons navigate through the different screens. The model can only be exited when the OK button is pressed in the last screen. When this happens, the active screen switches back to the welcome screen. In the last screen of the minimoog, the amount of polyphony (#poly) is not yet implemented but the option is left open as polyphony is a major advantage of the digital implementation. With the Gate option, the gate behaviour of the synthesizer can be changed between Moog behaviour (gates trigger only at first note after no keys were pressed) and the gate behaviour of a ARP Odyssey synthesizer (gate retriggers with every played note) [39]. The LCD parameters are all integers. MUPs are needed to calculate the display value from this integer. Display values are the ones actually shown on the display. In the next sections, all MUPs update this integer to a meaningfull value, so this will not be stated every MUP.
33
4. Implementation
Figure 4.2.: LCD Layout.
34
4. Implementation
4.3. Minimoog 4.3.1. DSP Implementation The description of the DSP minimoog is described here. An overview of the MUPs is given. Afterwards, the interrupt routine flow will be described. MUPs Parameters of the LCD that don’t have a MUP, are updated on the fly in the interrupt routine functions. Wave_MUP The parameters for the oscillators are stored in an eleven element array each. The format of this array is: waveform, phase1, phase2, z1, z2, z3, z4, z5, z6, frequency, sign. With these parameters, all waveforms can be generated from one central waveform generator. When a new oscillator type is chosen, the array gets loaded correspondingly. When the oscillator waveform changes, a change1/2/3 parameter is set to trigger a fade in on the oscillator to avoid audio clicks. Freq_MUP and Range_MUP Freq_MUP stores the amount of semitones for the VCO 2 and 3 in an array VCOStepsF for calculations in the interrupts. When the oscillator 3 control is switched off, the amount of semitones that can be adjusted is changed to 8 octaves (-48 to +48 semitones instead of -7.5 to 7.5) and oscillator 3 is decoupled from the keyboard. Range_MUP checks which frequency range is chosen and gets the right amount of semitones from a RangeSteps array which holds the values: -100, -24, -12, 0, 12, 24. The resulting amount is stored in the corresponding vco position of the VCOSteps array for later use in the interrupts. Vol_MUP Vol_MUP calculates and stores the volume in Vol1/2/3. The calculation is done using the x4 curve. ExtVolume_MUP works in the same way but is used for the noise volume and the external input volume. Control_MUP Control_MUP calculates and stores the modulation mix coefficient and modulation wheel coefficient. PTune_MUP PTune_MUP calculates detune value and stores is in prevTune, which is used during the interrupts to calculate the resulting VCO frequencies. Glide_MUP Glide_MUP calculates the glide coefficient for use in the interrupt. FilterC_MUP FilterC_MUP calculates the emphasis and contour and stores them respectively in memory location k (feedback) and Cntr_M (EG intensity).
35
4. Implementation EG_MUP The EGVCF_MUP gets called when a value for the VCF EG is changed. The frequencies and level of the parameters are stored in memory under attackVCF, decayVCF, sustainVCF, releaseVCF. When te decay parameter is off, the release value gets a period of 2.5ms, otherwise it’s the same as the decay value. The screen is then updated. The EGVCA_MUP works in the same way but for the VCA. PWheel_MUP PWheel_MUP works like the PTune_MUP but for the pitchwheel. Its value is stored in prevPWheel. Interrupt Flow When the minimoog synthesizer is chosen, following functions are performed by the audio interrupt routine: • Audio samples are generated and scaled by calling the Mixer function • The needed cutoff frequency from the tracking coefficient is calculated from the played note and stored in memory under fc in the KbTracking_MUP function • The necessary cutoff frequency offset gets calculated from the VCF_ EG and the modulation wheel whereafter the sample gets filtered in M_Filter • EG_VCA gets called to scale the sample • When the velocity is turned on, the sample is scaled with the velocity from the MIDI routine • In A_440_MUP, the left channel outputs a reference sine when switched on Mixer The mixer starts by calling the Calc_Send_Freq function, this calculates the right frequency for the oscillators. For the three oscillators, the desired waveform is evaluated and the parameters used in the MOsc functions (which hold the waveform algorithms) are stored with the right value from the wav_1/2/3 arrays. After the waveform function is returned, the updated values, states, phases and the sign is stored back in the wav_1/2/3 arrays. The volume is read from memory and scaled with the sample and stored in Mixer_Out_1/2/3. If a waveform for an oscillator is changed, the new samples are going through an EG and reach their final value after 0.125 seconds, to prevent audioclicks. The continuous white or pink noise sample is calculated when needed and the mixer scales the different contributions of the samples. The sum of these contributions is scaled with the master volume and is then finally stored in Mixer_Out_All for use in the filter. Calc_Send_Freq This function calculates the frequency offsets and sends them to the VCOs. This gets called from the mixer every audio interrupt. It also checks whether glide and/or oscillator modulation is needed. When glide is needed, the active note gets incremented in frequency, depending on the amount of glide. When the active note reaches the played note, called nextNote, the frequencies are the same and the increment turns to zero. The modulation signal is calculated and the new value stored in Mod_Out.
36
4. Implementation Next, amount of semitones offset, n, from the played note get calculated by adding these contributions: VCOSteps value, VCOStepsF value, value for the pitchwheel, value of the tune parameter and the Mod_Out sample. The resulting frequency gets set by f req = act_note_F req ∗ 2n/12 with respect to the active note act_NoteFreq_Moog. MOsc This file holds the three basic oscillator functions. By calling MOsc_Saw, MOsc_Square or MOsc_Tri a sawtooth, pulse or triangle can be generated. For the sawtooth, post filtering is applied. For low frequencies, the scaled phase counter is output. The implementation is done as presented in the algorithms. Keyboard tracking This function calculates the cutoff frequency from the played note, the keyboard tracking settings and the cutoff frequency set on the display. The resulting cutoff frequency is stored in fc for later use. M_Filter First, the Mod_Out value is calculated from the modulation wheel. When the filter modulation is switched on the Noise_Out and Osc_3_Mod are scaled with the ModMix value and stored in Mod_Out , which is later used to add to the resulting fc. The freq_VCF EG value is retrieved from memory and multiplied with the contour Cntr_M. Then the distance of the cutoff frequency from the maximum cutoff frequency (18000Hz) is calculated. The contour scaled envelope is than multiplied with this difference and added to the cutoff frequency fc from the Kb_ tracking. The filter algorithm from the previous chapter is then calculated and the resulting sample is output in memory location Filter_Out. Envelope Generators The EGs get calculated as in the algorithm presented in the previous chapter. The present value of the VCA is stored in memory under ampl and used to scale the samples. The value generated by the VCF is stored in freq_VCF and used as offset in the calculation of the cutoff frequency in the M_Filter function. A-440Hz This function generates a 440Hz sine wave and outputs it on the left channel when turned on. The original content of the left channel is then overridden. Noise The noise generator in Galois_Noise implements the algorithm as presented in the previous chapter.
37
4. Implementation
4.3.2. ASIC Implementation In this implementation, the DSP acts as a controller and a gateway from the ASICs to the DACs and from the ADCs to the ASICs. The gates for the EGs are triggered from the MIDI routines. The Serial Ports were configured for the I 2 S stream. The routing of the chips can be seen in 4.3 and 4.4. Polyphony can be added by cascading chips with the same configuration as chip7. The filter will retrigger only when the first key is played after all keys were released. T As only the noise functions are called from the interrupt routine, no interrupt flow is given. The most important functions are explained first. Send Functions Firstly, send functions were set up to signal new configurations and register data to the ASICs. These functions sendConfig7/8 need an instrSet, an instrCounter and an instrNumber. At the start of the program an initial routing is uploaded to the modulationsmatrix of the ASICs. The routing can be seen in figure 4.3 for chip 7 and in figure 4.4 for chip 8. This routing gives no rise to audio clicks when performance parameters are changed (like cutoff frequency for filter sweeps). Calc_Send_Freq This function is called in every function that changes the frequency and works in the same way as explained in the previous subsection. The only difference is that the frequency values have to be converted and be put in the right data format before uploading them to the VCOs of chip7 and chip8. Wav_MUP To change the waveforms on the VCOs, the modulation matrix has to be reuploaded entierly. To do this, the modulation matrix for chip 7 is stored in wavCnfg7, and chip 8 in wavCnfg8. Depending on the waveform, specific values are changed in this matrix and uploaded. Freq_MUP and Range_MUP Same functionality as the previous subsection. The only difference is that from here, the Calc_Send_Freq function is called (change in frequency). Volumes_MUP and ExtVolume_MUP The volumes for the VCOs get calculated and are sent to the chip7. The other routine updates the noise and external volume on the DSP. Glide_MUP Glide coefficient is calculated and stored. PTune_MUP Frequency offset is stored in prevTune. Frequency has changed so Calc_Send_Freq gets called. Kbrd_MUP The noise source and the volume for vco1 on chip8 and vco 4 on chip 7 are scaled with the modmix parameter. The oscmod is checked and the modulation wheel is scaled with the modulator. The noise is sent to the chip through OscModNoise. The sustain value for the ADSR4, wich is used for scaling the the modulator signal on chip is sent to chip 7. The same thing is done for the filter modulation but on chip 8.
38
4. Implementation KbTracking_MUP Calculates the cutoff frequency from the played note, keyboard tracking setting and the cutoff frequency dialed on the display. This resulting cutoff frequency is put in the right data format and uploaded to chip8. When the cutoff frequency is updated, the keyboard tracking is updated too. Is also called when the keboard tracking settings are changed. FilterC_MUP The value for the emphasis (filter feedback) is scaled down to guaranty filter stability. The contour is dependent on freqData (which contains the data value of the cutoff frequency). This way, when the filter cutoff sweeps from the EG, it can be made so that the largest stable value is not surpassed. The contour gets therefor less with larger cutoff frequency. Both data is set in the right format and uploaded to chip 8. KbTracking_MUP is called as the cutoff frequency is changed. EG_MUP EGVCF_MUP and EGVCA_MUP calculate the right values for the ADSR registers. The frequency gets put in the right dataformat and is uploaded to chip8 vca1 for the VCA and chip8 vca2 for the VCF. Decay_MUP Checks whether or not the decay parameter is on or off. Uploads a frequency of 100Hz (10ms) in the right data format if the decay is turned off. Else, it sends the same value as the decay. PWheel_MUP Right value is calculated and stored in prevPWheel.
Figure 4.3.: Chip 7 configuration of modulationsmatrix.
39
4. Implementation
Figure 4.4.: Chip 8 configuration of modulationsmatrix.
40
4. Implementation
4.4. Hammond Implementation The sine waves from the tone wheels are implemented as the third order approximations presented in the previous chapter. The input for this routine is the instantaneous phase of the wanted sine.
4.4.1. MUPs The menu updates that occur outside of the interrupts will be discussed first. Master Volume When the value of the master volume changes, the amplification coefficient is calculated using the x8 approximation. The resulting value is then stored in memory under VolH. Drawbar Volumes The drawbar integers get scaled to an interval between 0 and 1. Then the x8 approximations are calculated stored in nine memory locations under G_sinGainx, with x the number of the drawbar. Four extra coefficients are calculated by adding previous gains: G_sinGain58, G_sinGain69, G_sinGain469, G_sinGain258. By doing this, the interrupt routine does not have to calculate these in the foldback regions. Other Menu Parameters The other menu parameters hold only strings, their values are called in the interrupt routine to check if a path for effects needs to be taken or a variable for percussion and keyclick needs to be changed.
4.4.2. Interrupt The calculation flow of an interrupt will be followed while explaining the actions taken to generate a sample. When the Hammond option is selected, the flow of the interrupt goes as listed below: • Envelope update by calling Envelope_Array_Update • Generate the sine waves and scale them with the gains and envelopes by calling GenSin_DSPHammond • Process Chorus/Vibrato if needed by calling Hammond_Chorus • Process Leslie speaker if needed by calling Hammond_Leslie • Add tone wheel leakage if needed by calling the noise generator PN_Gen_DSP • Output the generated sample
41
4. Implementation Envelope Update At the time of writing, 25 note polyphony was reached. An array of 25 elements is used to keep track of the envelopes for each note in Env_Array. An array of the same length holds the state of the EGs under Env_State and a prevKeys array is present to check whether a key is released, struck, held or not active. The function Envelope_Array_Update calculates the envelopes and handles the keyclick. The first part of this function performs a sweep of the Keys_Active array that is set by the MIDI routines. If a key is hit the corresponding state of the envelope is set to attack, if the key is released the state is updated to release. The prevKey array is updated at the end of this first loop. Next, another sweep is performed and the envelope states are checked. Depending on the state, the envelope goes to the attack, decay or release section. The sustain level is incorporated in the decay as was shown in the EG algorithm in the previous chapter. The Env_Array is updated for use in the next function. Keyclick is added by not starting the attack on zero but adding a little offset. This creates a high pitched audio click at the start of each note. This was chosen over the method in [1], where the sixth harmonic is added to the sound, requiring more calculations, and thus precious clock cycles. Furthermore, when playing lower keys, the above stated method generates lower pitched keyclicks, which sound not as good as the high pitched ones. The need for percussion is checked and an extra envelope is calculated when needed. Using the percussion also lowers the sustain of the EG. Generate and Scale Sine Waves G_Dphasex_y x for the number of the note, y ranging from sub, 1 ... H The output sample is first reset. Sequentially the phase and the phase difference get called from memory, modulo operation is performed if needed and the sine function is called with the phase as input. The output from the sine is then scaled with the envelope of the keys and then scaled again with the gain variable and added to the output sample. A 5Hz amplitude modulator can be applied by generating one more sine wave and multiplying the output with this modulator. The result of all these sine waves is then stored in a variable Out_Hammond. Chorus/Vibrato Effect During the initialising phase of the DSP, the ringbuffer Chorus_ringbuff with length 2880 is set. This function first evaluates which effect is set using the LCD parameter and jumps to the right section. In each section the right phase increment for the Low Frequency Oscillator (LFO) is stored in Mod1_Dphase and the ModSin function is called, which calculates the sine wave value of the LFO. The average delay is set and the right modulation coefficient is applied to the amplitude for the LFO depending on the needed intensity. The ringbuffer is updated with the value of Out_Hammond and the algorithm presented in the previous chapter is executed. Depending on the effect, summation an scaling of the output and the tap of the ringbuffer is done. Finally, the output is stored in the memory again. Leslie Speaker Effect The need for this effect is evaluated first. When needed, the speed setting is checked and the two modulator phases Mod3_Dphase and Mod4_Dphase increments are set. Next, the
42
4. Implementation sine wave function is called to get the values for both modulators. The input sample from Output_Hammond is then fed through the highpass filter and the lowpass filter as explained in the algorithm in the previous chapter. The spectral delay filter and the amplitude modulation are then applied and the outputs are summed. The output is stored in Output_Leslie. Tone Wheel Leakage This function adds a small amount of white noise to the output. Output The resulting sample is finally output in mono.
43
Chapter
5
Results In this chapter, the results of the implementations will be discussed. Audio samples will be referred to where needed to provide an audible idea of the sound quality for the oscillators and effects. The sound examples can be found under Chapter_5.
5.1. Minimoog To evaluate the sound of the minimoog, a demo of a commercial software emulation of this synthesizer was used. This software is considered one of the best digital implementations of the minimoog and is called the Mini V from arturia [40].
5.1.1. Oscillators The oscillators of the ASICs, the DSP implementation and the Mini V were recorded. Three frequencies were chosen to cover three ranges of the keyboard: 130.8Hz (C2), 1046.5Hz (C5), 10548.0Hz (F#7). For each waveform the spectra will be plotted for these three frequencties and for the three different models. After the spectra are shown, general conclusions are discussed. Triangle Figure 5.1 shows the spectra for the triangle wave. The corresponding audiofiles are named: TRI_model _x. Where model is either ASIC, DSP or ARTURIA and x is 1 (130.8Hz), 2 (1046.5Hz) or 3 (10548.0Hz) . Sawtooth Triangle Figure 5.2 shows the spectra for the sawtooth triangle wave. The corresponding audiofiles are named: TRISAW_model _x. Same conventions apply for model and x.
44
5. Results
Figure 5.1.: Spectra for different versions of the triangle wave.
45
5. Results
Figure 5.2.: Spectra for different versions of the sawtooth triangle wave.
46
5. Results Sawtooth Triangle Sawtooth Figure 5.3 shows the spectra for the sawtooth wave. The corresponding audiofiles are named: SAW_model _x. Same conventions apply for model and x. The post-filtered versions of the sawtooth are also plotted. Their audiofiles are listed under POSTSAW_model_x.
Figure 5.3.: Spectra for different versions of the sawtooth wave.
Square Figure 5.4 shows the spectra for the square wave. The corresponding audiofiles are named: SQR_model _x. Same conventions apply again for model and x. Wide Pulse Figure 5.5 shows the spectra for the wide pulse wave. The corresponding audiofiles are named: WIDE_model _x.
47
5. Results
Figure 5.4.: Spectra for different versions of the square wave.
48
5. Results
Figure 5.5.: Spectra for different versions of the wide pulse wave.
49
5. Results Narrow Pulse Figure 5.6 shows the spectra for the narrow pulse wave. The corresponding audiofiles are named: NARROW_model _x.
Figure 5.6.: Spectra for different versions of the narrow pulse wave.
White Noise The white noise spectra from the DSP and the Mini V are compared in 5.7. The corresponding audiofiles are named WHITE_ARTURIA and WHITE_DSP. Pink Noise The pink noise spectra from the DSP and the Mini V are compared in ??. The corresponding audiofiles are named PINK_ARTURIA and PINK_DSP.
50
5. Results
Figure 5.7.: Spectra for the LFSR and Mini V white noise.
Figure 5.8.: Spectra for the LFSR and Mini V pink noise.
51
5. Results
5.1.2. Evaluation Oscillators The ASICS have a clear tendency to overcomensate antialiasing. A lot of information is lost in the waveforms this way and explains why the samples sound less rich than the ones from the Mini V or the DSP. Eventhough the DSP shows aliasing for high frequencies, the sound quality can be considered closer to the Mini V than the ASICs. Post-filtering the sawtooth makes the sound less rich and actually makes the difference between the DSP and the Mini V bigger. Noise The white noise from the Mini V is whiter than the noise from the DSP while the pink noise from the DSP is pinker than the one from the Mini V. The Mini V has a very flat spectrum compared to the white noise from the DSP. An extended version of the LFSR with more taps could give better behaviour at the cost of computational power. Measurements on the minimoog could be done to come up with less pink filter coefficients to get a more accurate noise generator. The difference of these noise sequences is hearable, so adjustments should be made to get more ’analog’ noise.
5.1.3. Additional Sound Files Additional sound files are: Glide.wav and PITCHMOD.wav
5.2. Hammond The evaluation of the sine wave is done by measuring the Total Harmonic Distortion plus Noise (THDN). The effects are evaluted by listening.
5.2.1. Sine Wave Figure 5.9 shows the spectrum of the 3rd order approximation of the sine wave. The THDN equals -51.6dB. This is quite high for audio, but considering that an organ is not played as a sine wave generator an thus more than one sine waves are present, this effect is not really noticable. Sound files for the single note and a chord can be found in:
52
5. Results
Figure 5.9.: THDN of a sine wave with frequency 370Hz.
5.2.2. Effects Keyclick The two versions of the keyclick can be heard in the folder Chapter_5 under the following names: KEYCLICK_6.wav and KEYCLICK_CLICK.wav. The latter one being the keyclick based on the nonzero initial attack. They sound very different, but clicks can be heard either way. Measurements could be done on the real output of a hammond to scale the contribution of the sine waves in a more realistic way. The audio click method could sound right by tweaking the initial attack value. Chorus/Vibrato The sequence of cycling through the chorus and vibrato can be heard in the folder Chapter_5 under the name Chorus_Vibrato.wav The effects are with respect to time C1, V1, C2, V2, C3, V3. Measurements could be done on a real organ to bring the chorus and vibrato parameters closer to the original ones. Leslie The Leslie is output in mono and can be heard in the folder Chapter_5 under the name LESLIE.wav The effect sounds decent when considering that there is no reverb applied yet. Complex reflections from the room and the cabinet could be applied when computational power is available, giving rise to a more pleasing sound.
53
5. Results
5.2.3. Additional Sound Files Additional sound files are: CHORD.wav and CHORD_SWEEP.wav
54
Chapter
6
Conclusion and Future Work This chapter summerizes the conclusions drawn from this project. The two minimoog implementations are discussed first. Conclusions from the Hammond are discussed next.
6.1. Minimoog Although the minimoog prototype is playable and sounds close to the original analog version, some improvements can be made: • Improving the filter model • Introduce polyphony • Scaling routing coefficients for a closer imitation • White noise should be made whiter • Pink noise should be made less pink • Extending MIDI functionality • Adding a more musical, performance base interface
6.1.1. ASIC versus DSP Synth on Chip systems are not very common. Usually virtual analog synthesizers use one or more DSPs. Another possibility is a mixed design: specific Integrated Circuit (IC)s are like the CEM and SSM encompass only specific synthesizer functionality. This way companies have more flexibility with respect to routing. The economic feasability of ASIC Synth on Chips is also doubtable, eventhough the number of electronic musicians rises steadily. From our results, the DSP oscillators sounded reasonably close to the Mini V. Post-filtering could be useful in oversampled systems, but with our 48kHz sampling frequency, a lot of spectral richness disappeared.
55
6. Conclusion and Future Work
6.2. Hammond Generating a lot of sine waves on one chip is definitely a challenge. In the design at the moment of writing, only 25 notes polyphony was reached, resulting in 55 sine waves. 61 note polyphone, or five octaves an an extra C, require 91 sine waves. Over one half is reached. The following method might be promising to improve this number. Halving the sine wave number by exploiting harmonic relations could be done: One phase could be input to the sine wave function. This phase gets multiplied by 2 and this phase plus the original one are used to calculate two output values which is stored in the program memory. Back in the sine wave generation funtion, the gains can be extracted from the data memory at the same time as the sine values. This method could save some overhead on calling functions and memory reads and writes. The Hammond prototype needs following improvements: • The MIDI interface fails in the polyphonic implementation, this needs to be fixed • Adding reverberation to the Leslie effect for a more realistic result • modelling the inertia of the Leslie speaker when switching from fast mode to slow mode • Scaling the chorus/vibrato intensities to reach a closer sound to the original Hammond • Increase polyphony • User Interface with drawbars could be added • Keyclick intensity should be scaled by considering the original sound of this imperfection • Saturation of the output amplifier can be added for a warmer sound The result sound like an organ and the effects are recognisable. Improving the sound by using multiple DSPs is definitely benificial. Especially for improving the realism of the Leslie speaker and keeping polyphony reasonably high, these functions could be devided on two DSPs. Another possible way to get this amount of polyphony is by using a FPGA, like the HOAX system [19].
6.3. Final word When plenty of resources are available, going all out on them by modelling the smallest details can result in a very close copy of the original [41]. This article relates the modelling of analog hardware to the research performed at European Organisation for Nuclear Research (CERN) in the field of modelling the stochastic behaviours of fundamental particles. Diving that deep in physics can result in very accurate sounds at the cost of heaps of computational power. Still, true analog synthesizers are increasing in popularity and reissues of old models, like the Korg MS-20, are being released. Furthermore, cost of the old legends aside, a musician will always choose the original analog version over a perfect digital emulation. Even if that means dealing with extreme weights, pitch instability that can not be turned off, constant maintenance and no extra functionalities at all.
56
Appendix
A
Task Description
57
Institut für Integrierte Systeme Integrated Systems Laboratory
Master Thesis at the Department of Information Technology and Electrical Engineering Spring Term 2013
Thomas De Cnudde
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound
Advisor: Norbert Felber, ETZ J84, 044 632 5242,
[email protected] Co-Advisor: Michael Schaffner, ETZ J69.2, 044 632 6556,
[email protected]
Issue: Deadline:
18.02.2013 17.08.2013
The written report is to be handed in as pdf file latest at the deadline.
Task description for the Master Project of Thomas De Cnudde Introduction Analog synthesizers, e.g. the famous Moog Music Inc, offer a multitude of electronic units with knobs for choosing the parameters, which are connected together by means of cables to design the signal flow. The basic units are oscillators, filters and amplifiers – all voltagecontrolled – which serve to synthesize the tones. As an example, one oscillator generates the fundamental frequency and strong harmonics. Filters attenuate or amplify certain harmonics. A second oscillator slightly varies the frequency of the first one to realize a vibrato. In response to a key activation, more filters generate attack, sustain and decay waveforms, which again control the gain of an amplifier that modulates the fundamental and filtered harmonics. For this project, the electronic units exist in form of a digital ASIC designed by students at the IIS. The ASIC contains also a switch matrix for the low-level interconnections responsible for generating a voice. The available PCB accepts up to 8 ASICs that are connected to a digital signal processor (ADSP-21369) which has access to the parameters and collects the audio outputs. Tasks In this Master Thesis the following tasks are to be performed: 1. Concept for the synthesizer operation (user interface and functions) This is the main challenge of the project: Specification of an intuitively-to-use, real-time applicable “configure and play” interface. The knobs and cables of the original synthesizers are to be realized in a modern form. This could be a PCB with encoders, switches and a display, or a Laptop or a Pad. The DSP board is capable of multichannel reproduction (8 analog and 8 digital outputs). Make use of this capability! 2. MIDI keyboard interface Realization of the MIDI interface hardware based on the UARTs in the DSP and a “driver” for the DSP. 3. Realization of the user interface Depending on 1., a PCB is designed and/or the communication with a computer is set up. “Drivers” are developed. 4. Code for the synthesizer operation Depending on 1., software for the DSP or for both the computer and the DSP is developed. 5. Characterization by measurements The ASICs for this synthesizer have been designed such as to avoid aliasing artifacts that typically are responsible for the minor quality of digital sound reproduction compared to analog sources. The “analog” quality of the synthesizer is verified first by measurements. 6. Characterization by listening Verification of the “analog” quality additionally requires listening tests since measurements cannot deal with the extremely complex sound of real music. Suitable compositions are to be played (if possible also on an analog synthesizer) and recorded. Hearing tests shall confirm the good quality of the reproduction. 7. Practical test use and enhancements After having “worked” with the synthesizer, qualify its ease of use. Remove weaknesses before completing the project.
8. Demonstration Record a multichannel DVD-audio (and a stereo CD?) with some attractive compositions that demonstrate the synthesizer’s abilities. The project is to be discussed with the advisors in regular meetings. A written report (as pdf) is due prior to the deadline. In a 20 minutes talk, the project is to be presented after conclusion. 14-Feb-2013, Norbert Felber
Appendix
B
Declaration of Authorship
61
B. Declaration of Authorship
62
Appendix
C
Programming the ASIC C.1. Programming the ASICs The connections for the configurations are made in the configRam. Table C.1 and table C.2 show respectively the source and targer adresses. The entries of the configRamneed to be listed with increasing target address. cccccccc is a amplification coefficient between -100% and +100%. XX are don’t cares. ssssss for the source addresses ttttt for the target addresses. aaaaaa holds the number of the entry for the tt configRam SrcAddr 0 1 2 3 4 5 6 7 8 9 10 11 12
Signal VCO1 Sawtooth VCO1 Pulse VCO1 Triangle VCO2 Sawtooth VCO2 Pulse VCO2 Triangle VCO3 Sawtooth VCO3 Pulse VCO3 Triangle VCO4 Sawtooth VCO4 Pulse VCO4 Triangle VCF1 LP
SrcAddr 13 14 15 16 17 18 19 20 21 22 23 24 25
Signal VCF1 HP VCF1 BP VCF2 LP VCF2 HP VCF2 BP VCF3 LP VCF4 LP ADSR1 ADSR2 ADSR3 ADSR4 VCA1 VCA2
SrcAddr 26 27 28 29 30 31 32 33 34 35 36 37 38
Signal VCA3 VCA4 nonexistent nonexistent nonexistent I2 s ext L I2 s ext R I2 s casc L I2 s casc R VoiceReg[0] VoiceReg[1] VoiceReg[2] VoiceReg[3]
Table C.1.: Source Adresses The parameters for the VCOs and VCFs can be written in the offsetReg. They share the same addres as their target address. The ADSR curves have their dedicated registers and are listed in C.4. Table C.5 shows the accepted dataformat for this adsrReg. The gatesignal has following dataformat: 1
f Für f = 440Hz: data = log2 24k + 27 · 256 = 5435[dec] =X1010100 111011XX [bin] und für P W = 50%: 15 data = 2 (2 · P W ) = 32768[dec] = 10000000 00000000 [bin]
63
C. Programming the ASIC TrgAddr 0 1 2 3 4 5 6 7 8 9
Signal VCO1 Freq VCO1 PW VCO2 Freq VC2 PW VCO3 Freq VC3 PW VCO4 Freq VCO4 PW VCF1 Freq VCF1 Xi
TrgAddr 10 11 12 13 14 15 16 17 18 19
Signal VCF2 Freq VCF2 Xi VCF3 Freq VCF3 Xi VCF4 Freq VCF4 Xi VCF1 In VCF2 In VCF3 In VCF3 In
TrgAddr 20 21 22 23 24 25 26 27 28 29
Signal VCA1 In A VCA1 In B VCA2 In A VCA2 In B VCA3 In A VCA3 In B VCA4 In A VCA4 In B I2 s out L I2 s out R
Table C.2.: Target Adresses
Freq PW Xi
MSB
LSB <0> <13 bit data> <16 bit data> <0> <15 bit data>
Interval 256 - 6911 -32767 - 32767 0 - 32767
Interpretation 1 data f = 2 256 −27 · 24kHz P W = (data + 215 )/216 Xi = data · 2−15
Table C.3.: offsetReg Dataformat Addr 0 1 2 3 4 5 6 7
Parameter ADSR1 A ADSR1 D ADSR1 S ADSR1 R ADSR2 A ADSR2 D ADSR2 S ADSR2 R
Addr 8 9 10 11 12 13 14 15
Parameter ADSR3 A ADSR3 D ADSR3 S ADSR3 R ADSR4 A ADSR4 D ADSR4 S ADSR4 R
Table C.4.: adsrReg Parameter Adresses
A, D ,R S
MSB LSB <13 bit data> <16 bit data>
Interval 256 - 6911 0 - 65535
Interpretation data f = 2 256 −27 · 24kHz S = data/216
Table C.5.: adsrReg Dataformate MSB LSB The envelopes get multiplied by 0 or 1. The synthesizer chip is configured over an 8-bit port. One instruction is consists of 4 bytes. The format is listed in C.6.
C.2. ASIC Anomalies Two anomalies in the behaviour were found. • The I2 s out R only outputs the first routed component
64
C. Programming the ASIC Register configRam offsetReg adsrReg gate voiceReg
Byte 1 00aaaaaa 010Xaaaa 011Xaaaa 100XXXXX 110XXXaa
Byte 2 XXssssss XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
Byte 3 cccccccc dddddddd dddddddd XXXXXXXX dddddddd
Byte 4 cccttttt dddddddd dddddddd XXXXdddd dddddddd
Table C.6.: Register format for the instruction • The IIR filter transfer funtion has no direct path
65
Bibliography
[1] J. Pekonen, T. Pihlajamäki, and V. Välimäki, Computationally Efficient Hammond Organ Synthesis. Proc. of the 12th International Conference on Digital Audio Effects, 2011. [2] L. S. Aksu, Chorus Effect Through Audio DSP. University of Utah, 2006-2007. [3] J. Pekonen, V. Lazzarini, J. Timoney, J. Kleimola, and V. Välimäki, Discrete-Time Modelling of the Moog Sawtooth Oscillator Waveform. EURASIP Journal on Advances in Signal Processing, 2011. [4] AD, SHARC Processor ADSP-21367/ASDP-21368/ADSP-21369 Data Sheet (Rev. A), Analog Devices, 2006. [5] ADSP-21368 SHARC Processor Hardware Reference, Analog Devices, 2006. [6] ADSP-2136x SHARC Processor Programming Reference, Analog Devices, 2007. [7] A. Looser, A. Gysi, and D. Christen, Virtual Analog Synthesizer, 2005/2006. [8] A. Romer, Realisierung eines Virtual Analog Synthesizer, 2011. [9] M. Russ, Sound Synthesis and Sampling. Focal Press, 2009. [10] C. C. Peters, “Moog minimoog,” 2010, [Online; accessed 17-August-2013]. [Online]. Available: http://www.cchrispeters.com/SynthesizerGallery/MoogMiniMoog.htm [11] “Introducing the mini moog model d,” 2006, [Online; accessed 17-August-2013]. [Online]. Available: http://www.wendycarloscom/other/PDF-Files/IntroMiniMoog*.pdf [12] “Minimoog glide question — moog music forum,” 2011, [Online; accessed 17-August-2013]. [Online]. Available: http://forum.moogmusic.com/viewtopic.php?f=1&t=12376 [13] “Moog minimoog — vintage synth explorer,” 2010, [Online; accessed 17-August-2013]. [Online]. Available: http://www.vintagesynth.com/moog/moog.php [14] “Synthesizing tonewheel organs — sound on sound,” 2003, [Online; accessed 17August-2013]. [Online]. Available: http://www.soundonsound.com/sos/nov03/articles/ synthsecrets.htm [15] “Drawbars — hammond wiki,” 20013, [Online; accessed 17-August-2013]. [Online]. Available: http://www.dairiki.org/HammondWiki/Drawbars [16] “The hammond organ — electric druid,” 2006, [Online; accessed 17-August-2013]. [Online]. Available: http://www.electricdruid.net/index.php?page=info.hammond
66
Bibliography [17] “Synthesizing hammond organ effects: Part 1 — sound on sound,” 2004, [Online; accessed 17-August-2013]. [Online]. Available: http://www.soundonsound.com/sos/jan04/articles/ synthsecrets.htm [18] “Synthesizing hammond organ effects: Part 2 — sound on sound,” 2004, [Online; accessed 17-August-2013]. [Online]. Available: http://www.soundonsound.com/sos/feb04/articles/ synthsecrets.htm [19] “Hoax/hx3,” 2013, [Online; accessed 17-August-2013]. [Online]. Available: //www.keyboardpartner.de/hammond/hoax_en.htm
http:
[20] V. Välimäki and A. Huovilainen, Antialiasing Oscillators in Subtractive Synthesis. Signal Processing Magazine, 2007.
IEEE
[21] V. Välimäki, J. Nam, J. O. Smith, and J. S. Abel, Alias-suppressed Oscillators Based on Differentiated Polynomial Waveforms. IEEE Transactions on audio, speech, and language processing, vol.18, no.4, 2010. [22] J. Kleimola, V. Lazzarini, J. Timoney, and V. Välimäki, Vector Phaseshaping Synthesis. Proc. of the 14th International Conference on Digital Audio Effects, 2011. [23] ——, Alias-suppressed Oscillators Based on Differentiated Polynomial Waveforms. Transactions on audio, speech, and language processing, vol.18, no.4, 2010.
IEEE
[24] V. Lazzarini and J. Timoney, New Perspectives on Distortion Synthesis for Virtual Analog Oscillators. Computer Music Journal, 34:1, pp. 28-40, 2010. [25] J. Pekonen, V. Välimäki, J. Nam, J. Smith, and J. S. Abel, Variable Fractional Delay Filters in Bandlimited Oscillator Algorithms for Music Synthesis. CCRMA Music Department, Stanford University, 2010. [26] T. Stilson and J. Smith, Alias-Free Digital Synthesis of Classic Analog Waveforms. CCRMA Music Department, Stanford University, 2006. [27] ——, Analyzing the Moog VCF with Considerations for Digital Implementation. CCRMA Music Department, Stanford University, 2006. [28] F. Fontana, Preserving the Structure of the Moog VCF in the Digital Domain. di Verona.
Universita
[29] V. Zavalishin, The Art of VA Filter Design, 2012. [30] T. Helie, Volterra Series and State Transformation for Real-Time Simulations of Audio Circuits Including Saturations: Application to the Moog Ladder Filter. IEEE Transactions on Audio, Speech, and Language Processing, vol. 18, no. 4, 2010. [31] A. Huovilainen, Non-Linear Digital Implementation of the Moog Ladder Filter. the 7th International Conference on Digital Audio Effects, 2004.
Proc. of
[32] D. Marshall, Digital Audio Effects. Cardiff University, 201. [33] P. D. Lehrman and T. Tully, MIDI for the Professional. Music Sales America, 1993. [34] “Gates and triggers, mystery solves — synthesizers.com,” 2000, [Online; accessed 17-August-2013]. [Online]. Available: http://www.synthesizers.com/gates/html [35] MIDI 1.0 Detailed Specification, Document Version 4.2, The MIDI Manufacturers Association, 1995.
67
Bibliography [36] “Midi electrical specification diagram — midi manufacturers association,” 2010, [Online; accessed 17-August-2013]. [Online]. Available: http://www.midi.org/techspecs/electrispec. php [37] High Speed Optocoupler, 1 MBd, Photodiode with Transistor Output, Vishay Semiconductors, 2011. [38] MC74AC04, MC74ACT04 Hex Inverter, Motorola. [39] “Synth secrets part 7: Envelopes, gates and triggers — sound on sound,” 1999, [Online; accessed 17-August-2013]. [Online]. Available: http://www.soundonsound.com/sos/nov99/ articles/synthsecrets.htm [40] “Arturia miniv,” 2012, [Online; accessed 17-August-2013]. [Online]. Available: //www.arturia.com/evolution/en/products/minimoogv/intro.html
http:
[41] “Plug-in modelling,” 2010, [Online; accessed 17-August-2013]. [Online]. Available: http://www.soundonsound.com/sos/aug10/articles/modelling-plugins.htm
68
Emulating Analog Synthesizers by Digital Signal Processing: Design of the Synthesizer Engine and Characterization of the Sound Thomas De Cnudde
Promotoren: prof. dr. ir. Jean-Pierre Martens, dhr. Hubert Kaeslin Masterproef ingediend tot het behalen van de academische graad van Master in de ingenieurswetenschappen: elektrotechniek
Vakgroep Elektronica en Informatiesystemen Voorzitter: prof. dr. ir. Jan Van Campenhout Faculteit Ingenieurswetenschappen en Architectuur Academiejaar 2012-2013