# Macros for code snippets in Sonic Pi

**URL:** <https://in-thread.sonic-pi.net/t/macros-for-code-snippets-in-sonic-pi/3889>\
**Category:** Support, Help & Resources\
**Created:** [May 20, 2020, 4:54pm UTC](https://in-thread.sonic-pi.net/t/macros-for-code-snippets-in-sonic-pi/3889 "2020-05-20T16:54:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GranddadGotMojo](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/granddadgotmojo/32/34_2.png) [@GranddadGotMojo](https://in-thread.sonic-pi.net/u/GranddadGotMojo)\
**Post date:** [May 20, 2020, 4:54pm UTC](https://in-thread.sonic-pi.net/t/macros-for-code-snippets-in-sonic-pi/3889/1 "2020-05-20T16:54:48Z")

</div>

I have recently started doing live coding with sonic pi again. I did quite a bit of it a couple of years ago. I noticed on the latest @samaaron live coding that he looks to be using macros for commonly used snippets of code. Like ll bd generating the sample code block live loop for bd\_haus. Can you tell me how you did this?

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [May 20, 2020, 4:58pm UTC](https://in-thread.sonic-pi.net/t/macros-for-code-snippets-in-sonic-pi/3889/2 "2020-05-20T16:58:29Z")

</div>

Hi Mike,

have a look at [this issue](https://github.com/samaaron/sonic-pi/issues/587), which helps using this unofficial and at-some-point-maybe-depricated feature. I use it quite regularly and think its very handy.
