While LibSndFile has been updated for 1.3, PortAudio is still in-progress. There are a number of issues with binary packaging that I’ve been working through, but haven’t had time to get it fully wrapped up. It should more-or-less work on the julia1 branch (do pkg> add PortAudio#julia1 but it’s been in-progress for a while.
If you use the Atom editor with Juno (which I recommend in general because it’s a really nice experience for editing/running julia code), then LibSndFile will display as playable audio:
Yeah, progress has been sporadic, though things have moved along a bit. Now folks can use master rather than a random branch, and it also uses the new BinaryBuilder-based C binaries. Which issue are you referring to?
There are still some segfaults I need to work through and some build-system issues to add support for various audio backends (most notably PulseAudio devices don’t seem to be recognized by the ALSA backend for some reason).
You’ll have to uninstall WAV.jl if you want load to use LibSndFile instead, the issue is that the FileIO package prefers to use WAV so it will use that instead if it’s installed.
WAV is a separate package with a different maintainer from LibSndFile. WAV is a pure-Julia implementation of WAV file processing. LibSndFile can handle more file types but relies on a C library to do so.
Also, in case it’s not clear - I don’t maintain or use WAV.jl, it’s maintained by @dancasimiro. In addition to WAV file support it can play and record audio.
I maintain LibSndFile.jl and PortAudio.jl, which are separate packages for working with audio devices and files, respectively.
Besides the pure-Julia vs. binary library aspect, WAV.jl provides a more matlab-familiar interface and returns a tuple of an Array with the audio data and a sampling rate. LibSndFile returns a SampleBuf object, which is a wrapper around a raw array that includes the sample rate and some convenience functionality, like the widget display in Juno and Jupiter. I think WAV.jl has something similar, though maybe you need to call a function to show the widget.
Yeah, I think the current design makes that harder than it needs to be. You’re correct that currently the way to do it is to convert to FixedPoint values before saving (assuming that your processing is giving your floats). Originally the idea was that I didn’t want LibSndFile to do any automatic conversion, so if you read a WAV file and then wrote the contents back to disk it would be a lossless process. In practice you are almost always end up wanting to work with floats so the defaults should probably reflect that.
Sorry for all of the trouble with wavplay in WAV.jl. The mechanism that I used to detect libraries at runtime has broken over time. I could revert the complexity and always depend on the presence of pulse audio.
If I add “using MFCC” below then I no longer see the sound player, does its use of WAV internally somehow override? I am able to convert to a sampleBuf and then I see the player but I cannot play anything lower than at 3k samplerate, not sure this is a bug or a limitation of the OSX audio engine player through juno.
The audio libraries are in much better shape now than when this question was asked originally. For people like me who are migrating from Matlab and might find this discourse discussion, there is a simple sound function in this package: GitHub - JeffFessler/Sound.jl: Provide `sound` function for playing audio.
It is currently just a wrapper around PortAudio functions.