Open source libraries for sound effects in games [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
does aybody know about an open source sound library in C++ or some other popular language that can be used in open source games for recreating sounds and especifically in car racing games to recreate engine sound?
Thanks

A long time ago, there was OpenAL and was moderately successful on Linux.
It's fairly easy, modelled around the OpenGL library principles.

While you got a few answers regarding how to output sound I believe that wasn't your question.
If I got your question correctly I think "Sound Synthesis" is what you are looking for.
All you need is a bunch of generators (e.g. Sine, Sawtooth, Noise)
and filters (low,high,band); And combine these.
Next step would be adding LFOs (Low-Frequency-Oscillators) to modulate parameters of the generators and filters.
I'm aware that this is not the full answer you looked for, but sound synthesis is a science in itself and the above keywords should get you started on the right track.
As for realtime synthesis of SFX for games. Simple answer:
Don't do it!
It's a waste of resources and - unless you have very strict size limits - the size of the samples used for SFX won't kill you.
For our current game the average sample has a(n on disk) size of around 7KB.
(We use 16KHz, mono, ADPCM wavs most of the time.)

I've only trivially poked around with it, but SDL is a very popular, cross-platform, C++ game dev library. It includes support for graphics, sound, input.
I also recall that it's very modular. That is, it's less of a framework and more of a library than some other solutions. Give it a look.

Is there a specific reason you need open source, or is "source available" good enough? A popular one is fmod http://www.fmod.org
It is free for non-commercial products, and also offers sourcecode under a license. It is very popular and isused in many well known games.

The irrKlang sound engine is very popular amoung independent developers. It is free for non-commercial use and still very cheap, if you want to start earning some money with your game.
It supports all major plattforms (Windows, Linux, Mac) and has APIs for C++ and .Net languages.

I know it's an old question, but I think SFML needs to be represented here. SFML is available in C++, C, .Net (C#, VB.Net, C++/CLI, etc), Python, D, and Ruby, and is designed to be small and fast.
Features specific to audio:
Uses hardware acceleration whenever possible
Can load and save standard sound formats : ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64
Can load all audio resources directly from files in memory
3D sound spacialization
Easy interface for capturing audio
Manages memory efficiently, so that you don't have to worry about resources lifetime or storage
Supports streaming for big files ; you can even write your custom streaming class for any source (network, ...)
Supports multi-channels formats (mono, stereo, 4.0, 5.1, 6.1, 7.1)
For the specific question of recreating engine sounds, usually games take a single looping sound and adjust the pitch. An open source game that does this very well is VDrift.

SDL is Good Option for Graphics/Sound
QT frame work has also good support for sound and graphics
PortAudio is also good option

Related

C/C++ Sound OS API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a question about sound.
I have used sound libraries like OpenAL in my projects before.
What I need, is insight as to what underling OS APIs these libraries use.
Even if each library provides an easy way to manipulate the input file
according to format, the very basic "raw byte-to-byte, send to the driver"
function has to exist.
I mean, surely there has to be a default api (one for windows, another for Linux)
that these libraries use. I don't suppose they use directly each sound
card's drivers, so the OS has to somehow do the magic. Am I correct?
Now, I know DirectX supports sound (Although I have never used it), but
DirectX isn't installed by default on windows, so I suppose it doesn't count,
and I have no idea what happens on Linux, and I would like to know about both.
I know it's probably impractical not to use a dedicated library, and I don't
really intend not to, but I'm curious about this subject.
So please indulge me.
So, for basic graphics it's OpenGL and DirectX... But what about sound?
Thank you in advance.
Each major platform has a number of API's that allow you to work with sound, On Windows and Mac there are Native Sound Api's that are used by default by the OS as well as well as others that are either Non-Standard or deprecated.
Have A look at he diagram HERE, it has a useful breakdown of many of the major sound API's across major platforms.
In addition to each platform having native sound API's there are also many cross platform API's that encapsulate the way that each native API works in order to allow you to write portable audio software.
For example there is: PortAudio which is a well know C language API
there is also RtAudio which is a C++ API for sound, but it is somewhat of an older C++ style in my opinion(Does not take advantage of post C++11 features).
I am currently working on my own more modern C++11 audio API which can be found HERE. At the moment my API is a thin wrapper around PortAudio that allows you to work with audio in a more modern C++ way.
Keep in mind, the library that you choose will also depend on what kind of audio work you intend to do. All of the libraries I have listed above deal with real-time audio processing and do not deal with audio files. If working with audio files is what you are trying to do you could use libsndfile which is a popular open source sound file manipulation API.
From the context of your question it sound like you have been dealing with sound primarily in a Game Dev related context. It's worth mentioning that working with sound at the level that most of the libraries I have suggested thus far will be at a much lower level than simply calling one function to play a sound file.
Trying to answer the question of how OpenAl interacts with the OS is an answer best left to reading the OpenAL documentation.
I would also suggest looking into basic digital audio theory as well as digital signal processing. There are many resources available for free online on either subject.
EDIT:
In regards to how audio API's work... The average audio api works off of several layers of abstraction between the programmer and the sound card. Typically the programmer is given a buffer of audio data stored as an array of values. The programmer will have requested a specific set of parameters that the system will use for playback (sampling rate, buffer size, number of channels). The programmer will do their work with the audio data and hand the output buffer over to the api which in turn will eventually hand the buffers data over to a device driver written specifically for the installed sound card. The driver for that sound card will have been implemented based off of an interface specified by the platform that the driver is targeting. That is why when you install a new sound card on a machine you may be required to install drivers for it, by installing the drivers you are giving the OS level api a means of communicating with the device.
(There is a lot more that goes on than is possible to easily explain, and i'm sure i have missed a few steps in the process. But I hope that should be a good enough explanation to get started)

Graphics for C++ cross-platform music making software [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
EDITED, see below
I need an library to display graphics of music notation on a music making software. It will be Sibelius-like: Basically the user creates the sheet music and the app sends midi output.
I'm not looking for an library to display music notation, as for various reasons i must implement it myself. Also, the library i'm looking for must be cross-platform (should run at least on Windows and Linux).
The graphics will be vector-based or drawn with functions like "line(point1, point2);"
(Before continuing let me state that i'm new to C++ and most of my experience is with interpreted languages - PureData and Processing, mostly)
Now to the question:
I've found Cinder. You think Cinder is sutiable for the task? If no, you might skip 2 and 3.
I don't have experience with OpenGL. I couldn't actually figure out if Cinder uses OpenGL exclusively or if it uses it only on demand. My doubt here is, when using OpenGL libraries my application will only be able to run on computers with dedicated graphics cards?
Cinder doesn't have the hability to create GUIs like Qt or GTK+. Is it possible to integrade Cinder in another window, created by Qt/GTK+/SDL/etc ? I want something like Sibelius, where you have normal GUI (buttons, menus, etc) integrated in the notation graphics window.
If Cinder is not a good option, what might you recommend for that specific application needs? OpenCV? SDL? SFML?
EDIT:
I see this was marked as off-topic. Sorry, i'm new here. I've seen some posts asking for this kind of recomendation so i thought it was okay. Well, i will try to be objective and straight-forward
Question:
I need to draw music notation graphics, but i don't want to deal with low-level stuff (like Cinder, SDL, SFML, Ati-Grain). So, what are the other technologies available? That is, what are the other options?
What you are describing is a LOT of work and something impossible for someone with limited programming experience such as yourself. C++ is neither an easy language nor a language that forgives.. it's not just about learning the syntax (as is the case with processing or similar languages with automatic garbage collection) - it's also about managing memory and other resources, invariants, etc - leaving aside the complexities of linkage, compilation, etc: in turn this prerequisites that you have a thorough understanding of how computers work at a lower level.
Anyway, I'll try to answer your questions:
You could do this with cinder - this would probably mean having to re-invent the wheel - but you can do. I wouldn't say, however, that cinder is really suitable for such a task. This is meant for accelerated 2D/3D computer graphics. What you want is some more generic GUI library (maybe QT?). Regarding midi-support, you'll probably have to rely on some other library for this anyway.
Most computers these days do support openGL. Again you don't really need openGL for what you want to do.
Yes you can do this in theory - but it won't be easy and it's not really necessary for what you want to do.
OpenCV definitely NOT. This is for image processing - i.e. raster graphics - you need vector graphics. Let aside that OpenCV's Highgui is really slow on certain things so you'd have to use some other library for rendering anyway. I have no experience with the other libraries. My suggestion would be to either use some interpreted language such as python, luaAV or maybe SuperCollider (which does have built-in midi support by the way) which is far easier than C++, or to search for some open-source music-notation alternative (if there any) -> you can always build something of your own upon an existent code-base - reinventing the wheel is not necessary...

C++ cross-platform framework for mobile app development [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Improve this question
I'm planning on developing mobile application for both iOS and Android and I want to use C++ for the development.
Which cross-platform framework is available for building mobile application using the C++ language.
I'm sure a lot of people have this question as well, so read this if you'd really like to know the answer. Marmalade is probably the BEST solution. Code once, deploy to mobile devices, desktops, even some TV's. Many popular games have been created with Marmalade.
Extensive games like:
Lara Croft and the Guardian of Light
Call of Duty: World at War Zombies
But also simple games like:
draw something.
Doodle Jump
They've added a free package. You can create your game for free and if you want to get rid of the ad splash screen, it's $150,- per year for mobile devices or $500,- per year for other devices as well.
A big advantage is the native speed. It doesn't matter what people claim about other languages like javascript or java (and unfortunately Qt, which of course isn't a language but you know what I mean) running as fast as C or C++. It's simply not true. For simple applications this is of course not important, but when you're looking at (simple) games, this is crucial.
At the moment version 7.3 is available, but this version has a problem with the ARM emulator. I would download 7.0.
Whether you choose Marmalade or not, make sure you read the documentation. You don't want to end up missing some functionality and switch to another option when you're almost finished.
I've looked into portable code between Android and iOS before and I don't think it's possible.
To release apps into the Android market it needs to be in Java, and anything with a GUI on iOS needs to use Objective-C.
You might be able to have partial portable C++ layer, but in reality it's probably quicker to write the same app twice in Java and Obj-C than it would be to write it once in C++ as a portable solution.
Qt or Wx-Widgets might have some support, but I have not looked into mobile platforms for these, and I suspect the reality is that Apple, Microsoft and Oracle want you to be tied into their technologies these days and have no incentive to make things portable.
C# and Java provide a complete framework that allows code to be written much quicker using well documented classes and libraries, especially when dealing with user interfaces.
C++ on the other hand relies on many open source projects that take a lot of effort to get functioning on multiple platforms, and much time is spent dealing with subtle platform problems.
My suggestion was simply that it might be easier to pick a language better suited to the platform you are dealing with, as C++ tends to be lower level than other languages, the syntax can seem verbose and many hours can be wasted trying to make things work that you would expect to just work, and unfortunately documentation for many open source projects is poor.
Maybe this can be considered to be an opinion, but then the shift from C++ to C# or Java commercially might also indicate that I'm not the only one believing this.
You can take a look on openFrameworks, maybe it fits on your needs:
http://openframeworks.cc/about/
There ARE solutions for C++ cross-platform development for Android and iPhone, despite what other answers say here.
The best is probably Marmalade, but it's expensive, so only useful for commercially viable apps: https://www.madewithmarmalade.com/
Then there's MoSync, which you can use for free. Unfortunately they went bankrupt last year, so there's no ongoing support. Still, might be worth a look depending on your needs. http://www.mosync.com
OpenFrameworks is one I hadn't seen, so thanks Rodrigo for that answer: http://openframeworks.cc/
There is no cross platform solution using C++, unless you're interested in making games. There are a few options available if you don't mind using another programming language. Take a look at Titanium SDK (Javascript), Xamarin (C#) or the multitude of HTML5/CSS/Javascript frameworks (Phonegap comes to mind).
Look for the DragonFire SDK it allows you to write apps and games in c/c++. Not cross-platform and never used it but looks good. It uses Visual Studio and has its own simulator for iOS development.

light-weight C++ image library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've been looking around for a simple and small yet robust and fast (not comprehensive!) image library for C++ (C would suffice, if no C++ version is available).
Main features I'm looking for are:
Free (opensource is a plus)
Built for speed
No huge functional bloat (like ImageMagik, which is truly comprehensive but is a mammoth)
Tiny memory footprint
Only supports the absolute minimum of functions like load/save, resize, convert between formats. Nothing fancy
Error recovery for "broken" files (unlike stb_image.c, which has pretty poor error recovery)
MSVC and gcc friendly (I used CxImage for a number of years but with the latest version I'm having problems with MSVC 2010 and it would seem that active development and support for it has died out by now, so I'm about to drop it)
Should support popular modern formats, like JPEG2000, either directly or via a use of general libraries like libpng
Don't care if it's DirectX or OpenGL as I don't plan on using it to display the images - only to file-process them for a web site
Having support for both static and dynamic linking is a plus
Threading support is a huge plus
Libraries I looked at and dismissed for one reason or another:
CxImage (no active development on it anymore)
ImageMagik - too huge (and slow)
stb_image.c - bad error handling, doesn't support enough image formats
DevIL (havn't dismissed yet, but haven't looked at it much either - just learnt of it a few minutes ago on a similar post on SO) - based on it's size and feature set it looks very promising for what I need though
FreeImage (same as DevIL - will take a look at it shortly but it's a bit big in size to my taste)
SOIL (same as stb_image.c)
TimThumb - it's a PHP, not a C/C++
In short I just want something as tiny as possible and as fast as possible at the expense of just having the absolute bare minimum of functionality but I'm yet to find a suitable candidate thus far.
Any suggestions from this community, please? But keep in mind the constraints I listed above - I don't think it's OK to throw an answer of a form "have you tried X?" where "X" doesn't meet half of my needs :)
Edit: Looking a bit more into DevIL it would seem it could be what I need. It's light, tiny, robust. Now I just need to make sure it performs.
Oh, and CImage (I forgot to mention it in the list) - didn't like it's performance (though I have to admit that the idea of template-only implementation is cute, to say the least)
I strongly suggest you to write a little library around libpng and jpeglib (and every other low-level library for the formats you need to support). It is not that hard and you can code all the features you require.
As an alternative, you can use some of the good c++ wrappers that already exists for that libraries. Here are some examples:
png++
JPEGReader/JPEGWriter
Look at CImg library, it's just one single header file

What visualization libraries are available for Fortran? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
What visualization open sources or free software libraries are available for the Fortran programming language? Are there any similar to MatPlotLib for Python, for Fortran?
If not, most scientists require visualization not only to generate some outputs but also to investigate data trends, which is missing in Fortran although its speed in computation is well-known.
Note:
This question is intended to discover available, or planned to be available, graphical libraries for Fortran. It is clearly not going to compare different packages among different programming languages.
The flexibility, quality of outputs, interactivity, multi-dimensionality, free/open source etc are of factors to be discovered.
Just to make this list, a bit more complete ...
PLPLOT
GINO Suite
Winteracter
NCAR (outdated)
There is also gtk-fortran.
gtk-fortran offers also an interface to PLplot (>=5.13 in the GTK 3 branch).
I think there are some libraries available, which allow you to do directly some rendering of data from Fortran, however nothing like MatPlotLib, as far as I know.
Edit: Here is a short link collection:
http://www.astro.caltech.edu/~tjp/pgplot/
http://sourceforge.net/projects/gnuplotfortran/
http://www.mps.mpg.de/dislin/
http://www.vigyan.com/desl/FLAVOR.HTM (maybe not exactly matching here)
But the main point of the typical Fortran application is not the visualization of the data, but its generation. Typically you produce some output file, which can then be read by gnuplot or some other visualization tool. A common data container format is for example HDF5.
If there is still some need for direct visualization from within the Fortran application, you can use the ISO_C_Binding to interface with any C-Library, which should provide you with plentiful options. Still for these cases it is likely, that you will need to generate some wrapping layer around the C-API to provide an convenient usage in the Fortran application.
Free: Mjograph (2d plots only) and Veusz (2d and 3d plots)
Perhaps you can generate csv or simple space-delimited files with your Python/Compiled-Fortran code, and process using 2d plotting software like Mjograph and/or 2d/3d software like Veusz. Mjograph is only available via Mac and/or Java platform. Veusz is scriptable with Python, it was built using Python with Qt & Numpy, in fact the save file is just a plain Python script, and is comparable to gnuplot (at least in terms of ease of use). The tutorial with veusz clearly shows what the capabilities are. I like that it starts you off with the GUI, but you can wean off to pure scripting afterwards.
Mjograph: http://www.ochiailab.dnj.ynu.ac.jp/mjograph/
Veusz: https://veusz.github.io/
Veusz seems a little more natural compared to dumping data into Matlab or Mathematica. At least if you are used to pushing python and Fortran around with Bash scripts on linux.
If you insist on 3d data, I would take a second look at DISLIN, it can work quite well depending on what you need to visualize. The license is quite affordable for commericial-use. If using for academic use it's free.
Typically, a Fortran user creates massive data files then uses some 3rd party visualization software that fits the application. There are a couple of libraries that directly link to Fortran. Dislin is a fantastic one (particularly on Windows). It has a ton of documentation and once the learning curve is over you can create great GUI's as well. GnuplotFortran is an interface from Fortran to the standard gnuplot. I've yet to use it, but hear good things.
My choice would be something like PV-WAVE from Visual Numerics Inc. -- lately bought out by Rogue Wave Solutions.
This uses a big library of Fortran routines and employs its own special 4G language to speed up coding your own custom data displays.
This product is not cheap -- it was developed for applications like seismic data analysis, wind speed/direction data representation, simulation of things like airfoil flow, injection-molding cooling, stress analysis, etc -- but it is the best that I've seen.
Very clear documentation, examples supplied for each library sub-program, good help guide, direct line to tech support.
Leaves MatLab for dead.