Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

Manipulate[{
  (*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"]]]]
share|improve this question
    
For import of sound files, try ?Import for exporting, try ?Export for recording, see this thread mathematica.stackexchange.com/questions/4451/… –  bill s Apr 23 '13 at 10:58
    
Do you mean "I want to import sound from a file, record, and export sound."? –  m_goldberg Apr 23 '13 at 13:40
    
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 –  Oropher Telemna Apr 24 '13 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 = ""},
 Panel@Column@{
    Row@{"Record: ", Button["Record", sound = SystemDialogInput@"RecordSound", 
       Method -> "Queued"], Button["Reset", sound = ""]},
    Row@{"Import: ",
         FileNameSetter[Dynamic[FindFile@input,
            (input = #; If[(input =!= $Failed \[Or] input =!= $Canceled) && 
            FileExistsQ@input, sound = Import@input]) &], "Open",
            {".wav" -> {"*.wav"}, ".*" -> {"*.*"}}],
         InputField[Dynamic[input], String, Enabled -> False]},
    Dynamic@sound
    }]

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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