Library for samplerate conversion of audio data? - delphi

What is a good Delphi library for samplerate conversion of audio data? I don't mind paying for something.
I need to upsample and download sample audio in realtime. I understand the theory but don't want to write my own routines.
EDIT: Bonus points for something with Mac support.

You can check the unit "DAV_DspUpDownsampling.pas" in the Delphi Asio Vst Project. Although I've never used it I'm sure it would fill your needs.

Use SoX - the Swiss Army knife of sound processing. Very easy to use.
It is a command line tool not a Delphi library so to use from Delphi you need to execute a shell command and get the result with in your code. I have used it with PHP.
SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.
SoX is very mature project! Here is the link:
http://sox.sourceforge.net/

Dew Research's DSP Master could be an option for you.

Maybe Mitov software has components you can use

I use newAc in quite a few projects. It can do sample rate conversion.
The best news: It is free (also for commercial use)

Yes, you can use AudioLab from Mitov Software for that. It appears that nobody actually posted the link ;-), so here it is - http://www.mitov.com/products/audiolab.
Enjoy!

I use Bass Audio Library.
You can use Bass_Encode and a Bass_Mixer to samplerate conversion.
http://www.un4seen.com/bass.html

The Mitov components do this easily. I've made a short screen recording that shows the steps.
http://tinyurl.com/mitovaudio
The Mitov video and other components are equally powerful. We've used the Mitov libraries on major real-time video and audio processing projects with excellent results. Their support is excellent.
AFAIK, the components are free to evaluate and for non-commercial projects.
PS I believe he's a FireMonkey guy, so I'd guess that we can expect Mac support now or in the future.

You may want to take a look at Secret Rabbit Code (aka libsamplerate); it's a C library, but it should be quite easy to create a wrapper. The API is simple, and supports a wide range of operating systems and platforms (even embedded!).
It has a mature and very good quality code base, and it's extremely efficient. Support is also awesome, Erik is very responsive. Plus it has a huge user base.
Another option is libsoxr (which seems to produce better output, but is not so popular...).

Related

Programming screen recorder - output issues

I want record screen (by capturing 15 screenshots per second). This part I know how to do. But I don't know how to write this to some popular video format. Best option which I found is write frames to separated PNG files and use commandline Mencoder which can convert them to many output formats. But maybe someone have another idea?
Requirements:
Must be multi-platform solutions (I'm using Free Pascal / Lazarus). Windows, Linux, MacOS
Exists some librarys for that?
Could be complex commandline application which record screen for me too, but I must have possibility to edit frames before converting whole raw data to popular video format
All materials which could give me some idea are appreciated. API, librarys, anything even in other languages than FPC (I would try rewrite it or find some equivalent)
I considered also writting frames to video RAW format and then use Mencoder (he can handle it) or other solution, but can't find any API/doc for video RAW data
Regards
Argalatyr mentioned ffmpeg already.
There are two ways that you can get that to work:
By spawning an new process. All you have to do is prepare the right input (could be a series of jpeg images for example), and the right commandline parameters. After that you just call ffmpeg.exe and wait for it to finish.
ffmpeg makes use of some dll's that do the actual work. You can use those dll's directly from within your Delphi application. It's a bit more work, because it's more low-level, but in the end it'll give you a finer control over what happens, and what you show the user while you're processing.
Here are some solutions to check out:
FFVCL Commercial. Actually looks quite good, but I was too greedy to spend money on this.
Open Source Delphi headers for FFMpeg. I've tried it, but I never managed to get it to work.
I ended up pulling the DLL wrappers from an open source karaoke program (UltraStar Deluxe). I had to remove some dependencies, but in the end it worked like a charm. The relevant (pascal) code can be found here:
http://ultrastardx.svn.sourceforge.net/viewvc/ultrastardx/trunk/src/lib/ffmpeg-0.10/
There was some earlier discussion with a Delphi component here. It's a very simple component that sometimes generates some weird movies. Maybe a start.

wavetables implemented on iOS

I just saw an iPhone app which uses wavetables to generate sounds. I wish to know how it is possible to implement.
I am pretty much sure that core audio have to be used, but any other idea where to go for some other info will be appreciated.
You'll want CoreAudio or AudioUnits for a responsive program (e.g. AudioQueue's latency is a bit high).
You'll want AudioFile APIs (in AudioToolbox) for reading the tables if you save them as a common audio file format (just wave files with a new shape every cycle, which is every N samples).
Beyond that, you'll probably have to write the wavetable engine. I have done that; It's not tough if you know how wavetable synthesis works and are familiar with audio signals. It's one of the most basic synthesis types.
musicdsp.org may have something you can use as a starting point for this.
After huge investigating I have found an open source project regarding this. http://gitorious.org/pdlib/
Audio file I/O: I found a great resource here. This guy created an excellent API for using ExtAudioFileServices.
A must read is Learning Core Audio. Chris Adamson and company have really put together a great resource. Chris's blog can also be found here
Also, sign up for the Core Audio mailing list.
Michael Tyson's blog/ resources are great too A Tasty Pixel.
Hope this helps!
Take a look at this tutorial on how to use the STK: http://arielelkin.github.io/articles/mandolin/
It is an open-source C++ library with cool synths, some with wavetables.

What's best for your Video Tracking? Why?

Best as in reliable, maintainable and fast.
Considering Processing, VVVV or OpenFrameworks?
I know Processing doesn't handle big video frames very well.
VVVV (Nodes use OpenCV) is just for Windows.
OpenFrameworks (OpenCv) is more complicated than the
above.
You can try to implement your app in Processing and see if it fits your needs and is fast enough. It should a little more easy and faster to write Java instead of C++.
Here can you find how to setup with processing with examples: http://ubaa.net/shared/processing/opencv/
If you don't want to code anything you can try VVVV, should be little faster but only on Windows as you mentioned.
If your Processing app is running too slow, you can try openFrameworks.
download it the new OF 007 from http://www.openframeworks.cc/ and check out the setup guide.
If you have done the install you can play around with the openCV examples from
<your-OF-folder>/apps/addonsExamples/opencvExample
<your-OF-folder>/apps/addonsExamples/opencvHaarFinderExample/
Personally I prefer OF because you can do any custom thing with the most performance, but its good to make your prototype with Processing to see if it works and implement it after that again in OF.
As far as I can see from your question, VVVV and OF are the options your looking at, but you prefer VVVV's node based programming over OF, but aren't happy that VVVV is Windows only.
Have you considered other alternatives like MaxMSPJitter or PureData ?
Both are similar to VVVV or the other way around :)
MaxMSP has a package for 'optimized matrix operations'(3D/video) called Jitter.
For Jitter there is a cv.jit free collection of external objects and the samples/tutorials are great.
Similarly PureData has an add-on called Gem, which is similar to Max's Jitter package.
I haven't tried with PureData, but there are OpenCV bindings for it, through Gem.
cv.jit
pdp OpenCV PureData Bindings - via Piksel.no
MaxMSP uses quicktime on osx and can use directX on windows, but it's commercial.
PureData runs on windows/osx/linux, it's free and opensource.
HTH

Video editing language

My next project will be all about language tools, parsing and such. Because of that reason I've decided to write a simple language which can be used for video editing. So instead of those desktop applications (Sony vegas, Adobe Premiere, ..) it's basically a language where you define the effects and all and it will generate a video for you.
Since I've got no experience in this kind of business I need some help. The goal of the project is to create a simple language which is able to do some basic things (such as text fading in, etc). I am looking for articles/projects/blogs/whatever related with this which could help me writing this language. (Note that I don't need articles about language parsing since I'm pretty familar with that, just the video editing part).
Thanks,
William v. Doorn
I if understand right your goal, you should take a look at Avisynth. I use it -and like it. It's for Windows only, but conceptually it seems to have what you are going after: a script language for non-linear video editing.
I'm having trouble understanding the purpose of writing such code.
If you are intending on creating a tool that a user can use to edit a video by supplying a set of commands, how is forcing the user to write text better than the GUI video editors that are available? Its going to have a pretty low usability in this situation.
If you are looking for a way to automate some kind of editing process, some video editors like VirtualDub already contain tools for batching and plugins to allow them to be automated.
Are you actually looking to make a tool that will be used by someone to edit video or is this for your own intellectual curiosity?
The best starting point can be installing trial version of the common video editing softwares and see what they offer.
When it comes to writing video editing software, I always see ffmpeg mentioned.
From the site:
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

Is DirectSound the best audio abstraction layer for Windows?

Is DirectSound the best audio abstraction layer for Windows?
Switching my app from a very bad sound implementation, built to a specific chipset, to an abstration layer.
App is native Winform, .net 3.5. DirectX/DirectSound is the likely choice, but a little concerned about the overhead. Any other options? Or is it silly to even THINK about anything else?
DirectSound is not getting the same love from Microsoft today as it got in the past. As far as DirectX is concerned, you may try XAudio2 or XACT instead. Some people love those, others hate them. XAudio2 is more low-level, while XACT is rather high-level. Both are accessible from Microsoft XNA, which is like Managed DirectX, but is actively developed.
But you are not restricted to using what DirectX comes with. Try FMod if you want something great. They still have their Shareware/Hobbyist license model and a Freeware license model, in case you don't want to pay some big bucks.
Your choice depends on what exactly you want to do with sound.
See if SDL looks better.
Well, you can try OpenAL instead. What OpenGL is to Direct3D is OpenAL to DirectSound(3D). The interface is pretty similar to OpenGL, if you don't like that, you'll probably dislike OpenAL, too. Also I'm not sure if the Windows version of this lib is an own, native implementation or just calls DirectSound and thus might just be a (thin?) wrapper on top of it.
DirectSound is pretty good.
If you need low latency or good support for sound input and output via multiple soundcards at the same time you may also want to have a look at ASIO:
http://de.wikipedia.org/wiki/Audio_Stream_Input/Output
The waveOut... API is still an option. It's tricky to work with from managed code, but you can play multiple sounds at once this way (in XP and Vista, at least).
If you just need to play sounds occasionally, System.Media.SoundPlayer is very easy to use. However, you can't play more than one sound at a time with this component.
DirectSound is your only other major alternative. It has a built-in software synthesizer, if that's something you need.
EDIT: SDL looks interesting. Thanks, Sijin.
SharpDX looks interesting. I'm planning on trying it as a replacement for Managed DirectX because of the x86 limitations of the latter.

Resources