# How to automatically play a sound file after importing

I want Mathematica (Version 11.0.1.0) to automatically play a specific sound file after importing from the hard drive without any user intervention other than opening the notebook. Here is what I have tried:

SetDirectory["D:\\MyTestDirectory"];
mysound = Import["Two_musical_notes_overlap-for-test.wav"];
EmitSound[mysound]


After that cell is evaluated I get a dialog box with a play button that the user has has to click on to get the "wav" file to play. I do not want the user to have to do anything other than evaluate the cell which will cause the sound to be played. It would be nice if I could even suppress the sound dialog box from even appearing but I'll be happy with just getting this to play automatically.

• The observed behavior is due to that fact that in the current version, your sound file is automatically imported as an Audio[] object instead of as a Sound[] object. (It does sound confusing...) – J. M. is in limbo Dec 31 '16 at 9:20
• Out of curiosity: what \$Version are you using? 'Cause I have no problems with s = Import[ "ExampleData/rule30.wav"]; EmitSound[s] on 10.4.1 for Linux x86 (64-bit). – corey979 Dec 31 '16 at 14:56
• @J.M. it sounds confusing made my day. – Marius Ladegård Meyer Dec 31 '16 at 15:26
• @corey979 - I am using Mathematica 11.0.1.0. The latest version. I have modified my question to include that information. – frequencydrive Dec 31 '16 at 20:49

f = Import["ExampleData/rule30.wav", "Sound"];

• SoundAudioToSound`? – yode Mar 30 '17 at 14:01