# Modifying and compiling synthdefs

**URL:** <https://in-thread.sonic-pi.net/t/modifying-and-compiling-synthdefs/2143>\
**Category:** Development \[obsolete\]\
**Created:** [March 20, 2019, 10:19pm UTC](https://in-thread.sonic-pi.net/t/modifying-and-compiling-synthdefs/2143 "2019-03-20T22:19:40Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [March 21, 2019, 2:25pm UTC](https://in-thread.sonic-pi.net/t/modifying-and-compiling-synthdefs/2143/4 "2019-03-21T14:25:59Z")

</div>

Overtone seemed less daunting as I’m already familiar with Clojure, but I’ve had a bit of a look into SuperCollider and managed to get a basic synthdef working, with most of the parameters hardcoded for now, but with the `tune` parameter set from the fractional part of the note. I’ve loaded it into Sonic Pi with `load_synthdefs`, and it can play fractional tuning!

My synthdef so far looks like:

```ruby
(
SynthDef(\testPiano, {|
	note = 52, decay = 0, release = 1,
	velcurve = 0.8, stereo_width = 0,
	out_bus = 0 |

	var n = round(note, 1);
	var tune = note - n + 0.5;
	var snd = MdaPiano.ar(freq: n.midicps, tune: tune, gate: 1, vel: 64,
		decay: decay, release: release, hard: 0.5, velhard: 0.8,
		muffle: 0.8, velmuff: 0.8, velcurve: velcurve, stereo: stereo_width,
		random: 0, stretch: 0, sustain: 0.1);
	Out.ar(out_bus, snd)}
).writeDefFile("/output/path/")
)

```

I still need to implement the rest of the functionality from the built-in [piano synth](https://github.com/samaaron/sonic-pi/blob/fc245e07714eea766821f86b0bee77ff50abcead/etc/synthdefs/designs/sonic_pi/synths/traditional.clj#L60), but it’s looking promising 😃. I don’t suppose you’ve got an example I could use as a reference for how things like the `varlag`, clipping/scaling, envelope etc. would be done in SuperCollider?

Thanks a lot for your help!  
Emlyn

---

_[View the full topic](https://in-thread.sonic-pi.net/t/modifying-and-compiling-synthdefs/2143)._
