A sample plugin o digi al
audio wo ks a ions
T abajo de Fin de G ado en Ingenie ´ıa In o m´a ica
Juan Chozas Sumbe a
Di igido po
Jaime S´anchez He n´andez
Miguel G´omez-Zamalloa Gil
UNIVERSIDAD COMPLUTENSE DE MADRID
FACULTAD DE INFORM ´
ATICA
1
Abs ac
Music p oduc ion is a anyone’s each. Nowadays, compu e s, sma -
phones and able s a e able o un so wa e ha p o ides he necessa y ools
o compose music. Digi al Audio Wo ks a ions (DAWs) a e ound a he
mo e sophis ica ed end o he spec um. These ea u e-packed p og ams a e
he ype ha you would ind in loca ions anging om he aspi ing musi-
cian’s pe sonal compu e o he mos p o essional eco ding s udio in you
ci y. One o he mos powe ul cha ac e is ics o hese en i onmen s is being
ex ensible ia plugins.
The sampling echniques ha eme ged du ing he end o he 20 h cen-
u y gi ed he wo ld wi h new me hods o music p oduc ion. This p ojec
allows o he c ea ion o an ins umen ha e ol es a ound he echnique
o spli ing o audio eco dings. Use s will be able o easily ans o m egions
o an audio sample in o sounds he ins umen can play. The na u e o he
p ocess is a om complex and can be s eamlined o p o ide a as way o
design a bespoke sample-based ins umen . By implemen ing his ool as a
plugin, he ins umen akes he o m o a loadable module ha is eadily
accessible o anybody wo king on a DAW.
Key wo ds
music, sound, sample , sampling, ins umen , MIDI, DAW, plugin, VST,
syn hesize
2
Resumen
Cualquie pe sona iene a su alcance la p oducci´on musical. El mundo en
el que i imos es a plagado de disposi i os capaces de ejecu a un so wa e
que p opo ciona las he amien as necesa ias pa a compone m´usica. Las
es aciones de audio digi al son los p og amas que o ecen la mayo gama
de he amien as pa a la c eaci´on de m´usica. Es el ipo de so wa e que no
puede al a en los o denado es de los m´usicos p incipian es ni de los es udios
de g abaci´on m´as so is icados. Una de las ca ac e ´ıs icas m´as pode osas de
es os en o nos es la capacidad de se en iquecidos median e m´odulos ex e nos
(plugins).
A inales del siglo XX su gie on nue as ´ecnicas de mues eo, nue as
mane as de p oduci m´usica u ilizando g abaciones de sonido. Es e p oyec o
pe mi e c ea un ins umen o bas´andose en la ´ecnica de desmenuza una
g abaci´on de sonido. Los usua ios pod ´an ans o ma ´acilmen e egiones de
la mues a en sonidos ep oducibles po el ins umen o. El p oceso es sencillo
po na u aleza y se puede implemen a de o ma e icien e pa a hace un
p oceso sin demo as innecesa ias del dise˜no pe sonalizado de un ins umen o
basado en mues as. La implemen aci´on en o ma de plugin hace que el
ins umen o sea accesible pa a odo el que abaje con una es aci´on de audio
digi al.
Palab as cla e
m´usica, sonido, mues a, mues eo, ins umen o, MIDI, DAW, plugin, VST,
sin e izado
3
Con en s
1 In oduc ion 5
1.1 Backg ound ............................ 5
1.1.1 Sample his o y . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Pulse-Code Modula ion . . . . . . . . . . . . . . . . . . 6
1.1.3 Mode n music p oduc ion . . . . . . . . . . . . . . . . 6
1.1.4 Sampling echnique . . . . . . . . . . . . . . . . . . . . 9
1.2 Mo i a ion............................. 12
1.3 Objec i es............................. 13
2 Plugin use manual 15
2.1 Ins alla ion ............................ 15
2.2 Con igu a ion ........................... 15
2.3 Basicusage ............................ 17
2.4 Chopc ea ion........................... 17
3 Implemen a ion 20
3.1 Technologies............................ 20
3.2 Audio sample p e iew . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Chopping he main sample . . . . . . . . . . . . . . . . . . . . 24
3.3.1 Manual c ea ion . . . . . . . . . . . . . . . . . . . . . . 25
3.3.2 Peak de ec ion . . . . . . . . . . . . . . . . . . . . . . 26
3.4 Subsec ion managemen . . . . . . . . . . . . . . . . . . . . . 27
3.5 Audioplayback .......................... 29
4 Conclusions and u u e wo k 31
4.1 Conclusions ............................ 31
4.2 Fu u ewo k............................ 32
5 Conclusiones y abajo a u u o 33
5.1 Conclusiones............................ 33
5.2 T abajoa u u o ......................... 34
Bibliog aphy 35
4
Chap e 1
In oduc ion
This chap e aims o p o ide an o e iew o he o igins o he echnique o
sampling and he echnologies ha make i possible. A undown o mode n
music p oduc ion is also included, explo ing he ea u es ha jus i y he
widesp ead use o digi al audio wo ks a ions.
1.1 Backg ound
1.1.1 Sample his o y
The echnique o sampling da es back o he 1960s when eco dings we e cap-
u ed on ape. Thanks o a ha dwa e design ha made con ac be ween he
playback head and di e en sec ions o a mo ing ape, musicians could play
he dis inc eco dings on keyboa ds o ins umen s such as he Mello on
[8]. Du ing he 1980s, he popula i y o d um machines inc eased signi i-
can ly. Many o hem we e sample-based, i.e. hey c ea ed sounds using
digi ally s o ed samples, whe eas he al e na i e was o syn hesize sound in
an analog ashion. This could be due o some sounds ( he mo e ha monic
ype, in pa icula ), being mo e success ully p oducible by syn hesis han
o he s, namely pe cussi e sounds. Sampling o e ed a way o make na u ally
sounding hy hmic sec ions which syn hesis could no .
In 1988, he i s Music P oduc ion Cen e (MPC) by Akai [1] was made
a ailable o he public: a sample-based music wo ks a ion ha was capable
o a anging samples o all leng hs in i s sequence o p oduce ull ledged
music acks wi hou he need o addi ional ins umen s o ha dwa e. In
a ecipe o music, an MPC could be he only ing edien , eaching a as
numbe o musicians because o i s a o dabili y in compa ison o p e ious
means o music p oduc ion. I is a ool ha ga e a is s a new way o c ea e
5
music, a echnique ha has been a ounda ion o se e al gen es and highly
in luen ial o music as a whole.
1.1.2 Pulse-Code Modula ion
Figu e 1.1: Linea pulse-code modula ion a 4 bi dep h.
The me hod ha makes sampling a possibili y is Pulse-Code Modula ion
(PCM o sho ). Da ing back o he 1930s, i consis s o he digi al ep e-
sen a ion o analog signals, and is subjec o wo pa ame e s: sampling a e
and bi dep h. This echnique p ocesses an inpu analog signal by making
eadings o ol age le els a ixed ime in e als and ans o ming hem in o
nume ic alues. Commonly e e ed o as samples, hese eadings a e wha
he esul ing digi al ep esen a ion will be composed o . The sampling a e
e e s o how o en samples will be ead om he analog signal, and he bi
dep h indica es he amoun o bi s wi h dedica ed o he s o age o each sam-
ple. E e y ime an analog eading is being con e ed in o a digi al sample,
i is ounded o he nea es in ege alue in he ange de e mined by he bi
dep h. This ounding p ocess, isible in Figu e 1.1 [7] is known as quan i-
za ion. Since samples a e encoded o in ege s in bina y, he le els o which
hey can be quan ized a e uni o mly dis ibu ed. This desc ibes he me hod
o Linea PCM (LPCM), a sub-me hod o PCM ha is used o audio CDs
and he popula o ma s WAVE and AIFF, among o he applica ions.
1.1.3 Mode n music p oduc ion
In a wo ld o highly complex in o ma ion sys ems, digi al music p oduc ion
has been de eloped ho oughly. When i comes o mode n music composi-
ion, Musical Ins umen Digi al In e ace (MIDI om now on) [9] p o ocol
6
p o ides g ounds o an al e na i e o egula , ”analog” ins umen s. This
s anda d e ec s a b idge o communica ion be ween digi al ins umen s and
compu e s, p o iding he wo ld o digi al music p oduc ion wi h he angible
in e aces o no mal ins umen s. The MIDI s anda d p o ides, among many
o he ea u es, a communica ions p o ocol ha encodes music e en s. This
mani es s in he o m o messages which desc ibe da a such as he p essing,
eleasing, and eloci y o musical no es.
A digi al audio wo ks a ion (DAW om he e on ou ) is a so wa e en-
i onmen o music p oduc ion. These wo ks a ions e ol e a ound MIDI,
which p o ides an encoded language o musical no es. Table 1.1 shows he
co espondence be ween musical no es and hei equi alen nume ical alue
as a MIDI no e. No e- ela ed MIDI messages always s o e da a ega ding
he no e subjec o he e en .
Alphabe ical no e MIDI no e numbe
C3 48
C#3 49
D3 50
D#3 51
E3 52
F3 53
F#3 54
G3 55
G#3 56
A3 57
A#3 58
B3 59
Table 1.1: Musical no es and hei MIDI equi alen
One can ha e an ex ensi e ange o digi al syn hesize s, sample s, and
e ec chains all wo king simul aneously in a DAW, he ype o so wa e ha
p o ides a playg ound ha ou es audio be ween acks o componen s and
e ec s, making music p oduc ion a possibili y o anyone ha owns a com-
pu e . DAWs ha e an elemen known as a piano oll, which se es as a so
o digi al equi alen o shee music. The piano oll is whe e p oduce s d aw
ou musical e en s, placing small ec angles on a g id o ep esen he no es,
hei leng h, and hei du a ion. The a angemen s o e en s a e hen en-
capsula ed in wha a e called clips o pa e ns. Reape ’s MIDI clip edi o
is pic u ed in Figu e 1.2, con aining a i e no e pa e n isible in he piano
oll. These pa e ns can be applied o ins umen s, such as syn hesize s, o
7
Figu e 1.2: A piano oll in a MIDI clip edi o .
sample s, o igge he sounds hey p oduce. Pa e ns can be d awn ou
manually, au o gene a ed, eco ded in eal ime wi h a MIDI con olle , and
loaded om iles. Au o gene a ed pa e ns may consis in illing a se leng h
o ime wi h no es sepa a ed by cons an in e als, so as o mimic he iming
o a me onome, o example. Pa e ns ha a e eco ded in eal ime a e
made wi h he DAWs eco ding unc ion, which is ac i a ed o eco d MIDI
e en s om a con olle .
When eco ding pa e ns, incoming MIDI e en s a e imes amped o hen
be displayed in ch onological o de and esemble he ansla ion o he use ’s
inpu . A use may ha e an ins umen loaded du ing his eco ding pe iod,
so he use can hea wha sounds a e being p oduced. I is impo an o
highligh wha is cap u ed by he DAW is a sequence o MIDI e en s, no
he ac ual sounds being p oduced by he ins umen , meaning ha a pa e n
is jus a sequence o da a, oid o sound un il an ins umen ha can p ocess
he e en s is associa ed o i . Mo e so, since pa e ns a e composed o MIDI
e en s mean o igge esponses om ins umen s, he e is no binding be-
ween hem and ins umen s, and a pa e n made o one ins umen can
pe ec ly be used o ano he .
The mos ele an e en s associa ed o he pa e n building p ocess a e:
no e-on e en s, he signal ha a no e has been p essed; no e-o e en s, he
signal ha a no e has been eleased. The sub ac ion o he imes amps
8
associa ed o hese wo e en s de e mines how long a no e is held down. A
musical no e is associa ed o no e-on and no e-o e en s, ha ing he no e
and oc a e being encoded as an in ege in he ange o [0,128). In addi ion,
associa ed o no e-on e en s is an elemen called eloci y, which is a measu e
o he in ensi y o he no e. The eloci y o a no e is some imes p ocessed by
ins umen s o gene a e so e o s onge sounds. Some sample s use no e
eloci y o igge a sample om a se , i.e. a lowe in ensi y eco ding o a
sna e d um o lowe eloci ies as opposed o a sample o a powe ul sna e
d um hi when he eloci y is a highe ange.
DAWs can be ex ended wi h plugins in he o m o e ec s o ins u-
men s. The o me no mally ha e a sound-based inpu -ou pu ela ion wi h
he DAW, meanwhile ins umen s will ake MIDI messages and p oduce a
sound as an ou pu . The mos common s anda d o plugins is Vi ual S udio
Technology (VST) [16], c ea ed by a ge man company called S einbe g. VST
plugins ha e mul i pla o m suppo on majo ope a ing sys ems, howe e ,
plugins mus be expo ed o a a ge ope a ing sys em, i.e. a VST plugin
ha is expo ed o Windows will no wo k on Mac OS o Linux. VST in-
s umen plugins a e known as VSTi plugins in sho . An example o a VSTi
could be a sine wa e based ins umen : The wa e’s equency will depend
on he key being p essed, and he o ce applied o he key will dic a e he
ampli ude o he wa e. This plugin, al hough simple, would be conside ed a
syn hesize .
A sample is a syn hesize ha uses samples a he han oscilla o s o
p oduce sound. The sou ces o he sounds i p oduces a e samples, which
can be desc ibed as clips o audio ha a e s o ed in a digi al o ma wi hin he
sample ’s memo y. You’ e likely o ind ha ha dwa e and so wa e sample s
o e se s o ”s ock” samples ha a e loaded by de aul . The op ion o load
samples om an ex e nal sou ce such as an SD ca d is also common, jus like
eco ding ex e nal inpu om a eco ding de ice such as a mic ophone. As
is he case wi h non sample-based syn hesize s, he e a e a a ie y o ways
ha samples can be manipula ed in o de o weak he p oduced sound o
he use ’s liking
1.1.4 Sampling echnique
The key concep o sampling echniques is o modi y and manipula e audio
samples o c ea e sounds. Many ypes o ans o ma ions can be applied o
samples in o de o d as ically change he way hey sound, al hough p oduc s
ha sound a di e en o he sou ce sample a e no always he objec i e.
A sample can be manipula ed by delimi ing subsec ions wi hin i , so as o
c ea e sepa a ed sub-samples ha can be ea ed as indi idual no es. This
9
Figu e 2.1: MIDI de ices p e e ences.
Figu e 2.2: An enabled MIDI con olle .
appea as shown on Figu e 2.3. I i isn’ shown, make su e Sample . s 3
exis s in he di ec o y C: P og am Files Common Files VST3 and e esh
he lis unde FX →Scan o new plugins. P ess OK o load he sample
on o he ins umen ack, and a new window will pop up wi h he a blank
plugin.
16
Figu e 2.3: Selec ing he plugin in he i ual ins umen dialog.
2.3 Basic usage
S a by loading a WAVE ile as he main audio sample wi h he Load bu on
on he op le co ne . The wa e o m ep esen a ion o he ile will be isible
in he humbnail. The slide o he igh o he humbnail is a con ol o he
humbnail’s scale, while he slide benea h is o ho izon al sc olling when
he scale is la ge han he humbnail’s bounda ies. The p e iew’s playback
can be con olled wi h he Play,Pause, and S op bu ons on he panel o
he le .
The ba loca ed abo e he humbnail holds a Posi ion label, which indi-
ca es he posi ion o he playback head o he audio p e iew. This posi ion is
also ele an o he manual c ea ion o subsec ions. Playback can be looped
in he ull bounda ies o he audio ile wi h he Toggle Full Loop bu on.
The playback posi ion can be manually posi ioned by clicking on any pa
o he humbnail, and a selec ion can be made i a click is d agged ac oss
he desi ed a ea. A e making a selec ion, you can loop he audio p e iew
wi hin he selec ion’s bounda ies wi h he Toggle Loop Selec ion bu on.
2.4 Chop c ea ion
Chop c ea ion can happen in wo di e en ways:
Manual chopping
The wo bu ons loca ed abo e he humbnail on he op igh co ne o he
plugin c ea e chops. The i s , Chop F om He e will use he egion be ween
he cu en posi ion and he end o he sample o c ea e a chop. The second
op ion will only be a ailable i a selec ion is exis s in he humbnail, and i
will c ea e a chop wi h bounda ies equal o hose o he selec ion.
17
Au oma ic chopping
I you audio clip has no iceable peaks, whe e he le el o sound changes
no ably and wi hin a sho ime ame, hen au oma ic chopping p o ides
a as way o spli he sample in o egions sepa a ed by sha p peaks. Fo
example, samples o pe cussi e elemen s such as d ums con ain spikes in
sound ha p o ide an e ec i e way o spli he sample. The Chop bu on
will c ea e as many chops as chops a e de ec ed. This numbe will di e
depending on he con igu a ion o he de ec ion mode and h eshold, which
can be modi ied wi h he bu on and slide . The changes made o hese wo
op ions will be e lec ed in he label placed unde hem, which indica es how
many chops a e de ec ed wi h he cu en con igu a ion.
Figu e 2.4: Reassigning igge no es wi h MIDI Lea n.
A e chopping he sample, he able unde he humbnail will display he
de ails o each chop. T igge no es can be changed om he las column
in he able, o by p essing a no e on you con olle wi h he MIDI Lea n
unc ion. To do his, selec a chop om he able by clicking on i and p ess
he MIDI Lea n bu on loca ed unde he able. As shown in Figu e 2.4, a
label ha eads P ess New T igge No e will be displayed, and he igge
no e will be upda ed o he nex no e you p ess on he con olle .
A chop can be selec ed o u he edi ing wi h a simple le click on a
ow om he able, o you can sc oll h ough he chops wi h he a ows on
he op le pa o he lowes panel. The selec ed chop’s playback can be
weaked wi h he en elope pa ame e s in his lowe panel. Each pa ame e
will a ec he way he chop sounds o e ime. The pu pose o each pa ame e
18
is explained in sec ion 1.1.4. The ins umen ’s polyphony can be changed in
his panel as well: o allow o mo e han one chop o sound a he same
ime, change he Playback Mode on he op igh pa o he lowe panel o
POLY. When se o MONO, chops a e played exclusi ely, and he igge ing
o one chop will cu o he playback o any o he .
Using he plugin in Reape , he ins umen is now playable, and a se ies
o no es can be sequenced. You can y ou di e en combina ions o no es
o see he o de in which hey sound bes o you. To eco d you sequence,
p ess he ed Reco d bu on isible in Figu e 2.5. When eco ding, Reape
will sa e he MIDI no es you p ess in o a MIDI i em, which can be ound in
he playlis o he igh o he ins umen ack.
Figu e 2.5: Reco d bu on in Reape .
19
Chap e 3
Implemen a ion
This chap e will explo e he de ails behind he implemen a ion o he plu-
gin’s capabili ies, as well as he echnologies employed. The i s sec ion de-
sc ibes he JUCE amewo k, used o build he majo i y o he plugin. Also
included is he aubio lib a y, wi h i ’s peak de ec ion module, and al e na-
i es o he a o emen ioned echnologies. The emaining sec ions desc ibe
he way di e en unc ionali ies we e achie ed.
3.1 Technologies
JUCE amewo k
To implemen he sample , I used an applica ion amewo k called JUCE
[5]. I has c oss-pla o m suppo and is w i en in C++. We chose i because
i is ma u e p ojec ha is s ill g owing, and I am amilia and com o able
wi h C++. I is also open-sou ce and licensed o ee o pe sonal, non-
comme cial use. The amoun o documen a ion and u o ials a ailable online
was enough o con ince me ha I would need no hing else o implemen he
majo i y o he ins umen .
JUCE makes use o he objec o ien ed capabili ies o C++ o p esen a
wide a ay o classes and u ili ies. I o e s he building blocks o applica ion
de elopmen wi h a easonably gen le lea ning cu e ha disca ds he need
o ein en he wheel. These u ili ies help wi h asks ha ange om audio
playback, o e en d i en da a s uc u es, o he design o use in e aces.
Fu he mo e, he amewo k is in line wi h he e en -d i en pa adigm, which
makes he de elopmen o ac ion based applica ions a simple and e icien
ask. As s a ed, he documen a ion is as and he e a e nume ous desc ip i e
u o ials, such as he TableLis Box class u o ial [11] o he D aw audio
wa e o ms u o ial [4]. On op o ha , a he p og amme s disposal a e
20
mo e han 70 example applica ions ha showcase he se e al ea u es he
amewo k has o o e .
P ojuce
The P ojuce is JUCE’s c oss-pla o m applica ion ha allows o he c e-
a ion, managemen and con igu a ion o JUCE p ojec s. To enable de elop-
men on Linux, o example, one can add a Make ile expo e o hei p ojec .
The P ojuce will c ea e an a chi ec u e speci ic Make ile ha links ex e nal
lib a ies and builds he applica ion. The empla es o e ed om which o
s a new p ojec s include GUI Applica ion, Anima ed Applica ion, Console
Applica ion, Audio Applica ion, Audio Plugin, and S a ic Lib a y and Dy-
namic Lib a y. Each o hese a che ypes a e con igu able in dis inc ways,
and a e ini ialized o include he undamen al code inhe en o he na u e
o he applica ion. Fo Audio Plugin p ojec s, he P ojuce can expo se -
e al plugin o ma s, such ha one build p ocess compiles and expo s he
plugin o ma s ha he p ojec is con igu ed o build. The o ma s include
VST and S andalone Applica ion, among o he less ele an plugin o ma s.
Building a S andalone Applica ion allows o he usage o he plugin wi hou
he need o a DAW. Building VST plugins is only suppo ed on Windows,
which means ha o de elopmen on Linux, one can only es he build in
an isola ed, s andalone applica ion, oid o connec ions o a DAW.
The P ojuce ’s base audio plugin p ojec p o ides undamen al code con-
aining wo classes. The dicho omy encou ages he sepa a ion o he audio
p ocessing logic om he GUI side o he plugin. The PluginP ocesso , as he
name sugges s, is he audio p ocessing hea o he applica ion. This class
ex ends he AudioP ocesso class, a base class o audio p ocessing. This is
whe e asks such as MIDI connec ion managemen and audio ende ing ake
place. In addi ion, his class holds he da a model o he cu en con igu a-
ion as he plugin’s s a e, used o cons uc he he isual ep esen a ion o
he plugin, which is ebuil e e y ime i is es o ed om a minimized s a e.
The PluginEdi o ex ends om he AudioP ocesso Edi o class. I is he
objec ha builds he use in e ace and esponds o in e ac ion wi h g aphi-
cal elemen s. Unlike he AudioP ocesso class, which inhe i s om no o he ,
he AudioP ocesso Edi o class ex ends om he Componen class. This is
he base class o a wide ange o use in e ace objec s. The Componen
class has wo i ual unc ions ha a e o be o e idden by any class de-
i ed om i : pain (), he unc ion ha dic a es he on sc een layou o
he componen ; esized(), which con ains eac iona y logic o when he
componen is esized. Bo h unc ions a e callbacks, which means hey a e
in oked au oma ically upon igge ing e en s.
21
Aubio
The aubio lib a y is a se o ools designed o he ex ac ion o anno a ions
om audio signals [2]. Being an open sou ce lib a y w i en in C, i seemed
a pe ec ly sui able inclusion o he sample . One o he modules included
wi h he lib a y se es as a de ec o o peaks in audio iles. Sample chopping
is egula ly done a he beginning o no ably s ong sonic impac s, such as
d um sounds. The lib a y enables he au oma ic chopping p ocess o hese
cases, when he use wan s he subsec ion delimi e s o be placed exac ly
be o e peaks, so his is a ea u e ha is be o g ea bene i o he plugin.
Al e na i es
Fo he au oma ic c ea ion o audio egions, he amp [15] lib a y could
ha e been a iable al e na i e o aubio [2]. I p o ides an onse de ec ion
module [14] and uses C/C++ in e aces, so i has equal o e ings o aubio,
essen ially. A e ying aubio’s onse de ec ion module and success ully in-
eg a ing i wi hin he plugin, I decided o keep i and o go amp, as aubio
had a a ie y o di e en de ec ion me hods which seems o be su icien o
he pu pose o au oma ic sample spli ing.
Ano he possible implemen a ion could ha e been based on jVSTwRap-
pe [6]. This lib a y is based on Ja a o de elopmen o VST audio plugins.
I is open sou ce, which makes i sui able o he ask a hand, and based on
a language I am also com o able using. I is a smalle and younge p ojec ,
b inging up incon eniences such as he lack o ea u es and abundance in
compa ison o JUCE.
3.2 Audio sample p e iew
In ega d o he audio p e iew o he main sample, his sec ion desc ibes
he de ails o he implemen a ion ha make i possible o play he sample.
Also included a e he means wi h which a isual ep esen a ion o he audio
sample is achie ed.
The i s s ep in de eloping he sample consis ed in loading an audio ile.
Wi h he help o he D aw audio wa e o ms u o ial [4], he classes necessa y
o load and display a isual ep esen a ion o an audio ile we e quickly
iden i ied. I all begins wi h a FileChoose objec , used o c ea e a dialog box
ha selec s iles o olde s. One can limi he o ma s allowed o selec ion by
speci ying semicolon sepa a ed egula exp essions in i s cons uc o . Using
he s ing "*.wa " as he ilePa e nsAllowed pa ame e will only allow
use s o selec WAVE iles, o example. The class o e s se e al membe
unc ions named wi h ”b owseFo ” as a p e ix, and b owseFo FileToOpen()
22
opens a dialog box o selec a ile o opening, e u ning a boolean alue ha
indica es whe he he use selec ed a ile o no . In he o me case, he
FileChoose ’s ge Resul () unc ion will e u n he File objec ha was
selec ed.
The class ha would p o ide he isual ep esen a ion o he audio ile
is he AudioThumbnail class. I wo ks hand in hand wi h he AudioThumb-
nailCache class, which se es as a cache memo y o audio ile ep esen a-
ions. Toge he , hey s o e and show wa e o m ep esen a ions o audio iles.
I c ea ed a sepa a e class Sample Thumbnail o bundle he AudioThumb-
nail objec and i s ela ed objec s and unc ions in o a sepa a e componen .
Fo he humbnail iew o load he audio ile, I c ea ed a public unc ion
se File(cons File& ile) wi hin he Sample Thumbnail class. Wi hin
se File, he audio ile is loaded wi h he se Sou ce(FileInpu Sou ce*
newSou ce) unc ion o AudioThumbnail. The FileInpu Sou ce objec can
be c ea ed om he File ecei ed om he PluginEdi o by passing he ile as
he only pa ame e o he cons uc o o a FileInpu Sou ce objec . Wi h his
done, he AudioThumbnail will load he wa e o m ep esen a ion o use -
selec ed audio iles.
Audio playback is achie ed h ough he AudioT anspo Sou ce class, which
enables he audio p e iew o he main sample ha is loaded in he plugin. I
inhe i s om he AudioSou ce class, which is a base class ha enables con-
inuous audio playback. The AudioT anspo Sou ce is used because i imple-
men s can be posi ioned, played, paused, and s opped. These ea u es a e
use ul o p e iewing he ini ially loaded sample. Audio subsec ion playback
is handled di e en ly, and will be discussed la e on. The connec ion o audio
iles o he AudioT anspo Sou ce objec is achie ed ia AudioSou ce sub-
classes. In his case, an AudioFo ma Reade Sou ce. The p ocesso s o es an
ins ance o AudioFo ma Reade Sou ce in cu en AudioFileSou ce, and in
anspo Sou ce an ins ance o AudioT anspo Sou ce.AudioFo ma Read-
e Sou ce objec s ob ain s eams o sound om AudioFo ma Reade objec s,
which sou ce hei sound om audio ile s eams.
E e y ime a use opens a ile success ully, a unc ion ha akes he ile
as i s only pa ame e is execu ed. This unc ion will s op he AudioT ans-
po Sou ce om con inuing playback, and p oceed o change he sou ce. To
do his, a new AudioFo ma Reade objec is c ea ed o ile. This is done
h ough an AudioFo ma Manage objec , which is used o keep a lis o he
o ma s ha a e o be accep ed by he applica ion. I includes a me hod
called c ea eReade Fo (cons File& ile), which e u ns a poin e o
he AudioFo ma Reade ha is necessa y o he c ea ion o an AudioFo -
ma Reade Sou ce. I c ea eReade Fo ails, i e u ns a null poin e , so he
ollowing s eps a e only aken in cases whe e he poin e is no null. The
23
cu en AudioFileSou ce poin e is ese o he new eade sou ce, and he
anspo Sou ce’s new sou ce is se wi h se Sou ce.
All o hese ins ances and connec ions lead o a unc ional way o play audio,
howe e , he e s ill is he need o connec he anspo Sou ce’s in e ace
o GUI elemen s. The AudioT anspo Sou ce class ex ends ChangeB oad-
cas e , which allows o e en d i en eac i i y o he s a e o he anspo -
Sou ce objec . To aid in he p ocess, an enum T anspo S a e is decla ed
o include he s a es o S opping,S opped,S a ing,Playing,Pausing,
and Paused. Bu ons layed ou in he applica ion will change a p i a e
a iable T anspo S a e s a e o S a ing,S opping, and Pausing o
in oke anspo Sou ce.s a () o anspo Sou ce.s op(). By exe-
cu ing hese me hods o he anspo Sou ce, e e y objec ha ex ends
ChangeLis ene ha has been added o he anspo Sou ce’s lis o lis-
ene s will be no i ied o a change. This no i ica ion mani es s by in oking he
callback unc ion oid changeLis ene Callback (ChangeB oadcas e *
sou ce), which is a i ual unc ion ha mus be implemen ed by any class
ha ex ends ChangeLis ene . The plugin edi o ex ends his class and adds
i sel o he anspo Sou ce’s lis ene lis wi h he ollowing ins uc ion:
anspo Sou ce.addChangeLis ene ( his);. In he changeLis ene -
Callback unc ion, he sou ce o he e en is checked by compa ing e e ences
like so:
oid changeLis ene Callback (ChangeB oadcas e * sou ce) o e ide
{
i (sou ce == & anspo Sou ce)
{...
Inside he condi ional block, he anspo s a e is upda ed once mo e, and
he GUI is synch onized in acco dance o he nex anspo s a e, o ex-
ample, when S a ing, he s a e ansi ions o Playing, changing he play
bu on’s ex o ”Pause” and enabling he s op bu on.
3.3 Chopping he main sample
This sec ion desc ibes chops’ da a model and he ways hey can be c ea ed.
Chops a e modelled as a s uc and a e comp ised o en ields: an unique
iden i ie , he igge no e, and a boolean alue named hidden. The bound-
a ies o he chop a e s o ed in e ms o ime and in e ms o samples, esul ing
in wo ields o he chop’s s a and end imes, and ano he wo o he s a
and end samples. The igge no e is an in ege encoding he MIDI no e ha
is associa ed o he chop, and he hidden ield dic a es he chops’ isibili y
24
in he componen s ha display chops. The ou emaining ields s o e he
chop’s en elope pa ame e s: a ack, decay, sus ain and elease.
The s o age o hese ields is done ia he ValueT ee [13] class, which
is a ligh weigh da a s uc u e ha is capable o handling da a ypes o all
so s, s o ing a lis o p ope ies, sub ees, and e e ences o sha ed da a
con aine s. Using a s uc o w ap his da a s uc u e b ings he bene i o
ype and alidi y checks when c ea ing chops. The c ea ion o a chop wi h
his cons uc c ea es a ValueT ee objec , se ing he alues o p ope ies
ha esemble he ields p e iously desc ibed a e pe o ming some checks.
This ValueT ee can hen be added o he gene al ValueT ee ha s o es all
chops wi h an assu ance o alidi y in e ms o ypes and alue bounda ies.
The ValueT ee da a s uc u e suppo s e en -d i en p og amming: lis ene s
can subsc ibe o a ee in o de o in oke callbacks when e en s a ise, such
as p ope y changes o he emo al/addi ion o a sub ee.
3.3.1 Manual c ea ion
The AudioThumbnail componen plays a big pa in manual chop c ea ion.
Since i displays a isual ep esen a ion o he sample, i is possible o ec-
ognize pa e ns in he wa e o m o es ima e he posi ion and leng h o he
subsec ion you wish o c ea e. By de aul , he AudioThumbnail does no
in e ace wi h mouse clicks. Ne e heless, he in e cep ion o clicks as e en s
wi h coo dina es is ully suppo ed. I ound ou abou his h ough he
AudioPlaybackDemo ha is pa o he P ojuce ’s examples, whe e i was
possible o click on he AudioThumbnail o eloca e he playback head o he
AudioT anspo Sou ce o any posi ion on he wa e o m.
To do his, he AudioThumbnail is ins an ia ed as a membe and placed
wi hin a pa en componen . This way, he pa en componen can o e -
ide unc ions such as oid mouseDown (cons MouseE en & e) and oid
mouseD ag (cons MouseE en & e) o de ine he in e ac ions be ween he
componen and e en s igge ed by he mouse. When one clicks on he
humbnail, he coo dina es o he click e en a e pa o he e en ’s payload.
The xcoo dina e is all ha is needed o ob ain he equi alen poin in ime
in he sample: i is done wi h a ew a i hme ic ope a ions ha use he pa en
componen ’s and he humbnail’s wid h and he as ope ands, as well as he x
coo dina e. This wo ks bo h ways, such ha a posi ion in ime can be con-
e ed o an xcoo dina e. This ea u e allows o he ende ing o a playback
head ha sc olls along he humbnail as i plays in eal ime. Likewise, when
a chop is c ea ed, i s bounda ies can be d awn upon he humbnail wi h wo
ma ke s o indica e he egion i is con ained in.
The humbnail hen becomes he means h ough which manual chop c e-
25
4.2 Fu u e wo k
The plugin’s usabili y would be g ea ly imp o ed wi h a couple o addi ional
ea u es. One ea u e ha he implemen a ion lacks is he abili y o undo
and edo ac ions. The inclusion o his ea u e would allow o ac ions ha
a e now pe manen be undo-able, enhancing he ins umen ’s e sa ili y. In
hindsigh , had he ValueT ee class been used wi h mo e ies o he plugin’s
s a e, ac ions, and wo k low, he simple combina ion wi h an UndoManage
would ha e alle ia ed he ask o implemen ing his ea u e.
Fu he mo e, he ea u e whose absence is mos un o una e is he abili y
o s a e sa ing and loading. Wi hou his, he con igu a ion o he ins u-
men can no be s o ed in a DAW’s p ojec ile. This is a g ea incon enience
because closing he wo ks a ion implies disca ding he con igu a ion o he
plugin. The e is also oom o imp o emen in u he ea u es such as he
capabili y o load mo e han one audio ile in a single ins ance o he plugin.
As o now, se e al ins ances o he plugin can be c ea ed in a DAW o make
sample s ha load di e en audio iles, bu i would wi hou a doub be mo e
e icien and use iendly o p o ide he possibili y o a oid his wo ka ound.
32
Chap e 5
Conclusiones y abajo a u u o
5.1 Conclusiones
Habi´endose p opues o un plugin basado en ´ecnicas de mues eo, el p oduc o
inal es un ins umen o que puede ealiza las a eas necesa ias pa a pone en
p ´ac ica las unciones mencionadas. Se dispone de la is a p e ia de la mues-
a de audio, y su ep esen aci´on isual se log a con una minia u a in e ac i a
que p esen a su o ma de onda. Las egiones de audio pueden se c eadas
manualmen e con la ayuda de la is a en minia u a. Los co es se ag upan
en una abla que mues a sus no as MIDI asociadas, y las subsecciones se
ep oducen en espues a a e en os MIDI.
Tambi´en se incluye on unciones adicionales, de las cuales la m´as impo -
an e es la asociaci´on de pa ´ame os de en ol en e a cada co e. Con el ajus e
de poli on´ıa del ins umen o, la in e acci´on en e los co es y la e oluci´on em-
po al de su sonido es ajus abl. Tambi´en se cuen a con la c eaci´on au om´a ica
de co es g acias al m´odulo de de ecci´on de picos de aubio.
Al no ene expe iencia con el p ocesamien o de audio, el amewo k de
JUCE ayud´o a que el p oceso de implemen aci´on ue a sencillo y ´acil de
comp ende . El desa ollo se lle ´o a cabo en di e en es sis emas ope a i os y
la ansici´on en e ellos no plan e´o ning´un p oblema. JUCE ambi´en maneja
bien la inclusi´on de lib e ´ıas ex e nas, lo que hace que sea una a ea sencilla
ex ende el amewo k con nue as he amien as.
El plugin esul an e s´olo es compa ible en con el sis ema ope a i o Win-
dows, lo cual es una l´as ima po que la e si´on ac ual del P ojuce no iene
sopo e pa a expo a plugins VST pa a Linux. Tampoco se pudo p opo -
ciona una e si´on del plugin pa a Mac OS, ya que el P ojuce s´olo puede
expo a plugins pa a el sis ema ope a i o an i i´on, y no engo acceso a una
m´aquina de Mac OS.
33
5.2 T abajo a u u o
La usabilidad del plugin mejo a ´ıa mucho con un pa de ca ac e ´ıs icas adi-
cionales. Una ca ac e ´ıs ica que ca ece la implemen aci´on es la capacidad de
deshace y ehace acciones. La inclusi´on de es a ca ac e ´ıs ica pe mi i ´ıa
que las acciones que aho a son pe manen es puedan deshace se, mejo ando
la e sa ilidad del ins umen o. En e ospec i a, si se hubie a usado la clase
ValueT ee con m´as ´ınculos al es ado, acciones y lujo de abajo del plu-
gin, la simple combinaci´on con un UndoManage hab ´ıa ali iado la a ea de
implemen a es a ca ac e ´ıs ica.
Po o a pa e, la ca ac e ´ıs ica que m´as se echa en al a es la capacidad
de gua da y ca ga el es ado del plugin. Sin es o, la con igu aci´on del ins u-
men o no puede se almacenada en un p oyec o del DAW. Es o es un g an
incon enien e po que ce a el so wa e implica desca a la con igu aci´on del
plugin. Tambi´en se pueden con empla mejo as como la capacidad de ca -
ga m´as de un a chi o de audio en una sola ins ancia del ins umen o. Con
es a implemen aci´on se pueden c ea a ias ins ancias del plugin en un DAW
pa a ca ga di e en es a chi os de audio, pe o sin duda se ´ıa m´as con enien e
pode e i a es e obs ´aculo.
34
Bibliog aphy
[1] Akai MPC.u l:h ps://en.wikipedia.o g/wiki/Akai_MPC.
[2] Aubio lib a y.u l:h ps://aubio.o g.
[3] Download Reape .u l:h ps://www. eape . m/download.php.
[4] D aw audio wa e o ms u o ial.u l:h ps : / / docs . juce . com /
mas e / u o ial_audio_ humbnail.h ml.
[5] JUCE amewo k.u l:h ps://juce.com.
[6] jVSTwRappe lib a y.u l:h p://j s w appe .sou ce o ge.ne /
#in o.
[7] Linea PCM.u l:h ps://commons.wikimedia.o g/wiki/File:
Pcm.s g.
[8] Mello on.u l:h ps://www.mello on.com.
[9] MIDI echnical speci ica ions.u l:h ps : / / en . wikipedia . o g /
wiki/MIDI#Technical_speci ica ions.
[10] Reape .u l:h ps://www. eape . m.
[11] TableLis Box u o ial.u l:h ps://docs.juce.com/mas e / u o ial_
able_lis _box.h ml.
[12] Value class.u l:h ps://docs.juce.com/mas e /classValue.
h ml.
[13] ValueT ee class.u l:h ps://docs.juce.com/mas e /classValueT ee.
h ml.
[14] Vamp onse de ec o .u l:h ps://www. amp-plugins.o g/plugin-
doc/qm- amp-plugins.h ml#qm-onse de ec o .
[15] Vamp plugins.u l:h ps://www. amp-plugins.o g.
[16] Vi ual S udio Technology.u l:h ps://en.wikipedia.o g/wiki/
Vi ual_S udio_Technology.
35
[17] VST plugin download.u l:h ps : / / mega . nz / ile / ALBxzKxA #
9oc787dmzemZ-kRFoGIBkGlT5ZgNTpWwd6JsyUe-4Sw.
36