Skip to main content Skip to navigation

Basic audio in EDEN on Windows

To extend EDEN on a Windows platform so as to play simple audio files in .wav format you can download the 'sound' directory from here. To enable the procedure playsound(), you should include the file 'sound.eden' within the 'sound' directory. The contents of the file sound.eden, as created by Antony Harfield, are as follows:

%eden

## Load the sound extensions (snack)

tcl("
foreach f {./libsound.so ./libsound.dll ./libsound.dylib} {
   if {[file exists $f]} {
      if {[catch {load $f}]==0} break
   }
}
snack::sound snd
");

## Procedure to play a sound from a wav file

proc playsound {
   para filename;
   tcl("snd read {"//str(filename)//"}\n snd play");
}

You can test this out using the audio file tosoon4noon.wav within the 'sound' directory by invoking the EDEN command:

playsound("tosoon4noon.wav");