Audio Note in an Envelope uses
If( playFromMemory & useSoundPlayer, // from memory
mmdll << PlaySoundA( Blob To Matrix( riffblob, "float", 8, "native" ), 0, 5 )//
, // else via file
filename = Save Text File( "$desktop/note.wav", riffblob );
If( useSoundPlayer,
mmdll << PlaySoundA(
Blob To Matrix( Char To Blob( filename ) || Matrix To Blob( [0, 0, 0, 0, 0, 0, 0, 0, 0], "int", 1, "little" ), "float", 8, "native" ),
0,
131073
)
);
);
the PlaySoundA entrypoint in the DLL can't overlap audio files and is a bit arcane and needs a bit of setup.
Plucked note synthesis and Mandelbrot Sound use
wavname = RiffUtil:WavWriter( "$temp/rotate.wav", bigbuf );
Open( wavname );
and Midi (music) File Editor is similar, Open( temp ), for a .mid file extension. Open() opens the built in player. The midi player example uses two files because the open player keeps the other one in use.
Using a Project for a Project uses (This is the best way to play overlapping sound files.)
pgm = Eval Insert( "(New-Object Media.SoundPlayer \!"^filename^\!").PlaySync();" );
//write("\!npowershell ",pgm);
Insert Into(Audio:rphandles,
Run Program( executable( "powershell" ), options( {"-c", pgm} ), readfunction( Function( {this}, Write( this << read ) ) ) )
);
This project is a side-scroller game with a rich sound tapestry to enhance the ambiance...
Pumpkin Rush uses the built-in speech function to make an ooomph! sound. (This, and the beep function, are easy but not very flexible.) Another game. Beware the shaking screen!
Working with WAV files appears to write a file to disk but not actually play it. Wav files have a modestly complex format to hold a set of samples (mono, stereo, 48 ... 8 kHz, ...)
As much as I love audio, I was never able to justify spending time adding audio support to a statistics package. If you have a great use-case, add it here!
Craige