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?
Related
I would like to list all the input devices available when I launch an application, but I can't find a way to do that in the API.
How can I get a list of available keyboards, mice, gamepads, touch screens, accelerometers...
Haxe is a programming language that compiles to other languages. There are projects that use the compiled haxe code to deploy to different runtimes. For example the NME framework compiles to neko, html5, flash, mobile etc. So your question doesn't really make the strictest sense.
I doubt there is an api for getting a list of the available input devices in nme as generally it will be evident. You could however go through the api one input at a time to test if its available or working I guess.
Do you have a special need for this? generally people usually use compiler conditionals to determine these things eg;
#if mobile
//your touch input code
#elseif desktop
//your mouse / keyboard code
#end
There is exist Joystick API in OpenFL for gamepads.
Each event has an “device” property, which specifies which input device the event is coming from. In this way, you can support multiple joysticks or (probably) gamepads in one game.
http://www.joshuagranick.com/blog/?p=692
I would like to make a sound synth using the Corona SDK, which means in pure Lua. All the Lua synth programs rely on an underlying C program. Is there any Lua library that generates waveforms?
I have no experience when it comes to Audio.
But here are a couple of links to get you started!
http://www.coronalabs.com/blog/2011/07/27/the-secretundocumented-audio-apis-in-corona-sdk/
http://developer.coronalabs.com/forum/2012/02/09/drone-fx
I don't know if Corona has an audio API that would allow that, but the MOAI SDK is a free, open source, Lua-based engine that targets iOS (+ Android, PC, Mac, Linux) which you could add anything you want to.
Unfortunately, Corona SDK has very weak sound support, and there are not good Lua audio libraries that I know of. MOAI appears to be dead, or mostly dead.
AudioKit seems like the way to write synthesis these days, but it is Swift & Objective-C only. Would love to see it in Lua, but there does not seem to be a push in that direction:
http://audiokit.io/
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.
I'm looking for an audio processing language or library which will allow me to experiment with different synthesis techniques. I've looked at Processing which I think is great at what it does, but haven't found any inspiring (and simple) audio libraries.
As a baseline, I want to simply create my own sample buffers and play them back (ideally in realtime). As a plus, the ability to handle MIDI events would be great. I'm an experienced C++ programmer so I could do it natively on but had hoped there was a more DSL (domain specific language) approach.
I have access to Windows, Mac or Linux so not too bothered yet about platform. Other languages I can deal with are C#, Java & Python.
Thanks
James
Depending on how much you want to stay out of the low-level housekeeping details, you may want to look at CSound , or if you want to not actually write code, the patching-based system PureData is great to work with. As #Lou points out, ChucK is interesting (but was too buggy to use the last time I checked it out).
If you really do want to write code, look at the Synthesis Toolkit, a set of C++ classes for audio processing and synthesis.
For an app framework, I recommend JUCE, which has incredibly nice cross-platform handling of audio/midi IO and GUI elements.
Max MSP is an audio production tool that is highly expressive.
I guess you could say it's a high-level tool, and not a low-level programming language. My impression of it is that it's geared towards the technical musician or the artistic engineer, but anyway it kicks ass and you could go low-level with it if you want.
I've always been a big fan of SuperCollider. It's designed for Mac OS X but also works on Linux.
The language is mostly based on SmallTalk, and it's pretty easy to pick up if you understand the basics of functional programming. The quality of the sound output by the SC Server is very good and there is plenty of documentation both built into the app environment and available online.
One interesting point of SuperCollider is the usage on android devices, and it's intercommunication with python trough out other modules.
Here goes an example
I know you didn't say Ruby, but check out Archaeopteryx
https://github.com/gilesbowkett/archaeopteryx/wiki
or ChucK
http://chuck.cs.princeton.edu/
Have a look at NAudio, an open source .NET audio SDK for working with audio files and devices in Windows. Some features include:
http://naudio.codeplex.com/
NAudio Features:
Play back audio using a variety of APIs
Decompress audio from different Wave Formats
Record audio using WaveIn, WASAPI or ASIO
Read and Write standard .WAV files
Mix and manipulate audio streams using a 32 bit floating mixing engine
Extensive support for reading and writing MIDI files
Full MIDI event model
Basic support for Windows Mixer APIs
A collection of useful Windows Forms Controls
Some basic audio effects, including a compressor
Is there a freely available library to create a MPEG (or any other simple video format) out of an image sequence ?
It must run on Linux too, and ideally have Python bindings.
I know there's mencoder (part of the mplayer project), and ffmpeg, which both can do this.
ffmpeg is a great (open source) program for building all kinds of video, and converting one type of video (a sequence of images in this case) into other types of video.
Usually it is utilized from the command line, but that is really just a wrapper around its internal libraries. It is expressly available to be used from within another program.
There are also python bindings that wrap the c api, though this particular project doesn't seem to be getting the best support (there are probably other projects out there doing the same thing).
There's also this link where someone has used ffmpeg to do something similar to what you're looking for.
GStreamer is a popular choice. It's a full multimedia framework much like DirectShow or QuickTime, has the advantage of having legally licensed codecs available, and has excellent Python bindings.
in c++ OpenCV (open source Computer Vision library from Intel) let you create an AVI file and just push frames inside...
but it's like shooting with a cannon to a fly.
Not a library, but mplayer has the ability to encode JPEG sequences to any kind of format. It runs on Linux, Windows, BSD and other platforms and you can write a python script if you want to use it with python.
ffmpeg has an API and also python bindings, seems to be the way to go !
Thanks
ffmpeg minimal runnable C example
I have provided a full runnable example at: How to resize a picture using ffmpeg's sws_scale()?