pa_wavplay was written by Matt Frear and Johnson Chen of MARCS Lab at University of Western Sydney. Portaudio was written by Ross Bencina and others. Several other freely-available Matlab toolboxes use pa_wavplay as the interface to a sound card.
The initial exploration of the Scilab port was helped by investigations by Aurelie Voisin and Mathias Krauss of ENSEEIHT Toulouse, who both worked en stage at DCU in Summer 2008.
This package enables:
The source code also works fine for Scilab v5.0.2.
http://www.microsoft.com/express/2005/download/default.aspx
Don't forget the service pack:
"Microsoft Visual Studio Express Editions 2005 Service Pack 1"
available from that page.
2. You will also require an appropriate Platform SDK; I used the Windows Server 2003 Platform SDK:
http://www.microsoft.com/express/2005/platformsdk/default.aspx
3. You will also need Portaudio version 18.x. I used:
http://www.portaudio.com/archives/portaudio_v18_1.zip
4. Copy the following files from the Portaudio distribution into the
directory
where you have unzipped the scilab pa_wavplay distribution:
Portaudio_v18_1\pa_common\pa_lib.c
Portaudio_v18_1\pa_common\portaudio.h
Portaudio_v18_1\pa_common\pa_host.h
Portaudio_v18_1\pa_common\pa_trace.h
Portaudio_v18_1\pa_win_wmme\pa_win_wmme.c
5. (Warning: this is a horrible kludge!)
Make a backup copy of the following file in the Scilab installation
directory:
C:\Program Files\scilab-4.1.2\Makefile.incl.mak,
such as:
C:\Program Files\scilab-4.1.2\Makefile.incl.mak.gold.
6. In Makefile.incl.mak, just before the line:
CC_COMMON=-D__MSC__ -DWIN32 -c -DSTRICT -D__MAKEFILEVC__ -nologo $(INCLUDES) $(DTK) $(DPVM) $(DMKL) $(USE_MT)
place the following text as a new line:
USE_MT=-MT
7. Run Scilab, and CD to the directory containing the Scilab pa_wavplay code.
8. type:
exec builder.sce
to build the dll sci_wavplayw.dll.
9. Run Scilab and "cd" to the directory in which you built pa_wavplay, or unzipped the distribution package. Type:
exec loader.sce
to load the new dll, and its associated Scilab function pawavplayw.
10. Type:
pawavplayw()
to determine the sound device numbers to use in the next step.
11. Type:
exec test_swp.sce
to test the new dll. You may wish to physically connect "line out" to "line in" to do a loop-back test.
12. The DLL and a set of Scilab macros that match the original Matlab m files may be loaded by typing:
exec pa_wav.sce
Following execution of the above, the macros:
pa_wavplay()
pa_wavrecord()
pa_wavplayrecord()
are available to the user. This may make it easier to port existing Matlab code that uses pa_wavplay.
NOTES:
======
i) If Scilab cannot find "windows.h" (which is in the Platform SDK but not part of the basic Visual Studio Express) you could follow the advice given on:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=269821&SiteID=1
ii) pawavplayw() returns a report on all available (WMME) sound devices.
iii) There is a large delay ("latency") between the start of playback and of recording. This may be adjustable in the PortAudio code.
iv) steps 5. and 6. above are neccessary (but only in v4.1.2, and NOT in v5.x) because the distributed Scilab v4.1.2 binary is compiled with multi-threading turned off ("USE_MT="), but there are no single-threaded run-time libraries available with Visual C++ 2005 Express Edition.
updated: 8 July, 2011.
Original: 22 October 2008.