Processing standard audio output - audio

Is it possible to, with the use of Processing and Minim (or other libraries / languages), create an AudioInput like object to monitor any and all audio output?
For example I am working on a visualizer of sorts, but would like to allow another application to be playing the music rather than using the Playback class or something of the like.

On a Mac, you can use Soundflower to redirect audio through virtual drivers. Otherwise look into JACK Audio

Related

C++: How to capture the sound card's output?

I want to capture the audio the sound card is playing for my Java application.
Since there seems to be no way to do this using Java, I want to use C++, because I saw various posts that said that it was possible using C++. To implement the C++ code in Java I want to use JNI.
How could the C++ code to capture the audio look like?

Open field usage of Google Resonance Audio SDK

is there a scenario where we can use the Google Resonance Audio SDK not with headphones, but with real speakers (e.g. mounted in a 360° cyrcle setting)?
Or are all algorithms not working for real speaker outputs?
Thank you!
Currently, Resonance Audio is optimized for headphone playback. For example, HRTF processing is done in the Ambisonics domain, without generating (virtual) speaker signals - this is because it is a much more efficient way of generating binaural output.
However, in the Resonance Audio open source release, the Ambisonic Codec class can readily be used to decode Ambisonics to any arbitrary loudspeaker array. To use that with the rest of the Resonance Audio system, however, it would be necessary to modify/extend the audio processing graph by adding a new decoder node.
Please, feel free to add a feature request and, depending on popularity, we might consider adding that in the future!

How can I access the audio output coming from a movie playing in processing?

I am working on a film analysis program, which retrieves data in realtime from a movie, that is playing in the same sketch. For analysing the sound I tried the minim library, but I can't figure out, how to get the audio signal from the movie. All I could do was accessing an audio file, I was loading into the sketch manually, or the line-in through the mic.
Thanks a lot!
Although GStreamer (used by the processing-video library) has access to audio, the processing-video library itself doesn't expose that at the moment.
You will need to use workarounds at the moment:
Extract audio from your movie and load straight into minim. (you can trigger audio playback at the same time as movie playback if you need to)
or use a tool to use system audio output as an input (minim get line in). On OSX you can use Soundflower. Another option is JACK and it's patch interface.

Is there a method to figure out the audio channel layout in Linux?

I'm making a player for Linux and I want to know the audio channel layout (stereo, 5.1ch, etc) of user's system (not channels included in media file).
For now, it's set by user but I want to implement an auto-detection of channel layout.
Is there any (de-facto) standard method to accomplish this?
If not, can I find a solution for ALSA at least?
In ALSA, the default device typically supports only stereo.
You can try to open a device named front, surround40, surround51, or surround71, but these devices do not have automatic sample format conversion or software mixing.
The best idea would be to use PulseAudio, and to ask the server for the channel map of the sink.

How to play sound in lua

How to play sound in lua? Is there any simple trick how to do it?
My goal is to play some ogg (or mp3) files during playing my game, which is programmed in lua. It's running on windows.
Lua does not have any built-in sound APIs. As you are on Windows, you have these options:
Write bindings for a sound system of choice (OpenAL or something more high-level — as a separate non-Lua-specific question if you need help picking one).
Use LuaJIT2 FFI to directly access DLL functions of the sound system of choice.
Otherwise, if you do not use LuaJIT2, use Alien FFI library.
Or, indeed, use LuaCOM to play some sound (with DirectSound?), if you're familiar with COM stuff.
Lua doesn't have any native sound APIs. If there is a plugin/extension for Lua to accomplish audio control/playback, you'd have to go dig that up seperately. Or if Lua supports COM, you could speak to the Windows audio facilities directly.
proteaAudio is a pretty easy library for lua to play audio or even generate audio on the fly.
You can use the Corona library:
--Loads the selected audio (make sure the name is the same as the .wav file)
local audio1 = audio.loadSound( "audio1.wav" )
--Plays the audio on any available channel (theres up to 32 channels)
local audio1Channel = audio.play( audio1 )
source: http://docs.coronalabs.com/api/library/audio/play.html
In windows, use luacom
require('luacom').CreateObject("wmplayer.ocx").URL="my.mp3"--Need to keep host process alive, not to close.

Resources