Spline audio interpolation
For my a 3d audio software renderer, access to the audio data in a non sample based mode is needed. In order to achieve this goal, I've implemented a custom cubic spline interpolation well suited for audio data. To test how good it is, I've done a little test:
I've created a wave file containing a sine at 440Hz. With my interpolator I played it back with a speed factor of 0.2 and 1.2. After doing this, I did a frequency analysis of the resulting audio data and compared the results to a simple linear interpolation. Here are the results:
All in all my interpolation does a pretty good job and is also very fast. It can be used to change the pitch of music, to add doppler effects, phase shift and many more.
Today I've succeeded in implementing a DirectSound output driver for Audorra. This output driver allows me to output audio with a very low latency (~10ms). That's important as I'm planing to add a software 3d audio renderer and mixer to the project.
As usual, the source code can be found in the SVN repository.
Today I've implemented seeking using libmpg123, which didn't seem to bo so trivial, before I found the mpg123_replace_reader function.
As usual, the source code can be found in the SVS repository.
Today I've added a new but important filter to the filter graph repository of Audorra. As you might know, audio data often gets clipped if you try to amplify it. In digital audio processing amplifying a piece of audio means to multiply all sample values with a factor greater than one. When working with 16-Bit audio, each sample represents a value between -32768 and 32768 (actually Audorra uses float values between -1 and 1 in all internal processing steps). When multiplying a sample value with - let's say 1.5 - some samples may reach values bigger than 32768 or smaller than -32768. Of course the sound card is not able to convert these "big" sample values to an analogue signal - they don't even reach the sound card in this form, as we have to clip all sample values to their 16-Bit region.
And that sounds really disgusting:
Here's an example of a clipped audio file (original taken from http://www.incompetech.com/, the track's called "Majestic Hills"), which has been amplified by 10dB (be careful, it might not be too good for your HiFi audio system):Your browser doesn't support the HTML 5 audio tag.
So what can we do? The first and the best solution is not to amplyfiy the digital audio data but to use the volume nub on your analogue amplifier. But that's not always possible. Sometimes you actually only want to amplify the silent parts and not the loud ones. And that's, what the new compressor filter does. When it recognizes that a sample is clipped, it reduces it's value to a desired target value and reduces the following samples by the same reduction factor (well, actually the reduction factor is linearly interpolated over the so called "release time").
This is the same track as above, but after amplifing it ran through the compression filter (CompressionTarget = 1.0, ReleaseTime = 0.1).Your browser doesn't support the HTML 5 audio tag.
The source code can be found here: http://audorra.svn.sourceforge.net/viewvc/audorra/src/AuFilterGraph.pas?revision=10&view=markup#l_1046
Support for Shoutcast streams
After adding support for libmpg123, it was time to test the HTTP protocol again. Unfortunately, FFMpeg is unable to determine the type of the stream without having to download 1MB of data - what takes up to one minute when opening a radio stream. When using libmpg123, this isn't a problem anymore. The radio stream openes nearly immediately after clicking on "Open".
After performing a few tests, I found out, that I was unable to playback Shoutcast streams, which seem to be quiet common. These streams have the following URL scheme:
http://hd1.streamingsoundtracks.com:9000When accessing such an URL with your web browser, you'll see a default shoutcast website. And the Synapse HTTP component saw excactly the same. It took quite a long time for me to find out, what I have to change in my HTTP request, to get it work.
By default synapse submits "Mozilla/4.0 (compatible; Synapse)" as HTTP user agent. This makes the Shoutcast server think, that a browser is trying to access the page. When changing the user agent to something else, the Shoutcast server submits the desired MP3 data:
FHttpSend := THTTPSend.Create; //OnReceiveData is a custom addition to Synapse. //See /audorra/lib/httpsend.pas FHttpSend.OnReceiveData := ReceiveData; FHttpSend.Headers.Add('Accept: icy-metadata:1'); FHttpSend.UserAgent := 'Synapse/Audorra HTTP Component'; FHttpSend.KeepAlive := false;
Today I've added support for the libmpg123 library, which was quite simple. Seeking hasn't been implemented yet, but this won't be to difficult too.
All I had to do was to translate parts of the libmpg123 header from C to Pascal, the library is loaded dynamically and the decoder will only be registered if the library has been loaded. Integrating libmpg123 into Audorra has been an important step, as it is licensed under the LGPL and not under the GPL as Acinerella, which uses FFMPEG.
So people will be able to decode MPEG 1 Audio Layer 1, 2 and 3 without having to license their program under the GPL.
The (partial) MPG123-Header for pascal can be found here: http://audorra.svn.sourceforge.net/viewvc/audorra/lib/mpg123.pas
The MPG123-Audorra plugin can be found here: http://audorra.svn.sourceforge.net/viewvc/audorra/src/decoders/AuMPG123.pas
Running on Linux
After I've installed a SVN client on my fresh Linux installation (thank you Microsoft for destroying my Bootloader btw.) I was able to compile Audorra on Linux - which worked sucessfully after removing a few units which were by accident listed in the uses clause of some units.
I was quite contented that everything worked so well - but as you can imagine, there was another problem, which made me "gdbing" and "valgrinding" for another two and an half hours: A floating point exception somtimes being raised - and somtimes not.
But fortunately I was able to find out, that the bug lay within Acinerella. I had a glance at its version: 1.3. Hm. Didn't I fix that bug in the CVS version just a month ago? After checking it out from the repository, recompiling and moving "libacinerella.so" to "/usr/lib/", Audorra nearly ran as perfect as on Windows.
Audorra Website Online
Today the Audorra website has been launched and will inform you about the progress of the project.
This website is driven by a new simple and small XML based "Content Management System", which allows me to add and update content without having to edit a database.