►
Description
Rust is a relatively new systems programming language which is quickly developing into an alternative to C++ for realtime audio applications. Starting with the basics, we’ll quickly get up to speed with everything needed to write audio applications in Rust, explore some of its pros and cons, and how to make use of it in existing codebases.
A
A
B
B
My
goals
for
this
talk,
definitely
not
to
suggest
that
you
should
drop
everything
in
news
for
us.
That's
totally
not
my
goal.
What
I'm
hoping
to
achieve
is
to
show
you
a
brief
overview
of
the
language
and
then
give
you
the
necessary
entry
points
to
be
able
to
explore
it
on
your
own
I.
Think
it's
a
fun
language
to
play
with,
and
hopefully,
if,
if
I,
if
I
do
this
right,
you'll
feel
like
there's
nothing
stopping
you
from
exploring
it.
B
So
a
bit
about
me
working
at
Ableton
in
Berlin
since
2011,
as
mentioned
already
I'm,
the
technical
principal
for
DSP
and
devices
there,
and
what
that
means
is
I
have
a
dual
role,
essentially
where
I'm
working
as
a
software
engineer
in
the
sound
team
working
on
our
instruments
and
effects
and
I'm,
also
looking
after
a
long
term
strategy
for
sound
technology.
So
in
terms
of
sound
technology,
there
isn't
really
anything
more
fundamental
to
what
we
do
than
use
C++.
So
why
am
I
interested
in
rust?
B
Well,
like
many
of
you
I
think
you'll
be
using
C++.
It
really
dominates
the
music
software
industry
and
it
has
since
the
start
of
my
career
so
about
15
years,
and
there
hasn't
really
been
much
choice.
We've
been
using
C++
or
C
if
you're,
feeling
brave
or
some
somewhere
on
the
spectrum
between
basic
C
and
full-blown
C++
with
all
the
bells
and
whistles
and
you'll
find
some
comfort
zone
in
that
spectrum
of
C
and
C++.
B
Did
we
have
a
choice
beyond
that?
Not
really
that
I've
known
about
I
haven't
seen
a
viable
alternative
in
my
career
I
think
there
might
have
been
in
the
old
days
like
Delfy
I,
think
I,
remember
seeing
some
code
examples
in
Delfy
when
I
was
starting
out.
I
haven't
seen
many
since,
if
you
use
Delfy-
and
you
think
it's
great,
then
let
me
know
I'd
be
interested,
but
rust
like
it
has
caught
my
eye
and
I.
Think
is
caught
a
few
of
your
eyes
too,
because
it
offers
much
of
what
I
like
about
C++.
B
You
get
low
level
control
high
level,
abstractions
I,
like
abstractions,
so
I
tend
towards
the
C++
end
of
things,
performance
on
par
with
C
and
C++.
I'm
not
gonna,
spend
time
improving
this.
But
if
you
allow
me
to
wave
my
hands
and
say
it's
basically
the
same
kind
of
performance
II
you
get
received
plus
past
and
one
how
you
tune
things.
B
But
we
can
just
say
that
they're
in
the
same
ballpark
and
it
offers
precise
timing-
and
this
is
the
the
thing
that
really
has
stopped
me
from
investigating
a
lot
of
languages
that
look
attractive,
that
usually
have
garbage
collection
or
some
kind
of
messaging
system
that
locks
or
something
that's
just
in
the
way.
So
it's
quite
exciting
to
me
that
there's
maybe
a
viable
alternative
now
to
C++
for
real-time
audio.
B
So
a
bit
about
the
background
of
rust.
For
those
of
you
who
don't
know
it
started
as
a
project
at
Mozilla,
they
were
interested
in
maybe
finding
an
alternative
language
for
building
complex
applications
like
web
browsers
that
have
lots
of
security
holes
because
of
common
programming
mistakes
that
people
often
makin
see
in
C++.
So
this
was
a
language
that
was
intended
for
maybe
a
new
approach
to
building
complex
applications
if
they
announced
it
publicly
in
2012,
I've
got
lots
of
other
people
on
board.
Now,
Mozilla
aren't
the
majority
contributor.
B
Many
other
people
are
contributing
to
rust
and
there's
an
open
development
process
and
they
reached
a
stable
1.0
release
in
2015,
which
allowed
people
to
start
using
it
in
production.
Essentially,
because
they
knew
their
code
would
continue
to
run
as
the
chain
evolved
and
in
2016
Mozilla
managed
to
start
shipping
code
that
was
written
with
rust
in
Firefox
and
since
then,
the
amount
of
code
that
is
shipping
in
Firefox
with
rust
has
grown
and
they
seem
very
happy
about
it.
B
B
So,
let's
get
involved
in
a
bits
of
rust
is
hello
world,
and
you
can
see
already
that
it
looks
quite
familiar
to
C
in
C++,
I've
got
curly
braces
and
semicolons.
We've
got
a
function,
that's
being
called
called
main.
The
the
exclamation
mark
on
the
end
of
print
line,
means
macro
and
in
rust,
macros
are
okay,
they're,
not
even
looking
C
and
that
prints
out
hello
world,
very
good.
Here's
a
slightly
more
complicated
hello
world
I,
don't
know
if
that's
maybe
too
big
for
that
looks
all
right.
B
Okay,
so
we
call
a
function,
get
name
that
returns
a
string.
Then
we
pass
that
string
into
another
function.
Then
we
use
a
formatting
thing
to
print
out
hello,
ADC
isn't
even
more
complicated
example
where
now
we're
using
an
enum,
and
here
in
rust,
enums
are
like
see
like
enums,
but
also
like
variants
in
c++.
B
They
they
are
some
types
and
you
can
apply
very
nice
language
based
pattern,
matching
2d
structure,
the
the
option
in
the
in
the
enum
and
then
print
that
out-
and
this
is
nice-
but
this
isn't
why
I
think
rust
is
interesting.
It
offers
like
a
lot
of
interesting
ergonomic
enhancements
to
your
your
programming
that
don't
exist
yet
in
C++,
but
maybe
over
time.
They
will
we'll
see
what
happens.
We
hope,
but
that's
not
why
I
think
it
rust
is
worth
investigating
really.
B
Let's
take
a
look
at
what
some
of
those
properties
are.
This
is
C
C++
code.
We
have
a
value
a
and
then
we
take
two
pointers
to
a
and
then
we
manipulate
a
via
the
pointers,
and
then
we
dereference
the
pointers
to
print
out
a
value
if
we
do
the
same
thing
in
rust.
Well,
this
is
the
equivalent
code.
Here
we
have
a
mutable
value,
a
in
rust.
Everything
is
concert
by
default
and
you
have
to
buy
into
mutability.
B
We
take
two
mutable
references
to
a
then
we
manipulate
values
print
them
out,
but
the
compiler
will
block
you
from
doing
this
because
we
cannot
borrow
a
as
mutiple
more
than
once
at
a
time.
First
mutable
borrow
occurs
here,
a
second
okay,
so
that's
a
rule
that
the
compiler
has
the
you're
not
allowed
more
than
one
mutable
reference.
Okay,
what
if
we
make
the
second
reference
immutable
so
that
we're
only
taking
one
mutable
reference?
B
Well,
the
compiler
still
blocks
you
here
cannot
borrow
hey
as
immutable,
because
it's
also
borrowed
as
mutable
now
this
might
seem
a
bit
restrictive
because
actually
there's
nothing
particularly
wrong
with
that
careers.
This
is
a
toy
example,
but
this
illustrates
the
the
kinds
of
restrictions
that
are
baked
into
the
language,
and
maybe
it's
best
spelled
out
in
writing.
The
rules
are
you
can
have
as
many
immutable
references
to
a
value
as
you
like,
you
can
have
a
thousand
if
they're
all
immutable
or
a
single
mutable
reference.
B
B
So
here's
an
example
of
a
classic
pitfall
in
C++
we
have
dangling
pointers,
so
we
have
a
pointed
at
X,
which
we
point
to
the
first
element
in
a
vector
the
vector
gets
destroyed.
We
still
have
a
point
of
what
happens
if
we
dereference
it
well
crash.
I,
guess,
certainly
something
you
don't
want
to
do.
B
If
you
have
the
equivalent
code
in
rust,
so
here
we're
assigning
X
as
a
reference
to
the
first
element
of
a
vector
V,
then
we
try
and
dereference
it
well,
we
we
can't
even
get
to
the
dereferencing,
because
the
lifetime
checker
knows
that
V
does
not
live
long
enough
and
we're
trying
to
borrow
a
value
that
does
not
live
long
enough.
V
gets
dropped
here,
while
it's
still
borrowed
and
the
borrowed
value
needs
to
live
here
and
in
terms
of
like
understandable
error
messages,
I'm,
not
sure
what
they
could
do
better.
There
I
think
it's.
B
It's
really
spelled
out
super
clearly
on
it's
quite
nice.
Another
way
you
can
shoot
yourself
in
the
foot
in
C++
is,
if
you
have,
if
you're
iterating
over
a
container,
and
then
you
happen
to
be
modifying
the
container
while
you're
iterating
over
it.
So
here
we're
going
over
the
the
integer
0
1
2
3,
we're
printing
them
out,
but
while
we're
doing
that,
we're
also
manipulating
the
contents
of
the
vector,
then
strange
things
can
happen
on
my
machine.
I
get
0,
0,
2,
3,
I,
don't
know
why?
But
that's
what
happens?
B
Maybe
you
would
get
something
else
if
we
try
and
do
the
same
thing
in
rust.
This
is
the
equivalent
code.
Then
we
get
an
error.
Cannonball
V
is
mutable
because
it
is
also
borrowed
as
immutable.
So
like
the
the
mutable
borrow,
is
happening
here,
we're
trying
to
push
into
the
vector,
but
we
can't
do
that
because
we
have
to
have.
We
have
to
be
the
sole
owner
to
be
able
to
mutate
V,
and
we
can't
because
there's
already
an
immutable
borrow
active
like
from
the
iteration.
B
Then,
if
your
honor,
if
you're
on
Mac
or
Linux,
then
you
run
a
shell
script
and
you
you
get
a
tool
chain
installed.
If
you're
on
Windows
you
get
an
installer
and
then
you
get
a
tool
chain
on
your
system
and
on
my
system,
I
happens:
we've
installed,
three
you
get
the
stable
by
default
and
then
rust
up
is
a
command
that
you
can
run
to
manage
your
tool
chain.
B
So
if
you
want
to
like
see
which
ones
you
have
rust
up,
if
you
want
to
switch
between
them,
then
you
go
to
rust
up
and
once
you've
installed
the
tool
chain,
then
you
have
access
to
the
cargo
command,
which
is
very
useful.
Now
I'm
gonna
do
a
risky
thing.
Let's
see,
if
I
can
show
you
how
this
works
so.
B
Hello,
so
we
created
a
binary
application
called
hello,
very
good.
Let's
have
a
look
at
that.
Sorry,
the
screens
a
bit
laggy.
So
it's
not
the
easiest
thing
to
type
on.
We
have
a
directory,
then
we
can
see.
What's
in
the
directory,
we
have
a
main
source
file
which
looks
promising
and
a
cargo
tamil
file.
The
cargo
tamil
file
is
the
configuration
for
the
package
that
you're
in
so
cargo
has
created
a
package
which
is
this
binary
application,
and
then
you
can
configure
it
using
the
tamil
file.
B
So
it
compiles
the
application,
then
runs
it
for
you
and
prints
out
the
result,
and
it
just
happens
to
have
a
world
example
for
you.
I
was
going
to
edit
this
and
play
with
it,
but
actually
I.
Think
it's
probably
better.
If
I
just
go
back
to
the
slides
at
this
point
but
yeah,
that's
the
idea,
you
can
it's
almost
instant
to
setup
a
project
and
get
building,
and
you
can
edit
that
for
hold
and
play
around.
B
B
It's
also
a
test
runner,
a
benchmark,
runner,
sort
of
a
documentation
generator
and
more.
It's
really
quite
nice
to
have
all
of
the
tools
that
you
probably
find
and
bundle
together
in
your
C++
projects,
and
you
come
up
with
your
own
stack
of
stuff
that
you
put
together.
So
you
make
and
oxygen
and
Google
test.
Or
you
know
you
find
your
own
combination
of
these
tools
here.
It's
all
standard
and
people
mostly
use
the
same
stuff,
and
that's
also
quite
nice
because,
like
everyone's
aligned
around
the
same
tool
set
it's
just
great.
B
Quickly
mention
that
when
you're
looking
into
using
rust,
you're
going
to
see
that
there
are
different
release
channels,
it's
fairly
straightforward,
you
have
the
stable
version,
which
is
updated
every
six
weeks.
Beta
is
the
thing
that's
about
to
become
stable
and
nightly
is
where
the
new
changes
implemented
and
people
play
around
with
like
the
new
stuff,
and
this
updates
every
night
might
be
unstable
and
you
probably
don't
want
to
use
it
unless
you
want
to
try
the
new
thing.
B
The
other
thing
that
I
need
to
mention:
I,
dunno,
I,
wouldn't
but
I
kind
of
have
to
do
that.
Coming
up
is
the
2018
addition
of
rust,
which
is
going
to
be
released
in
a
couple
of
weeks
and
I
figured
it's
close
enough
in
time
that
I
should
just
be
using
the
2018
editions.
So
the
examples
you
see
you
have
to
use
the
beta
channel
or
the
nightly
channel,
but
in
a
couple
of
weeks
it's
all
going
to
be
stable.
B
Something
that's
nice
about
the
additions
is
that
it
allows
the
language
designers
to
incrementally
introduce
breaking
changes,
so
the
language
can
evolve
and
then
you
opt
in
to
the
breaking
changes,
and
this
allows
the
community
and
like
the
user
base,
to
come
along
with
improvements
to
the
language,
while
still
maintaining
kobata
compatibility
with
the
old
changes.
These
are
subtle
tweaks,
but
it
allows
for
ergonomic
enhancements,
which
is
quite
a
nice
thing
and
in
general,
though,
that
new
features
will
be
available
in
auditions
all
right,
so
I
think
that's
enough
orientation.
B
You
find
it
in
tons
of
different
software
packages,
but
I
didn't
see
a
rust
version,
so
I
thought
that
might
be
a
nice
thing
to
work
on
and
we
can
go
through
like
how
the
whole
thing
is
put
together
pretty
quickly,
because
it's
extremely
simple,
that
is
like
the
the
structure
of
the
algorithm.
You
have
a
stack
of
comb
filters
that
have
internal
feedback
and
filtering
there's
some
together
and
then
passed
through
a
series
of
all
pass
filters.
B
The
the
image
comes
from
a
write-up
that
julie
smith
has
on
the
common
website,
where
he
talks
about
the
structure,
analyzes
the
properties
of
it
and
that's
worth
reading,
and
you
can
find
the
original
source
code
which
I've
converted
into
rust
following
the
link
below
they're
easy
to
find
on
google,
if
you
don't
have,
you
know,
you'll
find
it
easy
enough.
So
it's
easy
to
build
this.
We
only
need
two
things
really
current
fields
for
in
an
allpass
filter.
They.
B
B
So
the
comb
filter
in
the
or
pass
filter
both
use,
delay
lines
and
we
can
create
a
delay
line.
We've
made
a
new
file
here
to
lay
line
two
RS
inside
our
free
verb
library,
and
this
in
this
implicitly
creates
a
delay
line,
module
and
so
I,
like
I'll,
be
referring
to
the
delay
line
module
here
inside
the
module
we've
created
a
delay
line
struct.
So
this
is
the
same
thing
essentially
as
a
C.
B
Struct
pub
means
that
it's
public
outside
of
this
module-
and
we
have
two
elements
in
our
strut:
a
buffer
and
an
index
buffer,
is
effect
of
64-bit
floats
index.
You
size,
you
sizes,
essentially
society
in
C++
terms,
to
add
methods
to
this
type.
We
don't
do
that
in
line
in
the
type
like
you
would
in
C++,
but
we
separate
the
behavior
out
into
implementations
and
the
default
implementation
by
convention
will
usually
include
a
static
method
called
new.
This
isn't
a
constructor
or
it's
not
like
the
new
keyword.
B
It
doesn't
allocate
anything
unless
you
happen
to
be
not
using
a
vector
here
that
will
allocate,
but
new
is
just
a
convention.
We
don't
have
constructors
in
rust.
Instead,
it
there's
an
expectation
that
whenever
you
have
a
delay
line
value,
it
has
been
fully
initialized
and,
however,
you
achieve
that
is
is
up
to
you,
but
the
convention
is
new,
so
we're
initializing
a
buffer
with
a
zero
doubt
like
string
of
zeros
and
an
index
of
zero,
then
adding
some
methods
here.
B
We
you
see
a
fast
method,
essentially
is
a
method
in
an
implementation
that
has
a
reference
to
self
as
the
first
parameter.
This
is
like
this
pointer
in
C++,
so
we
have
a
read
method
that
returns
the
current
currently
index
value
in
the
buffer,
and
we
have
a
write,
an
advanced
method
which
takes
a
value.
It
sticks
it
in
the
buffer
and
then
it
increments
the
index
or
wraps
around
if
we're
at
the
end,
and
so
then
we
just
have
a
continuously
circling
delay
line.
B
We
can
show
that
with
a
test,
so
here
we've
added
a
unit
test,
that's
in
the
same
module
in
a
child
module
called
tests
and
the
conflict
test
command.
Here
is
a
compiler
declaration.
That
says
you
only
need
to
worry
about
building
this
if
we're
building
tests,
and
then
we
have
a
length
10
function,
which
we
tagged
with
the
test
declaration,
and
this
is
now
registered
as
a
unit
test.
B
Then.
If
we
run
cargo
tests
it
will
find
this
test
and
then
run
it
and
tell
us
that
everything's,
ok,
so
something
I
really
like
about
this
is
writing
the
tests
with
the
code.
I
think
this
is
like
quite
a
nice
way
of
working
that
they're
in
the
same
module
in
context
of
the
code
that
they're
testing
and
you
know
having
a
having
like
a
test
framework.
A
test
runner
out
of
the
box
is
also
really
nice.
There's
there's
no
setup
cost
here.
B
The
all
pass
filter.
Well
we're
going
to
create
a
new
module
all
pass
and
use
the
delay
line
that
we've
just
created.
Stick
it
in
a
struct.
That's
all
the
old
past
needs
the
delay
line.
Then
we
initialize
it
and
the
tick
function
is
like
reading
value
out,
mixing
it
with
the
input
applying
some
gain
and
then
putting
it
back
in
the
delay
line
and
it's
all
passed.
Ish
is
how
it
would
be
described.
It's
not
exactly
in
all
past,
but
it's
it's.
What
the
free
vote
algorithm
calls
an
allpass.
B
The
comb
filter
is
slightly
more
sophisticated
again,
it's
a
delay
line
with
feedback,
but
here
we
have
some
filter
state.
There's
a
one-pot
filter
embedded
in
this
and,
like
here's,
the
tick
function,
we're
again
reading
a
value
out
from
the
delay
line,
applying
some
filtering
and
then
putting
it
back
into
the
delay
line
and
returning
the
output
so
I.
Take
here
is
just
a
method
beam
on
using
for
these
DSP
blocks
that
taken
in
a
sample
of
input
and
then
give
you
a
sample
of
output.
That's
just
a
name
that
I've
chosen
putting
it
together.
B
We
then
have
like
a
free
verb
module
and
a
free
verb
struct
in
the
module,
and
here
we
see
that
we're
using
our
all
passes
and
combs
that
we
just
created
and
on.
We
have
eight
pairs
of
combs
and
four
pairs
of
all
passes
the
this
pass
syntax.
This
is
actually
tuple
syntax.
They
can
be
like
n
elements
long,
but
this
is
good
enough
for
this
purpose.
I
think
that
you
just
have
a
pair
left
and
right
and
then
a
bunch
of
other
state
like
for
the
different
parameters
that
are
used
in
the
new
construction.
B
We
sorry
the
new
method,
we're
initializing
our
combs,
using
these
like
delay,
lengths
that
have
been
carefully
tuned
by
the
original
author
and
you'll,
find
in
the
source
code
and
same
here
with
the
all
passes,
then
a
bunch
of
stuff,
and
you
have
a
free
verb
that
is
ready
to
go.
So
that's
fully
initialized
and
like
yeah,
it
sounds
like
a
reverb.
The
tunings
look
like
this,
so
you
can
have
constants
and
the
syntax.
B
There
is
just
put
them
all
in
caps
and
find
it's
a
convention
we're
adjusting
the
length,
because
the
original
only
sports,
44.1
I,
think
that
does
the
job
I'm
really
tested
it
that
much,
but
so
something
to
show
here.
Okay,
it's
a
bunch
of
setters
for
the
free
verb,
and
the
only
different
thing
here
that
you
haven't
seen
so
far
is
that
a
private
method
is
just
a
function
in
an
implementation
that
isn't
public.
So
these
two
setters
are
publicly
available.
B
They
defer
to
a
helper,
which
is
private,
I,
just
figured
I'd
show
that
then
the
the
tick
function.
We
take
the
input,
the
stereo
and
put
summit
to
mano,
pass
it
into
each
of
the
stereo
pairs
of
cones
sum.
All
of
that
together
run
through
the
old
passes,
and
then
the
output
is
a
bit
of
stereo
mixing,
plus
the
dry
signal.
Oh
the
thing:
that's
new
here
is
tuple
accesses
dot,
zero
for
left
dot,
one
for
right.
B
B
Okay,
so
there
we
had
an
application
that
was
like
a
full
audio
application
with
the
GUI.
How
did
we
put
that
together?
Well
I'm
using
existing
libraries
that
happen
to
have
rust
wrappers,
so
I
was
able
to
pull
them
in
as
like
dependencies
into
the
application
project
very
easily,
which
I'll
show
you
now
our
main
function,
I'm
calling
the
run
main.
You
don't
have
to
worry
about
this
template
e
syntax
for
now
I'm
going
to
explain
this,
but
for
now
the
thing
that's
interesting
is
that
we're
creating
a
command
queue
using
the
external
crate
crossbeam.
B
So
this
is
a
dependency
that
I'm
pulling
in.
This
is
a
rust
library
and
then
I'm
using
port
audio
for
audio
in
and
out
it
does
the
job,
and
here
we're
we're
spawning
a
thread
where
the
audio
will
run,
and
then
that
thread
receives
the
command
receiver
and
then,
on
the
sender
side,
we
have
UI
widgets
I'm,
not
going
to
show
you
everything,
but,
like
you
get
the
idea,
I'm
using
a
gtk
window
here
and
gtk
window
widgets,
and
this
this
just
works.
Is
it
it?
B
It
feels
straightforward
to
use
that
you
don't
have
to
worry
about
this
too
much
the
the
way
that
you
declare
these
dependencies
is
in
your
cargo.
Tamil.
In
the
dependency
section,
you
say:
okay,
I
want
version
0.5
of
gtk
point
7
of
poor
audio.
The
thing
that's
interesting
here
is
that
I've
included
two
internal
dependencies
for
things.
I
haven't
shown
you
yet
one
called
audio
module
and
the
other
called
free
verb.
Module
and
I
really
didn't
need
to
do
this,
but
I
figured.
B
So
I
started
making
a
module
framework
and
I'm
not
sure
it
was
the
best
idea,
but
it
gets
to
it
gets
to
a
nice
feature
of
rust,
which
is
trait
and
traits
are
very
similar
to
virtual
interfaces
in
C++
they're,
also
very
similar
to
concepts
which
are
coming
in
C++,
20,
I
think
and
they
allow
for
like
different
different
different
behaviors,
depending
on
what
you
do
with
them,
but
really,
if
you
think
of
it
as
declaring
an
interface
and
then
how
you
use.
That
interface
is
something
that
will
become
a
bit
clearer.
B
So
here
we're
saying
an
audio
module
is
a
parameter
provider.
So
that's
another
trait.
There
is
a
trait
called
parameter
provider
and
the
trait
audio
module
also
includes
that
trait
as
part
of
its
interface,
the
audio
module
declares
a
processor
type
and
the
processor
type
meets
the.
It
satisfies
the
interface
of
audio
processor,
and
then
it
also
has
a
method
called
create
processor
which,
when
given
a
sample
rate,
gives
you
a
a
processor
by
a
value.
B
The
audio
processor,
trait
I've
got
define
it
as
like
being
something
that
processes
stereo
audio,
so
we
have
an
input
buffer
and
an
output
buffer.
This
syntax
here
you
haven't
seen
yet
this
is
like
an
array,
but
it's
sized
at
runtime.
So
this
is
like
I
said
spam,
that's
coming
in
C++,
so
it's
just
a
reference
plus
a
length
and
that's
the
standard
syntax
for
it,
the
audio
processor.
B
We
expect
to
also
be
able
to
handle
commands,
and
so
you
can
compose
these
traits
together
and
create
a
full
declaration
of
an
interface
which,
on
its
own,
doesn't
do
anything
but
can
then
be
used
for
cases
like
this.
So
we
I
created
a
new
module
free
verb
module
which
then
has
a
free
verb
processor,
which
internally
has
the
free
verb
struct
that
we
made.
B
That
does
the
ticking,
but
we're
kind
of
encapsulating
that
here
and
then
we
implement
audio
processor
and
the
process,
stereo
method
for
it
and
instead
of
taking
sample
by
sample
here,
we're
dealing
with
a
buffer.
So
we
have
to
iterate
over
the
buffer
and
what
this
is
doing
is
taking
the
indices
or
the
even
indices.
Up
to
the
input
length
and
then
using
those
even
indices,
to
give
access
to
the
interleaved
stereo
data
in
the
buffer.
B
B
So
I'm
gonna
I'm
gonna
skip
ahead
a
bit,
so
we
have
a
free
verb
module
that
declare
some
parameters
and
there's
a
whole
thing
about
that.
But
I
get
I
think
we
get
the
idea
come
on
handler
as
a
trait
we
have
to
handle
commands
and
then
so,
if
the
processor
receives
a
command
and
then
calls
the
relevant
setter
on
the
processor.
B
So
now
coming
back
to
the
main
function,
I
think
we
we
see
what's
going
on
here,
like
I,
wanted
to
separate
out
the
the
free
verb
aspects
of
the
application
from
the
the
thing
that
actually
runs.
The
runs
the
system
so
like
we
just
passed
in
a
module
which
implements
the
trait
audio
module,
so
the
the
whole
application
doesn't
know
anything
about
free
verb.
It
just
knows
about
audio
modules.
So
then
maybe
it
could
be
reused
for
other
effects.
B
So
treats
are
generic
type
constraints
similar
to
C++
twenties
concepts
also
offer
static.
Polymorphism
functionality
also
dynamic
polymorphism,
similar
to
C++
virtual
objects
and
having
like
the
same
language,
feature
providing
all
of
this
functionality
is
really
quite
remarkable.
I
think
and
like
it's
one
of
my
favorite
things
about
rust,
so
I'm
gonna
have
to
prattle
on
right,
so
Fi,
yeah,
linkie,
again
see
libraries
and
rust
is
well
supported.
Crates
are
available
for
many
major
c
libraries
and
also
c++
libraries
that
happen
to
have
c
bindings.
B
If
you
find
that
a
crate
doesn't
have
a
rust
wrapper
than
making
a
rust
repair
would
be
a
nice
contribution
to
the
ecosystem.
So
if
you
felt
so
inclined,
that
would
be
a
really
good
thing
to
be
spending
time
on.
How
is
it
possible
to
call
c
code
given
rust
safety
restrictions?
This
is
an
important
question.
Rusty's
very
strict
C
code
is
not
if
we're
calling
in
C
code,
then
how
does
rust
allow
this
so
to
quickly
highlight
how
this
is
possible?
B
We
have
the
unsafe
keyword
which
tells
rust
I
know
what
I'm
doing
just
don't
worry
about
what
I'm
about
to
do
here
with
memory
or
like
lifetimes
or
whatever,
like
you,
can
just
bypass
the
whole
of
the
all
of
the
safety
checks
for
most
of
them.
If
you
need
to
and
when
you
need
to
might
be,
when
you
are
working
with
a
C
library
that
communicates
in
raw
pointers
and
if
you're
using
unsafe,
you
probably
want
to
extract
it
away.
B
B
Apply
attributes
to
the
functions
in
your
library
to
ensure
that
they're
exposed
in
a
C
compatible
way.
So
here
we're
creating
a
new
library,
free
lips,
free
verbs,
feelin,
and
it
depends
on
our
free
library
that
we
created
earlier
and
we're
telling
cargo.
Please
build
it
as
a
static
library
in
the
Russ
code.
For
this
library
we
have
a
create
and
destroy
method
where
we're
able
to
create
a
raw
pointer
to
a
free
verb,
struct,
which
we
essentially
forward
declare
for
the
purposes
of
C.
B
So
we
tell
see
there
is
this
struct
you
can
allocate
it,
but
we'll
take
care
of
the
details,
and
here
we're
using
box
to
allocate
on
the
heap
and
then
it
gets
returned
as
overall
pointer
and
on
the
destroy
side.
Then
we
receive
a
pointer
that
we
just
have
to
hope
is
and
we
tag
it
as
unsafe.
It's
like
the
the
thing
that
comes
in
here
could
be
anything
but
we
fingers
crossed
and
it
will
be
okay,
also
no
mangle,
and
that
that's
pretty
much
all
you
need
to
make
sure
that
extern.
B
So
it's
no
mangle
annex
turn
make
sure
that
that
function
is
available
outside.
So
once
you
built
that
you
have
a
library
that
can
be
linked
into
your
C++
application,
but
you
also
need
a
header
or
you
know
the
declarations
of
the
things
that
you're
trying
to
access.
You
can
write
that
by
hand
if
you
want
there's
also
a
tool.
B
B
Using
the
free
road,
a
rust
library
in
a
juice
project
right
so
now
we
have
a
C
library,
we
can
use
it
in
C++
and
because
this
is
an
audio
conference,
I
guess
there's
a
lot
of
juice
developers
here.
So
this
is
how
you
do
it
in
producer.
You
tell
you,
you
set
the
the
right
flags
and
the
flags
you
need
are
where,
where
the
header
is
so
it's
in
this
C
Lib,
folder
local,
to
the
juice
project,
you
tell
you
where
the
library
is
you
tell
it
which
library
you
want
to
link
against.
B
Then,
in
our
juice
code
right
quickly,
we
have
free
vert,
HPP
I
didn't
do
the
whole
module
thing
in
the
juicer
example.
But
what
we
have
is
a
unique
pointer
to
a
free
verb
and
when
it
gets
destroyed,
we
need
to
call
the
free
verb,
destroy
a
function
when
we
are
preparing
to
play.
We
create
a
free
verb
using
our
create
function
and
we
we
stick
it
into
our
unique
pointer
to
hold
on
to
it.
B
B
Don't
get
to
the
slides,
it's
like
this
right
so
now
you
know
you
you're
in
a
juice
project,
so
you
could
build
a
VST
with
this
or
you
know
whatever
you
want
to
do
with
you,
your
juice
project,
another
target,
that's
interesting,
is
web
assembly
and
with
rust.
The
the
tool
chain
for
generating
web
assembly
is
pretty
nice
and
we're
going
to
follow
the
same
approach
here.
Creating
a
another
wrapper
library
in
this
case,
I'll
call
it
wiesen
and
in
in
this
case,
why
isn't?
B
B
The
process
function
is
very
similar
to
what
we've
seen
before,
but
now
we're
speaking
in
native
rust
Heights
because
why's
it
bun
Jen,
knows
a
bit
more
about
rust
and
it
can
like
expose
the
correct
types
for
the
JavaScript
that
ends
up
being
called
the
web.
Suddenly,
the
ends
up
being
called
so
it's
much
the
same
as
you've
seen
before.
Then
the
way
that
this
is
compiled.
B
Well,
we
use
cargo
build,
but
we
tell
it
to
cut
the
target
weird
assembly
instead
of
whatever
your
platform
is
compiling
for
and
then
you
run
wise
and
bind
gem.
You
tell
it
where
your
web
somebody
is,
and
then
it
gives
you
a
set
of
files.
It
gives
you
some
JavaScript
bindings,
which
I
wouldn't
show
you.
B
Then
I
don't
have
time
to
show
you
how
to
hook
this
up,
but
it
we're
just
using
Web
Audio.
We
instance
we
import
the
the
web
sembly
blah
blah
blah,
and
then
we
create
a
script
processor.
This
isn't
the
the
the
modern
way
to
do
custom
DSP
for
the
web,
but
it's
slight
friendly.
So
there
we
have
the
input
and
output
and
we're
calling
process
on
our
free
verb,
object
connected
to
a
microphone
and
then
connected
to
the
output
hook
up
some
sliders.
B
Okay,
to
summarize,
exposing
rust
to
C
is
easy
by
skype-ing
and
exposing
rust
code
to
JavaScript
as
easy
Verizon
bunging
I'm,
making
the
claim
easier,
I
think
is
straightforward.
There's
a
few
details
to
figure
out
but
like
it's
there
like
the
tool
changes
there
and
like
it,
you
can,
you
can
use
it.
B
B
So
70
support
is
in
its
stable.
The
intrinsics
are
available.
There
are,
there
is
a
crate
now
which
is
building
a
nice
abstraction
over
the
low-level
operations.
There's
also
an
effort
to
create
a
standard
abstraction
for
the
low-level
intrinsics
kant's
generics
is
still
working
progress,
but
it's
coming
soon.
B
What
this
means
is
in
C++,
you
could
say
static,
vector
of
T's,
and
there
are
n
n
as
a
maximum
number
for
your
static
vector,
and
you
can't
express
that
in
rust
and
run
you
have
to
use
macros
or
workarounds,
but
I
would
really
like
this
feature,
and
it's
coming
soon.
Inline
assembly
still
work
in
progress,
it's
unstable,
but
gated
and
maybe
will
change
fast
math
intrinsic
tonight.
B
Leone
they're,
not
stable
and
I
think
these
are
quite
important,
but
hopefully
they'll
come
soon,
and
maybe
some
people
in
the
audience
here
would
be
able
to
help
the
the
Russel
community
figure
out
how
to
do
this.
Well,
placement
you
wasn't
Knightly
is
not
anymore.
They
have
things
to
figure
out
there.
What's
not
great
will
compile
times
are
getting
there
like
they.
They
were
not
great.
They
decent
enough
now,
I
think
like
either
I
find
it
usable
unless
I'm,
using
a
particular
crate
that
is
slow
to
compile,
but
then
maybe
I
don't
use
that
crate.
B
I'd
say
if
you,
if
you're
building
complex
C++
applications,
you
won't
notice,
things
are
dramatically
slower,
you'll
be
okay,
you'll,
be
okay,
with
the
compile
times
and
rust.
If
you're
writing
more
like
low-level
C
style
code,
then
maybe
you'll
find
it
unbearable,
but
yeah
you
should
you
should
try
it
out
and
see
what
you
think
incomplete
iOS
support.
There
is
an
issue
with
component
to
iOS
bit
code,
which
maybe
you
need
for
the
App
Store.
Apparently
there
are
ways
of
making
it
work.
B
I
haven't
tried
it
there's
a
long
issue
that
you
can
read
to
describe
this,
but
if
iOS
support
is
important
to
you,
then
you
should
really
look
into
this.
What
is
great
safety
is
great
ergonomics
at
the
language
are
very
nice
traits
are
wonderful,
having
a
standard
tool
tool
chain
that
everyone
uses
is
great,
I
think
if
we
could
take
in
C++
if
we
could
take
something
from
rust.
This
is
the
thing
that's
kind
of
low-hanging
fruit
by
creating
standard
tool
chains
that
everyone
can
like
rally
around
and
get
guest
interaction
behind.
B
Debugging
Visual
Studio
code
I
didn't
get
to
show
you
this,
but
if
you
have
Visual
Studio
code,
then
the
Russ
community
have
kind
of
chosen
that
as
their
standard
IDE
and
it
seems
like
that's
the
thing
to
use
and
debugging
works,
really
well
breakpoints
and
inspecting
symbols
and
values
and
everything
the
Russ
book
is
brilliant.
You
should
read
it.
It
will
give
you
a
full
orientation
of
the
language
and
it's
very
well-written.
B
B
Have
you,
like
I,
think
the
more
people
involved
in
real-time
audio
who
are
working
in
a
community,
the
more
things
will
be
built
and
at
the
moment
there's
not
so
many
people
doing
this
stuff,
and
so
there's
if
you'd
like
places
where
just
tools
that
you
need
don't
exist
yet
and
maybe
making
those
tools
would
be
a
good
contribution,
and
maybe
you
know
how
to
so.
It
would
be
a
good
thing
to
do
a
couple
projects
worth
looking
at
Ralph.
B
Levine
did
a
talk
last
week
at
a
meet-up
and
presented
his
work
on
building
an
open-source
synthesizer
in
rust.
It's
looking
very
promising
and
interesting,
and
if
you
you're
looking
for
a
thing
to
contribute
to
you,
then
this
would
be
a
good
place
to
start.
Also,
there's
a
group
of
people
are
interested
in
building
vsts
with
rust
and
they're
working
on
a
project
there
that's
worth
checking
out
alright.
So
that's
it.