# Exporting MIDI within a Manipulate interface

**URL:** <https://community.wolfram.com/t/exporting-midi-within-a-manipulate-interface/2929>\
**Category:** Questions\
**Tags:** audio-and-music, mathematica, import-and-export, interface-construction\
**Created:** [August 11, 2014, 6:29pm UTC](https://community.wolfram.com/t/exporting-midi-within-a-manipulate-interface/2929 "2014-08-11T18:29:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jstewart](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jstewart](https://community.wolfram.com/u/jstewart)\
**Post date:** [August 11, 2014, 6:29pm UTC](https://community.wolfram.com/t/exporting-midi-within-a-manipulate-interface/2929/1 "2014-08-11T18:29:31Z")

</div>

I have an audio interface element that is produced within a Manipulate command

 ![2014-08-11_14-25-11.jpg](https://global.discourse-cdn.com/wolfram/original/2X/3/379b0055a93968a8c4b8e9bb9d656bc27f55c355.jpeg)  
.

How do I allow an export of this as a MIDI (.mid) file within the Manipulate command. This is being done within Mathematica 10 and I just want to produce the file locally (I say this because I understand there are export restrictions on non-enterprise cdfs)

Thanks,  
John

---

<div class="post-metadata">

**Author:** ![dreiss](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dreiss/32/29094_2.png) [@dreiss](https://community.wolfram.com/u/dreiss)\
**Post date:** [August 12, 2014, 4:22pm UTC](https://community.wolfram.com/t/exporting-midi-within-a-manipulate-interface/2929/2 "2014-08-12T16:22:08Z")

</div>

Here is one possible approach:

```
Manipulate[
 DynamicModule[{sound},
  sound = Sound[{SoundNote["C"], SoundNote[note], SoundNote["C5"]}];
  Column[{sound,
    Button["Save",
     Catch@Module[{file},
       file = SystemDialogInput["FileSave", ".mid"];
       If[file === $Canceled, Throw[$Failed]];
       Export[file, sound, "MIDI"]], Method -> "Queued"]}]
  ],
 
 {note, {"A", "B", "C", "D", "E", "F", "G"}}]

```

---

<div class="post-metadata">

**Author:** ![jstewart](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jstewart](https://community.wolfram.com/u/jstewart)\
**Post date:** [August 12, 2014, 10:08pm UTC](https://community.wolfram.com/t/exporting-midi-within-a-manipulate-interface/2929/3 "2014-08-12T22:08:57Z")

</div>

David,

Thank you for the help. I was able to use your approach.

John
