Message Boards Message Boards

0
|
2522 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Error with AudioRecord[]: An internal error occurred

Posted 1 year ago

I am new to Mathematica and have just started to use its Audio features. When I evaluate

recording = AudioRecord[]  

I get this error message "AudioRecord: An internal error occurred: the file could not be opened."

What do I need to do to keep from getting this error?

POSTED BY: Richard Savage
3 Replies

I didn't realize WL built-in symbols always start with an uppercase. So I agree with your suggestion. Also, thanks for correcting my "If statement".

POSTED BY: Richard Savage

This

if[FE, , DeleteFile[FILENAME]];

should be

If[FE, DeleteFile[FILENAME]];

WL built-in symbols start with an uppercase letter. Better to avoid using symbol names that start with an uppercase letter to avoid potential conflicts.

POSTED BY: Rohit Namjoshi

After digging through the Mathematica documention I was able to solve my problem using the following code:

NBDIR = NotebookDirectory[];
SetDirectory[NBDIR];
FILENAME = "rec2.wav";
FE = FileExistsQ[FILENAME];
if[FE, , DeleteFile[FILENAME]];
REC = AudioRecord[$DefaultAudioInputDevice, 
   GeneratedAssetLocation -> FILENAME];
AudioStop[REC];
AudioRecord[REC, MaxDuration -> 5.0]
POSTED BY: Richard Savage
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract