# music.playInstructions() missing?

**URL:** https://forum.makecode.com/t/music-playinstructions-missing/3348
**Category:** Help
**Created:** [September 3, 2020, 11:11pm UTC](https://forum.makecode.com/t/music-playinstructions-missing/3348 "2020-09-03T23:11:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kwx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kwx/32/1545_2.png) [@kwx](https://forum.makecode.com/u/kwx)
#### Post date: [September 3, 2020, 11:11pm UTC](https://forum.makecode.com/t/music-playinstructions-missing/3348/1 "2020-09-03T23:11:28Z")

</div>

[https://arcade.makecode.com/developer/sound#sound-instructions](https://arcade.makecode.com/developer/sound#sound-instructions) mentions a `music.playInstructions()` API, does that currently work?

For background, I wanted to try modifying a white noise effect. The `playMelody` API works using `music.playMelody("~5 !200", 60)`, but it’s not very flexible.

I tried creating a sound instruction buffer, but got stuck trying to play it:

```auto
const mySound: Buffer = hex`0500010102027f7f00000101`;
music.playInstructions(mySound)

```

This shows an error in the editor: _Property ‘playInstructions’ does not exist on type ‘typeof music’._

I poked around in pxt-common-packages/blob/master/libs/mixer/melody.ts , and it doesn’t look as if `playInstructions(buffer)` exists. There’s a `queuePlayInstructions(when, buffer)`, but that’s apparently not exported?

Am I missing something, or is this currently not implemented?

As a side note, it seems that the noise output ignores the frequency. That seems by design for white noise, but it’s not very flexible. Would you be open to adding a simple square wave + pseudorandom selector combination, similar to what the 8-bit Atari POKEY chip used? See [https://www.atariarchives.org/dere/chapt07.php](https://www.atariarchives.org/dere/chapt07.php) for more discussion of that. Maybe expose this as a new implementation of the removed-but-still-documented metallic waveform? (See pxt-common-packages PR #875.)

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [September 3, 2020, 11:23pm UTC](https://forum.makecode.com/t/music-playinstructions-missing/3348/2 "2020-09-03T23:23:43Z")

</div>

Ah, sorry! I think you found the correct function and at some point we made it private.

Add this to your project to get it back:

```auto
namespace music {
    //% shim=music::queuePlayInstructions
    export function playInstructions(timeDelta: number, buf: Buffer) { }
}

```

The actual function is implemented in C++, that’s why there’s no body. The shim annotation tells the compiler to link things up correctly.

---

<div class="post-metadata">

### Author: ![kwx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kwx/32/1545_2.png) [@kwx](https://forum.makecode.com/u/kwx)
#### Post date: [September 3, 2020, 11:31pm UTC](https://forum.makecode.com/t/music-playinstructions-missing/3348/3 "2020-09-03T23:31:35Z")

</div>

> [@richard](#):
>
> ```auto
> namespace music {
> //% shim=music::queuePlayInstructions
> export function playInstructions(timeDelta: number, buf: Buffer) { }
> }
> 
> ```

Thanks, that works perfectly. In case it helps someone else, here’s my current sound effect after some tweaking:

```
// ww = waveform
// ffFF = frequency, low byte first
// ddDD = duration in milliseconds
// vvVV = volume
// wwWW = end volume
// ggGG = end frequency 
// ww--ffFFddDDvvVVwwWWggGG
const mySound: Buffer = hex`050001010101111100000101`;
music.playInstructions(0, mySound)

```

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [September 3, 2020, 11:33pm UTC](https://forum.makecode.com/t/music-playinstructions-missing/3348/4 "2020-09-03T23:33:30Z")

</div>

Also, here’s some code you might find useful:

> **[pitch-and-amp-envelope](https://arcade.makecode.com/04565-72842-09513-65249)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I wrote this a while ago. It’s a snippet of code to generate sound buffers with separate envelopes for amplitude and pitch. Press A to here a sound effect
