I am using GNUplot to plot large volumes of data that I want to visualize in 3D - e.g., using the pm3d option. This is very slow rendering in software - is there free software that will do this using OpenGL or something?
ROOT will do this.
This beast is one of the major analysis and visualization tools used in the nuclear and particle physics communities these days. It can move a lot of data fast, and has fairly sophisticated set of visualization tools, and supports OpenGL. You can do the work in compiled c++ code, in the cint interpreter, or using the python bindings.
The big downside is that you may have to read a lot of documentation before you're ready to begin.
Related
I was told this belongs in programming, not in the Signal Processing sub-exchange.
Is there a way to implement spectrum analysis (specifically FFT) on live audio in Windows?
I want to be able to read in audio from a microphone, and have a display on the screen that shows the resultant Fourier Transform.
It would also be useful if I could execute a program if a certain set of FFT characteristics occurred.
Thanks guys!
To do this you have a couple of options depending on your most preferred language/framework basically. I'm not sure how new you are to signal processing so I'll suggest a few options.
Visual Programming
These are all visual programming environments which don't actually require any writing of code, however Simulink and Pure Data both require a runtime for the user to run the program.
Simulink (Paid)
MathWorks/Matlab's visual programming tool that works really well in real-time (in my opinion). Using the Audio System Toolbox, you can easily capture microphone input from your system in realtime and carry out the FFT processing, plot the spectrum and, like you said, if certain FFT conditions are met then to carry out some further processing.
This isn't free software and requires having the Matlab/Simulink run-time installed to be used. You can also script your processing in Matlab's .m language as desired (a cross between Java, JS and C).
Max MSP (Paid)
A similar version to Simulink but developed as a standalone visual programming tool. This will allow you similar freedom to Simulink but I think it will be easier for re-distribution.
You can compile MAX MSP into executables to give to someone straight away. Here is a reference to get you started on using the FFT in MAX. Again, this isn't free but if you wanted to learn more about it then I think it's worth the money (if I recall it's not too expensive).
If you need some more custom processing than the built in modules, I believe you can design custom MAX modules using C or JavaScript. Max is designed to easily get system audio input / outputs and here's a link to get you started.
Bonus: You can design your own Ableton Live plugins with the Max4Live addon which just lets your MAX MSP projects get compiled into .VST format. So you can build custom FX if you are into music production.
Pure Data (PD) (Free)
A very bland open source version of MAX MSP but completely free. It may look dull at first but a lot of researches I know use it to build fairly complex systems that can do some serious data processing. There are also lots of community built extras for PD if you ever needed a custom module. Here is a link to get you started on the FFT in PD. You cannot compile applications with PD, but since it's completely free to install anyone can run your program after installing PD. Another link for troubleshooting audio I/O in PD (if it isn't working right out of the box).
Programming Languages
Now the visual stuff is a really good way to get started if you aren't already introduced to DSP or audio programming. Otherwise here a just a few options and links to get started and where I would recommend.
Matlab & Octave
Like before, the Audio Systems Toolbox supports realtime audio I/O within a Matlab script. This combined with Matlab's built in FFT function can have you setup programming realtime FFTs and plotting the response in no time at all (less than 10 lines of code or something).
Octave has it's own version of the FFT function and different backends for rendering plot responses, but no Audio Systems Toolbox. However, Playrec is also an opensource alternative for audio I/O in Matlab/Octave that supports realtime audio input and output.
(Octave is an open source equivalent to Matlab (Matlab needs a paid license to develop a program), but does not support all Matlab supported features).
Python
Due to the PyAudio module, realtime audio I/O and DSP is more possible using Python! I would recommend Python if you are just starting out for sure since it's a nice introduction into any programming language and can help with teaching the fundamentals of DSP before attempting lower level languages.
Here's where you can get started with real-time non-blocking audio I/O in Python with PyAudio. To plot your data you can use a library such as matplotlib (designed similar to Matlab's easy plotting functionality).
For your FFT there are multiple libraries out there but I'd start with the Scipy / Numpy one.
C
One of the classic (and sometimes) most daunting programming language. With no objects (unless you want to make them yourself) or other high level abstractions, C is one of the few languages that still feels like you're building a lot from the ground up (which personally I like).
To get started with audio, I'd look at, in my opinion, the most widely used cross-platform audio I/O library; portaudio. This will let you access the soundcard data inputs and outputs in realtime on Mac, Linux & Windows.
Once you get this up and running an FFT I would use to get started would be the KissFFT just because of it's pure simplicity to use. If you want to plot the data, I would maybe look at gnuplot, but this is'nt a very pretty route in terms of development.
If you are very new to programming I would not recommend this unless you really want to get stuck in.
C++
Both KissFFT and portaudio will also compile with C++ code, but here are a couple of higher level alternatives.
One of my favourites is the JUCE framework / development environment. It has built in cross-platform audio I/O and already has a custom FFT function as part of the framework. You can build custom VSTs for your music DAW if you want to as well. It also comes with 'easy' (if you know C++) access to graphics windows with higher level access to openGL, so you could get fancy when plotting your data in real-time. If i remember correctly, one of the Demo projects on first installation is a real-time FFT plot you can compile and see the input from your laptop mic. JUCE is free for personal use, but comes with a small license fee as an indie developer.
Otherwise another one that comes to mind is the QT C++ library/framework for UI design (mainly). This is a cross platform easy to use GUI designer, that also has high level classes for obtaining audio input from a Mac/Win/Linux mic. Here is just one example I came across using QT's multimedia classes and FFTReal to plot a realtime FFT spectrum.
Summary
I've suggested a lot of options, but also missed out a few other people may recommend like languages such as R, C#, Java, Rust etc... and there are so many suggestions it's impossible to cover them all but I think this should be enough to get started. If it were me in terms of experience:
Complete Beginner to Programming: Max MSP
Novice / Knows their way around a little bit: Python (with PyAudio)
Programmed in other languages maybe looking to gain more programming skills : C++ with JUCE
Any of these languages you pick will be good in future reference for software positions and many companies / researchers use them to prototype / develop realtime audio processing software.
This is just my opinion but hopefully this gets you well along your way!
I am about to find a 3d engine which is capable of importing 3d models, detect their collisions and support joints. It's needed for an interactive animation and no platform is specified jet. I would prefer to code Javascript or AS3, but I think to be able to handle this with Java too.
Does Away3d support this? Is their a plain 3D collision detection framework I could use additionally to it? Which is the easiest Java Framework and which creates best Quality?
BTW.:
Proprietary Frameworks might also be an possibility, but I just do not any.
Greetings philipp
Away3D has Awayphysics library that is alchemy port of C++ engine and show very good performance. Away3D has clean readable source code and documentation + good set of example projects. It has 3ds max plugin that can export scene and generate code to render it. Support popular formats like 3ds, obj... and You can write importer plugin for own format. All so developers are pretty cool guys that answer questions on forum :)
For JavaScript the most popular engine is three.js Look what it can do.
General thoughts:
WebGL support isn't good at this time(sometimes it depends not only on user browser but all so on drivers) and You will need to deal with cross browser headache. Flash isn't supported on IOS and get kicked more and more from device browsers. But there is cross-platform adobe air for standalone apps.
Javascript, in my opinion, isn't good for writing such projects and its debugging can cause permanent brain damage. WebGL shader language is GLSL that has nice C-like syntax. Ordinary Flash shaders are written on assembler but You may try pixelbender3d. At this time Flash shaders more limited than WebGL(for example you can't fetch texture in vertex shader) but it's done to make Flash more compatible and it's not a problem for most cases. WebGL is tightly integrated with page.
If you want java WebGL and like pain try GWT 3D engines or gwt-elemental and there is tree-js port at early stage.
x3dom is declarative WebGL 3D engine with fallback to Flash it is ez but pretty limited and unstable.
I'm searching for a 2D or 3D programming language (thats working with both Linux and Windows). I've tried Tao Framework, and GTK+ openGL, but both doesn't have many examples.
Anyone know one ??
Most of the commercial AAA games you can see are coded in C/C++, using OpenGL or DirectX to render to screen. Note that DirectX only works on Windows (and Xbox). However, to get started, I’d recommend something easier such as the SDL.
There’s heated debate about Java being suitable for games, and I won’t get into it: as this language is often deemed easier than C++ to grasp, you might want to give it a try, along with JavaGL if you are into oriented object programmation.
I am new to opengl and using C#,opentk for development. My Application is very light weight (just 2d graphics) and i am planning to use software rendering when hardware rendering is not available.
How do i make sure software rendering works on all computers ? (when hardware rendering is not available.)
Should i distribute Software rendering libraries like Mesa, myself. or it will already available on all (Windows) OS ?
in other words, opengl32.dll is always available on all modern windows OS ( > XP SP2 ) or should i distribute that also ?
( My Application is very simple (simple 2d graphics) as of now. I selected opengl instead of GDI+/WPF because, i may extend it to 3D in future. )
OpenGL is a system library. You should not distribute it with your application. Especially on Unix/Linux systems, where it should be installed using the distribution's package manager.
Since opengl32.dll is included in Windows, it falls back to Software Rendering automatically if the pixel format you chose in your application isn't hardware accelerated by the graphics driver.
I tried leveraging OpenTk as well, but in itself creates a dependency and - particularly as a newbie - doesn't really do anything but confuse learning OpenGL versus learning someone else's interpretation of the framework.
OpenGL is - as the other answerer suggested - a system library. With this, it's a functions contained in a C DLL which you import through the API.
OpenTK imports these functions for you, that's the only real benefit it adds, but in doing so, many of the types are reinterpreted as are the function calls as per the author of OpenTK.
This creates an additional learning curve - as most of the internet references you're going to find are going to be OpenGL - so not only will you be struggling with understanding OpenGL - which isn't easy - but you're also going to be dealing with OpenTK interpretations of the OpenGL standards.
Now keep in mind that MANY open source projects such as OpenTK start as open source until they get sufficient enough user base, when they convert over to a for profit model. So let's say you learn and become dependent on OpenTK, well if/when they switch to a for profit model and you're tapped on cash, you are SOL (Shit outta luck). Or you have to pay their price.
What I did was - I took the source for API mapping for OpenTK's OpenGL mapping and renamed everything as per my tastes. it's a bit of work, but it's worth the labor and it helped me get to understand OpenGL.
As for distribution. I have absolutely no external dependencies I rely on other than the OpenGL DLL which should already be on the system.
ALL the DLLs you need for OpenGl will ALREADY be preinstalled on any windows OS you're dealing with. I can't speak for other OS flavors, but I suspect this may be the case.
On a final note: OpenGL handles 'toggling between software and hardware rendering' innately. So libraries like MESA and OpenTK add VERY little value at HIGH potential costs.
What are those costs?
1) Redistributable packaging and licensing. They still come with a license and most license are subject to change at any time.
2) Conversion from open source or free distribution to a for profit model.
Invest in yourself. OpenGL documentation is vast and at times confusing, and my advice is to avoid the knee jerk temptation to 'take the easy' path versus the leverage other's models - for one simple reason.
I know you're using this for a 2d application. And even if you're using Orthogonal view, the fact of the matter is you're learning OpenGL with is a patterned with 3d in mind. So give yourself the gift up front of teaching yourself because there really is no 'easy path' to understanding 3d - and thus no real value add to the external dependencies you're leaning towards using.
One thing to keep in mind: Modeling. IF/when you switch to 3d modeling, doing vertex creation through hand coding in opengl is a bitch. I use Blender to create my obj models in and read those into my own c# application which reads in the 3d models and lets me manipulate them from there.
I HAD been using C++, which sure is faster, but once I converted the APIs to c# code and started managing my own memory leveraging the garbage collection model, it became SO much easier than having to learn someone else's library.
Dont use redistributeables. And leverage the code from OpenTK, with modification, but don't include OpenTK as a redistributeable.
That's my advice.
I'm using Emacs, with CLISP and Slime, and want to be able to draw pictures on the screen. I'm specifically thinking about drawing graphs, but anything that would let me draw basic shapes and manipulate them would be able to get me started.
Doug is right; CAPI will work fine. Other things you can try:
cltk: http://www.cliki.net/Lisp-Tk
I know that Allegro has something for Windows programming also, but I've never tried it.
What may also work is cells-gtk: http://common-lisp.net/project/cells-gtk/
Again, I can only tell you that it exists but not how bad it is or if it even really works...
I can not comment also on the quality of
http://www.cliki.net/GTK%20binding
But that's mostly what is available.
Corman Lisp probably has something to offer for Windows programming also.
Anyway, the choices on Windows are relatively slim. The you can probably have the most confidence in CAPI, which is used for the LispWorks IDE on Windows, Linux, MacOS X and on quite few big unices also...
Regards
I think I've found my own answer. Clojure seems to have everything I was looking for, just because I can now use all of the Java GUI items natively in LISP. It is a different dialect of LISP than the Common-Lisp I was using, but seems to have a lot of community support, and integrates with my Windows installation of Emacs either through SLIME or through the Inferior-Lisp interpreter. So far I've been very impressed.
Oh, a code sample:
(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
Any guesses what this does? :)
Bill Clementson's blog has quite a bit on Clojure, including a lot of helpful posts on installing it. See here: his posts on Clojure
You could switch from CLISP to the free LispWorks Personal Edition and use the CAPI Graphics Ports drawing API.
Or you could use Lisp's Foreign Function Interface and use one of the graphics toolkits available for your OS.
For rolling your own (like you said, basic shapes) try Lispbuilder-SDL or one of the cl-cairo FFIs (it's just my guess that the latter work with MS Windows, though).
I know this is an old post, but so the information is here for others like me who find this thread looking for the same thing.
This library for tk bindings in common lisp seems to work fairly well.
http://www.peter-herth.de/ltk/
Clojure is an excellent Lisp, and Swing is a solid (if not particularly visually exciting) windowing toolkit. If you want do do more advanced graphics and/or dabble with game programming you might want to check out Slick, which is a general purpose graphics/game library that sits on top of Swing and gives you access to OpenGL and lots of other stuff.
I've found the Clojure/Slick combination an excellent way to do exploratory graphics programming, as you can interact with the graphics window directly from the REPL.
There's cl-cairo2 - a binding to Cairo vector drawing library. It can be used to draw various pictures on various surfaces. There's a cl-2d library that uses cl-cairo2 to draw charts.
And there's cl-gtk2 - a binding to Gtk+ library. You can create widgets that are drawn with cl-cairo2 (or cl-2d) that draw what you want.
CLISP users might find The following useful for their graphics applications:
cl-vectors is a pure Common Lisp
library to create, transform and
render anti-aliased vectorial paths.
It can be installed using
ASDF-Install.
http://projects.tuxee.net/cl-vectors/
Vecto is a simplified interface to the
powerful CL-VECTORS vector
rasterization library....the results
can be saved to a PNG ... Since Vecto
and all supporting libraries are
written completely in Common Lisp,
without depending on external non-Lisp
libraries, it should work in any
Common Lisp environment. Vecto is
available under a BSD-like license.
The current version is 1.4.3, released
on August 26, 2009.
http://www.xach.com/lisp/vecto/