The zip file contains 3 separate MEX file dlls, one for asio, one for windows audio, and one for directx.
See the included pa_wavplay.m, pa_wavrecord.m, and pa_wavplayrecord.m for documentation.
pa_wavplay uses the open source portaudio API.
Matt Frear (2021). pa-wavplay (https://www.mathworks.com/matlabcentral/fileexchange/4017-pa-wavplay), MATLAB Central File Exchange. Retrieved .
Thanks for your contribution!
Very useful package - just too bad with Windows lack of synchronous record and playback...
I want to query the audio devices to find the right audio device ID (pa_waveplay crashes if you access non existing devices).
For this there is the .MEX files pawavplaya and pawavplayx. However, the utilities just outputs to the screen. I need to query programmatically so is it possible to get the source code for the MEX files to modify into a function? So far my work around is to dump the screen text into a diary file and load and parse but this does not work in deployed mode.
thanks a lot for this piece of SW. I have two questions:
- is it possible to select to which channels the playback goes (I'm using RME Fireface UC with 8 in and 8 out channels)?
- what is the bit depth used for playback, is it possible to select it? I need 24 bit resolution...
I had some problems dropping samples using 16 channels at 48 kHz with certain computer/sound card combinations. For me, the Lynx Studio AES16 dropped samples when I went to Windows 7 but when I switched to the AES16e, it worked perfectly.
I think this tool would be even better is if the size of the buffer were exposed.
I am unable to run the functions, mainly because I can't* get the MEX files working in Matlab 2014a. Can I get instructions how to compile or run the functions in my Matlab version. I looked online and the information is really incomplete concerning DLL files.
Thanks for the help!
OK -- the new (64-bit) version is back up. Had to use GitHub to store the files. Enjoy.
Bad news: Mathworks removed the 64-bit pa-wavplay. Apparently, new submissions can no longer contain MEX files -- and pa-wavplay, both old and new, relies on MEXs. My apologies. I'm working on a work-around.
I love this tool. So far, it's main limitation for me has been that is only works on 32-bit versions of Matlab.
So, I went and found the original code on SourceForge and re-worked it so that it now runs on both 32-bit and 64-bit versions of Matlab. Further, I have added WASAPI audio (the newest form of Windows Audio for Win Vista and later) to its capability.
The Matlab call structure remains unchanged, so it should be backward compatible with existing code.
It can be found by searching for "pa-wavplay 32-bit and 64-bit". Hope this helps someone else also.
Follow up on my previous comment: I have pa_wavplay working now on a 64-bit Win 7 machine with MATLAB R2013b(32-bit). The digitizer is a PreSonus FP-10 with Firewire interface and the PreSonus ASIO driver. My experience agrees with what Philippe-Aubert Gauthier reported below in 2010: pa_wavplay still works but you must use a 32-bit version of MATLAB.
Has anyone been able to compile an update for Win 7 64bit that works with the current version of Matlab?
Great!It's just what I am looking for~~~
What is is the maximum number of channels that it can support?
I plan to use about 64 Inputs. I can manage to find a 64 Input sound card. But, is it possible to record all those channels using this code?
Does this support synchronous or asynchronous audio IO?
Pretty good stuff, my only gripes would be my inability to turn off the printed text "Playing on device (x)" and "Recording on device (x)", probably because I'm a DLL novice. Also, the lag between recordings (see Daniel Oberfeld's comment) was an issue for my planned use. Nevertheless, great coding and thanks!
Really useful code, thanks. Is there (or could there be) an option to suppress the text output that seems to be standard. Whenever I play a sound using pa_wavplay, I get output such as:
Using ASIO driver
Playing on device 0
This can be reassuring, but it is problematic if (say) you're trying to test whether someone can hear the sound or not.
Good job! Works well with Lexicon Ionix u82s ASIO.
Following my previous comment, here is my recent advice. On win64 bits, I have not been able to run pa_wavplay in Matlab 64 bits. Using Matlab 32 bits in Win 7 64 bits, I have been able to run pa_wavplay without any problem with a 96-channel system made from MOTU sound cards.
Anybody heard about a a win64 compiled version of the pa_wavplay's sll?
Works well with my Creative E-MU 0202 USB SoundCard
Worked extremely well out of the box! Why hasn't something like this been incorporated into Matlab yet?
Fantastic; it worked straight away with my Digigram VXPocket 440 soundcard (4 outputs and 2 inputs); many thanks!
I am wondering if pa_wavplay is working with ASIO or ASIO2? Since it is from 2003, and I think (?) that ASIO2 are from 2002-2003?
A really great set of functions. I am now using pawavplaya directly and wondering why (by comparison with "soundsc" or "sound" in Matlab) it is not possible to make something else (in the command window) when "pawavplaya" is running ... "sound" seems to be based on "playsnd" which does not stop the access to the command window. Anyway, the functions are so great that I must admit that without that I would not have been able to finish my PhD on time!
Very good software, but I've got a mistake with memory management: I have put the function call 'pawavplayw' into a loop to continuously record 1 second samples, but it uses more and more memory, and Matlab crashes after about 50 iterations.
So do anyone have the solution to this problem?? (how to release memory between each iteration?)
First of all how do I get this application to run.I am new to matlab so please would someone give me a step by step guide on how to do this.I want to play a wav file that has 5 columns in matlab so i understand pa_wavplay can do that.However,I realised the setup is quite straight.What other supporting libraries do i need to download and where do i install what.do the dll's go into my matlab working directory or somewhere else?
Too many questions,please help
I would love some follow up concerning using this file with the MBox since that was the only negative review. grazi: email@example.com
Once again Matt Frear amazes us with his amazing talents and produces software that exceeds even our most lofty expectations. Well done Matt!
I can't seem to get any sound in or out using M-box (I've installed the ASIO core drivers available on Digidesigns homepage)! :(
Great, exactly what I was looking for... Tried to code something myself with PortAudio, but this tool saved me loads of time.
1) Would be nice if one could control the latency between input and output. I use an RME Digi 9636 and the recodings always have some 100 ms of silence at the beginning.
2) Sometimes I get 'truncated playback': the last few ms of a sound are not played. I use a simple workaround by padding the sound with 100 ms digital 0.
Works great! Very useful!
ASIO works great with the Echo Gina3G multichannel card. Thank you!
Excellent job. Its very helpfull. :)
very nice, but with 'async' mode support, this package will be more and more useful. Regarding 'async' mode, see "help wavplay";-)
Very neat and nice indeed! I think you're using PortAudio. Thanks!
This is simply the best piece of software ever written.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!