I want to import sound from a file, record, and import sound.

  (*Audio Import Browse*)
  Audiopath1 = 
    FileNameJoin[{$UserDocumentsDirectory, "Audio.wav"}]}, 
  Column["Audio File (.wav) " 
    {Row[{InputField[Dynamic[Audiopath1], String, Enabled -> False], 
       FileNameSetter[Dynamic[Audiopath1], "Open", {".wav" -> {"*.wav"}}]}]}],
 (*Audio Record*)"Audio \Record", 
 Button["Record", Sound[SystemDialogInput["RecordSound"]]]]
  • $\begingroup$ For import of sound files, try ?Import for exporting, try ?Export for recording, see this thread mathematica.stackexchange.com/questions/4451/… $\endgroup$
    – bill s
    Commented Apr 23, 2013 at 10:58
  • $\begingroup$ Do you mean "I want to import sound from a file, record, and export sound."? $\endgroup$
    – m_goldberg
    Commented Apr 23, 2013 at 13:40
  • $\begingroup$ If I click browse button, It will Import sound from file. If I click a record button, It will record sound and show the waveform $\endgroup$ Commented Apr 24, 2013 at 6:48

1 Answer 1


You have to use Method -> "Queued" to make the frontend to wait for the input from the sound recorder before finishing dynamic evaluation:

DynamicModule[{input = "ExampleData/rule30.wav", sound = ""},
    Row@{"Record: ", Button["Record", sound = SystemDialogInput@"RecordSound", 
       Method -> "Queued"], Button["Reset", sound = ""]},
    Row@{"Import: ",
            (input = #; If[(input =!= $Failed \[Or] input =!= $Canceled) && 
            FileExistsQ@input, sound = Import@input]) &], "Open",
            {".wav" -> {"*.wav"}, ".*" -> {"*.*"}}],
         InputField[Dynamic[input], String, Enabled -> False]},

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.