Wednesday, May 13, 2009

#dBFS calculator

I've made a simple dBFS calculator:

You can download it in Flash SWF format or as a C source / Win32 binary (binary compiled with the DJGPP online-compiler).







The summing of decibel values is a bit of a confusing subject, i believe because decibels are units with no dimension (ratio like %) and also that they are logarithmic.

You can read this whole article for more information:
http://www.homeandprojectstudio.com/features/feature001.html

...Using dB FS (full-scale) in digital audio means that a change of +6 dB FS is the same as +10 dB spl (sound pressure level); in other words, twice as loud. How can this be? We know that each bit in a digital audio system increases the sampling resolution by approximately 6 dB. In essence, each bit represents an exponential increase in the sampling resolution, doubling the value with each bit. That’s why in a digital audio system, +6 dB FS, and not +10 dB spl, represents a doubling in sound levels. Not coincidentally, this corroborates the earlier statement that an increase of 6 dB is really a doubling of sound pressure, although not the perceived doubling of sound pressure. This is true for both analog and digital measurements.

The important bit here is to learn to distinguish different types of measurement (decibels). What you are seeing on the meters in your audio program is dbFS originally designed for ADCs (analog-to-digital converters) and assimilated by modern audio tools. dbFS is the reverse of dbSPL.

The above article explains an easy way to sum dbSPL values and also provides a table to convert dbSPL to dbFS (16bit only):

If you have 80dbSPL + 80dbSPL the result would be approx 83dbSPL (80+3), because the difference between the two is 0 units - from the "rule of thumb".

--------

a dbSPL calculator works with the following equation:

result = 10*(log(10^(input1/10)+10^(input2/10))/log(10)

where "input1" and "input2" are the dbSPL (!!) values you want to sum. 80db+80db=83db

--------

to sum two sinewaves in your audio program (with dbFS measures):

result = 20*(log(10^(input1/20)+10^(input2/20))/log(10)

But why 20*? Here is a explanation quote from wikipedia:

20 log rule, and similarly the formula for ratios of powers is the 10 log rule, and similarly for other factors. The factor of 20 is explained as: 10 is because it is in decibels (10ths of bels), and 2 is because it is a ratio of powers (squares of amplitudes): the product is 20.

So result for the sum of -9dbFS and -9dbFS, would be -2.97940008672037 for equal input/output impedance.

Lubomir

Monday, May 11, 2009

#BBE Sonic Maximizer 482i circuit explained

"Is the bbe sonic maximizer just a 2-band eq?"
A similar question has been asked on some forums, so i've decided to find out by searching for a schematic of a BBE SM unit and found this link via google:
http://www.radio-flier.com/PDF%20Files/BBE%20482i.pdf

Without checking the website from which the pdf file originated i wrote a quick review of the schematic.
And it seems i've doubled some things already written in there...apparently this pdf schematic extends the bbe schematic with the contents of the NJM2153 chip - the original schematic has only one big chip from a japanese manufacturer, which in a way hides all the processing in the unit.

So more useful info on BBE SM here:
http://www.radio-flier.com/bbe_data.htm
Thanks to Tom Farrand for reconstructing the 482i sheet with the NJM2153!

Here is my review:

Quote from the bbe website on the 482i:

"The 482i Sonic Maximizer restores an audio signals natural brilliance and clarity by the use of two primary functions. First it adjusts a signal’s phase relationships between it’s low, mid and high frequencies while progressively adding longer delay times to lower frequencies, this creates a kind of “mirror curve created by the speaker neutralizing its phase distortion. Secondly the Sonic Maximizer augments higher and lower frequencies; loudspeakers tend to be less efficient in their extreme treble and bass ranges. The end result is a dynamic program-driven restoration without the ear fatigue that is normally experienced with the use of equalizers or exciters."

+ A look at this sheet of a 482i channel.

http://www.radio-flier.com/PDF%20Files/BBE%20482i.pdf

At first sight, it looks like a 3 band second-order splitter (multiband). this is achieved with what they call "pseudo state variable filter". Phase shifting (band split) is present for each band !even! if "process" is set to 0 - i.e. fx is part of the signal chain (not bypassed). The band-splitting is not controlled by the process knob.

The delay for the bands which BBE state is present, can be accomplished with a capacitor discharge, however I can't seem to find this in the sheet. Another way to do the delay, would be with separate buffer for this band, which stores the signal and plays it back with a delay. This type of design goal isn't something new and if you do it right, it can improve the sound trough certain speakers (a tweak for better acoustics). But how would you compensate for IIR phase shifts with a constant delay value? Phase correction with All-pass? This won't make the filter linear-phase.

There is a low-band amplification with a potentiometer which is not a low-shelf filter - this is just a band boost. Same goes for the 'process' knob, it boosts the top-band. for the top-band signal path we see voltage-controled-amp (VCA), which has its control voltage trough a peak-detector. The peak-detector works with the non-filtered signal and increases/decreases the control voltage of the VCA. The summed voltage from the peak detector trough the VCA, should add more to the high frequency content and act like an exciter. Btw i've never seen a VCA the way its drawn in this sheet, so i can't say for certain if it does what I've described above.

Another thing to take note here are the input/output buffers.
- By looking at the input buffer, I believe this is just for impedance accomodation between the input (jack) and the next stages filter/pd, this is required in most cases. I have some doubts that the input buffer acts like an allpass filter and that the necessary impedance accomodation is made with just R30.
- The output buffer looks more complicated: there is a what its called a frequency dependent inverting operational amplifier. What it does is - it doesn't amplifies frequencies above certain range (10khz for example), also it sums the three bands. This can be used to compensate for the harmonic boost of the high end. After that i see a one pole high-pass filter (RC), which i think they use only to band-limit lower frequencies (for example below 10hz) - the capacitor C20 takes care of that.

There is no potentiometer on the output stage, because i see there is no "output gain" control for separate channels on the 482i.

Summary:
There are a couple of mysteries (things i'm not certain of) in here, but the design does not look that complex. Also the price for a 482i is around 200$ (zsound) and it is a two channel unit - not very expensive, but still I believe you can custom build and improve the unit with a !lot! less than that.

I've heard a lot of positive and negative comments on the BBE SM units. The negative were about its sharpness on the top end (mainly in the plugin version). This may be, because of the use of cheap IIR filters and bad control for the VCA input voltage values...
From a recent discussion at music-dsp mailing list, we've agreed that by band-splitting and boosting a band (apply gain) instead of using a peak / shelf filter in the same range, you are essentially dealing with an inferior equalizer! this is due to the phase shifting at band crossovers. BBE states that they deal with this problem with one "progressive" delay shift?

But to conclude, if something is designed well and has quality elements, low noise floor, low harmonic distortion - it may sound great and even improve the sound. This type of circuit does not have much "magic" to add, but as I've said it can improve the sound if designed well. Also I don't believe that the software version will sounds better than the hardware, if modeled accurately...

Hope that helps for better understanding of this particular unit. :)

---UPDATE---

I believe I made some mistakes:

On the" input buffer" analysis:
on second look I think the "input buffer" is just a second (?) order all-pass filter...

I've managed to run the old "cakewalk sonic maximizer" plugin demo (dx) with a wrapper & vst pa (from c.budde). The new bbe version from nomad factory has no demo?

So if this is accurately modeled - indeed, there is a all-pass filter with f0 at 700hz

phase (bbe all-pass):


groupdelay (bbe all-pass):


So the "progressively adding longer delay times to lower frequencies, this creates a kind of “mirror curve created by the speaker neutralizing its phase distortion." statement is accurate in this case. All-passes can be used for this application, but this just a non-adjustable all-pass design, which cannot deal with phase distortion issues in !any! speaker.

I must admit though, that changing the top-band and low-band voltage also affects the group-delay of the sum. signal chain is: [in] -> [allpass] -> [band-split] -> [sum] -> [hp] -> [out]

Things are much more complicated than that :)

Here is an article on the subject of all-pass crossovers and phase distortion issues:
http://www.linkwitzlab.com/phs-dist.htm

Lubomir

Saturday, March 21, 2009

#"Dynamic Range" - Pleasurize Music?

Just recently I've found out about this web page:
http://www.pleasurizemusic.com



This time behind the initiative are serious companies such as:
Tischmeyer Technology
Alogorithmics
SPL
Brainworx
Tomo AudioLabs


The initiative of the "Pleasurize Music Foundation" is proposing an open source VU/RMS meter, which can be used to calculate a "Dynamic Range" value of a audio track - offline or real-time with hosted plugin. The main idea is to standard-ise the use of a specific tool in any studio across the world, a tool that determines what the "Dynamic Range" of the tracks examined is and if these track are unnecessary loud. I strongly support this proposal!

Here is more info I've gathered from personal experience:

"Dynamic Range"
From the website explained as:
...This is the average cumulative difference between peak and loudness (RMS) over a specific period of time (duration of a song or album) and is a whole number value given in decibels. Just the top 20% of the loudness are taken into consideration to ensure that songs with a long intro and an over compressed refrain doesn´t appear with a too high DR value.
For the quick tests I did with the "Offline Meter" they are providing, the returned DR values seem completely adequate. Tracks which I think sound super-loud had DR values of 6 for example. Tracks with normal volumes were around 11-14 DR.
Basically the manual of the tools says that an acoustical musical performance for example should be around DR=12, DR=14. For electronic club music I guess it can go a little bit lower around DR=10. But still! This means that the limiters will begin to kick in and DR=12 still will be absolutely reasonable value.

The "Offline Meter"

The offline meter can be used outside of your DAW application (since it is a standalone exe). Loads and analyzes the tracks very fast! The DR value returned from the meter should be considered the "official" DR value for this track. Not the DR values returned from the "Realtime Meter"

The Plug-in "Real-time Meter"

So far the plugin version of the DR meter is only available in the VST format. They are saying that AU/RTAS versions are on the way too.
The plug-in version loads almost instantaneously on my old PC. It has peak meter, RMS meter, mono switch, link switch, and DR value meter along side a very nice moving colored block which turns from green to red if the DR values begin to lower too much.
The only remark I must make here is that apparently the RMS has "Display gain" value of 3dB applied to it. So if you compare the RMS values with other meters (such as Voxengo Span for example) you will have to add 3db more to DR meter values to make them equal. So far I think they are using a 300ms window for RMS calculation which is ok.

Both the plug-in and the offline versions are developed by Tischmeyer and Alogorithmics. Algorithmics alongside Isotope are probably one of the most respected DSP code algorithm suppliers. Tischmeyer Technology is an offspring of Tischmeyer Publishing GMBH with their excellent mastering studio located in Germany and publishing of mastering books and tutorials.

So far so good. I've already started using the new meter. If you are interested give it a try, register on their website and spread the word on forums and blogs if you support the initiative.

Regards
Lubomir

Thursday, March 5, 2009

#Designing an analog VU meter in DSP

Here are some notes on how to design a VU meter DSP fx.
I won't be getting much into the signal detection, but mostly into the visual of the plugin. If you wish to know more about it, please feel free to send me an email and I will be happy to respond to your questions.

Here is what we are going to use as an example. This is a very simple JesuSonic fx:



Setting some dimensions
We begin by setting the width and height for the visualization.
Its important to set the dimensions first, because they will determine the radius of the needle and the span of our scale.

We are going to make a rather large VU meter - 425x260px, with needle radius of 200px. You should be able to create an arch withing these dimensions using the needle radius.

Designing the VU meter scale
After the dimensions are set we can start creating our scale.
You can very easily design the scale, try to approximate other scales, or use ready equations.

In this example we are going to design our own scale by roughly approximating to an actual scale. There are a lot of photos of analog VU meter over the net. Different manufacturers have patented different scales. We will create our own (in a way).
Similar to this one for example:



We can use it as our base. In general its very difficult to make the approximation 100% accurate if you don't know the original function. Still there are ways to (try) to do so. For example LaGrange polynomials can help you with that. It may require a lot of points to be interpolated and the resulting function and the algorithm may became much more inefficient than a simple exp(). Also by using interpolation there might be some minor unavoidable and unwanted deviations between points.

First thing to do is to set some scale markings in dB:
-20, -10, -7, -5, -3, -2, -1, 0, +1, +2, +3

Here is how to convert amp signal in dB and then get the value of X (dB -> pixels on the X axis):



//code executed at bigger intervals - 1024 samples for example

//amp2dB
//take only abs(input) of input
//6/log(2) is our dB scale
in_db = log(abs(input))*6/log(2);

//then

//xl - is the value of X
//in_db - is the value in decibels
//use numbers 2.1 and 285 to tweak the equation
xl = floor(exp(log(1.055)*2.1*in_db)*285);


xl is the result we are looking for here, after converting amp into dB.
A very useful thing to do is to use some sort of a plotting program which can make calculations and draw some lines at the same time. I've used Adobe Flash which is quite fast to work with.


fig.1

The vertical lines on the left and right represent our width. Point O is the center the circle. Point A lies on the circle therefore OA = r. Point S0 represents a point from our scale using the above equations. To draw the actual lines from the scale, two additional large arches may be used (colored in blue). If we connect O with S0 an intersection will occur between the new cirlces and OS0. These are points D01, D02. So lines such as D01D02 will be visible on our scale. When we know all the coordinates of the points we can make an arrayand draw these 'markings' on plugin initialization.

Drawing the needle in realtime
After we have the result on the X axis we can start drawing the needle.
Of course if you wish to use a bitmap as the needle you should use a different method here (i.e. calculate angle of rotation).


fig.2

The math method used here to calculate point A's X,Y coordinates is by using proportional triangles and Pitagor theorem - as simple as it gets. Where: S0A / AO = P1A / AP2 etc. And since we know some of the lengths and coordinates of points we can get point A very easily.


//get y from x and radius - r
//Pitagor and proportional triangles used here
l=sqrt(sqr(r)+sqr(212-xlt));
h=((l-r)*r/l);
m=sqrt(sqr(l-r)-sqr(h));
ylt=35+h;
xlt < 212 ? xlt=xlt+m : xlt=xlt-m; // check if x is < of middle point 212


The results - xlt & ylt are the A's x,y coordinates and after we have them, we can draw a line between O and A in realtime.

Needle response
Updating the needle per sample is not advisable so I suggest that you use some sort of a countdown before make the above calculations. After some trial and error you will get an acceptable 'response' speed. You should know that the magnetic-electric system (inductor+constant magnet) of an analog vu-meter has response of 300ms. This is quite slow but of course you can tweak it.

Another characteristic of the needle response is the inertial fallback. This is due to the inductor exponential discharge. After executing the x,y calculation code you can add the fallback by simply subtracting pixels from X (original exp() scale) while multiplying the result by some factor for adding inertia (emulating the discharge).

Limiting x and y of A may also be a good thing since the given log scale in dB can go as low as -350db. Or you can just limit the input gain value to -25,+3.5 db

RMS window
Adding a RMS detector isn't very difficult to make in DSP either. Here is an example:


//***per sample
//cs - current sample counter
//300 - window in ms
//sum - peak values stored here
if (cs == (0.001*300*44100)) {
cs = 0;
sum = 0;
} else {
cs += 1;
//square the abs value of the input
sum += sqr(abs(input));
}
//***execute at bigger intervals - at sample block for example
//calculate value while converting into dB
//*100/100 is to output the values in the X.XX format
rms = floor(6/log(2)*log(sqrt(sum/cs))*100)/100;


So 'rms' would be our RMS value for a 300ms window.

Thats all...well mostly. If you have any question post a comment here or send me an email.

I leave that task of making the VU meter look good to you.

Lubomir

Saturday, February 7, 2009

#Inter-sample peaks and audio compression

Inter-sample peaks have been more of a problem recently with the constant struggle for louder sound. This post includes some tests of the consistency of ISP clear audio signals after performing compression .

The above article at Gearslutz explains inter-sample peaks quite well. Just to simplify it a little bit here is a time-domain plot of a sample. This could be part of any type of sound - bass guitar, synthesizer, but this is more of a 'designed' plot, since the chance of a similar sequence appearing is minimal (there are drastic changes in sample values).



The areas marked with 'ISP' are the actual problems. ISPs are a digital-to-analog (DAC) conversation issue. Your digital medium such as CD-A may contain tracks that does not clip at all on normal meters, but in theory there is a chance that at certain sample configurations such as the shown above, the reconstructed (via interpolation) analog audio signal, exceeds 0 db. Such peaks will be introduced as distortion in listening conditions.

"Would this type of distortion be really that audible?"
It really depends on the playback system (DAC), the listener, the audio material. But it may be quite audible.

"Well how to prevent it?"
There are algorithms in some DSP limiters, that deal with the problem quite well. From my understanding of interpolation in mathematics, the only way to deal with such problems is to change values of the neighbor points (samples) forward and probably backwards in the time domain. Another important thing that must be done is to over-sample the signal so that more points are introduced in the plot.
Here is the list of the know limiters that prevent ISP:

Sonnox Limiter, Voxengo Elephant, TC Limiter, Izotope Ozone, PSP Xenon and others.
Note, that you must engage the oversampling mode of the limiter to enable the desired functionality.

As you may know most of these limiters are commercial products. The only free tools you would find are the meters, such as: John Schwartz's Bitter, SSL's X-ISM and others.
Still, if you are willing to buy a DSP limiter for your needs, I could not recommend a better limiter than Elephant. Its the cheapest, the most flexible and arguably the best sounding one.

Do the listed above tools really work for ISP?
Well here is the tricky part. There are certain conditions in which the ISP prevention may not work for any of the above products. However most of these conditions are quite extreme.

Recently I've conducted some tests with two very popular audio compression formats - MP3 and FLAC. The idea behind the test was a simple question: Does audio compression over a ISP free signal, introduces back the ISPs? Well the answer to that question ended up slightly complicated.

My first test was with a "designed" WAV file with series of samples that would positively introduce ISPs:



I've used Elephant 2 to add 24db of gain to the signal, while oversampling to x2 and limiting at -0.1 db. Then created a MP3 file directly from Reaper with LAME encoder at 320kbps, normal quality. While decoding the resulted MP3 file into Cooledit I've noticed that there is no sample clipping or eventual inter-sample peaks. Then I repeated the same test with lower bitrate MP3 - still no problems were found, after the decoding. But then I've realized that this test is flawed for the following reasons:
- the frequency response of the input signal wasn't really 'sufficient' for testing (it was just a waveform peaking around 2khz)
- the average RMS level after limiting was still quite low.

So I'vee decided to do a little bit more testing on the subject. This time with pink noise and some extreme settings.

Without explaining more I will directly post the test results. There are two tests included (for FLAC, MP3) at different RMS levels.


input: 20 sec pink noise (WN trought 6pole 'pink' filter, simple pseudo-random
numbers generation, extended with XOR)
limiter: voxengo elephant2, default settings, 4x os, roof -0.2db, test dependant
input gain.
decoding: outputs decodeded with reaper 2.55
meter: SSL X-ISM

### test 1 -12db rms:

output wav (-12db_rms_24bit.wav): 24bit, 44100hz, no dither
* result: no ISP & no clipping

output mp3 (-12db_rms_320kbps.mp3): lame 3.98, CBR 320kbps, normal q
* result: no ISP & no clipping on decode

output mp3 (-12db_rms_96kbps.mp3): lame 3.98, CBR 96kbps, normal q
* result: no ISP & no clipping on decode

output flac (-12db_rms_q8.flac): flac 1.2.1, 24bit, q8
* result: no ISP & no clipping on decode

output flac (-12db_rms_q0.flac): flac 1.2.1, 24bit, q0
* result: no ISP & no clipping on decode

### test 2 -6db rms:

output wav (-6db_rms_24bit.wav): 24bit, 44100hz, no dither
* result: no ISP & no clipping

output mp3 (-6db_rms_320kbps.mp3): lame 3.98, CBR 320kbps, normal q
* result: ISP present & clipping on decode

output mp3 (-6db_rms_96kbps.mp3): lame 3.98, CBR 96kbps, normal q
* result: ISP present & clipping on decode

output flac (-6db_rms_q8.flac): flac 1.2.1, 24bit, q8
* result: ISP present & no clipping on decode

output flac (-6db_rms_q0.flac): flac 1.2.1, 24bit, q0
* result: no ISP & no clipping on decode

### Tests summary:
Lower RMS levels for both MP3 and FLAC decode with no clipping and ISP.
Decoding of mp3 streams with higher RMS level introduce clipping,
but when normalized, ISPs are not present. Higher RMS level flac q8 does
not clip, but strangly ISP are present. Lower compression q0 for FLAC preforms
very well for higher RMS values.

The tested compressors deal much better with lower RMS values.

Test files can be downloaded from here:
mirror1
mirror2

Regarding the MP3 tests:
Decoded MP3 audio signal would only clip if the RMS of the input is very high.

There are ways to deal with this problem:


lame -b 320 --clipdetect [file]
...
WARNING: clipping occurs at the current gain. Set your decoder to decrease
the gain by at least 0.1dB or encode again using --scale
(For a suggestion on the optimal value of encode
with --scale 1 first)

You can use the --scale command in LAME or tools like mp3gain to fix this.
But still this is sample clipping. There is a chance that no ISP will be present after normalizing the MP3 singal!

Still I should point out that there are way to many parameters involved, when conduction these tests and the test results may vary a lot.

I've also did a another much more extreme test with -1db RMS values (not included). Various limiters did not perform well in prevent ISP in these extreme conditions.
Excessive levels does not do well for ISP prevention and for audio compression.

"How to deal with compression of audio?"
- always use ISP prevention over the track.
- lower the limiter roof to -0.3, -0.5db, or even -1db
- decode the resulted mp3 file with an audio editor and check for clipping
- use statistics in your encoder (such as --clipdetect in LAME)
- of course use the best encoder possible

But still, as the above test proved moderate RMS levels, may not need any normalizations and lowering of the limiter roof at all.

Lubomir

Saturday, January 31, 2009

#Quantum cryptography

You can check the following lecture by Daniel Gottesman on quantum cryptography, if you are interested in the possibilities of using quantum-computers, q-bits and super-positioning in cryptography.

Quantum computers are yet to be designed since its very difficult to tame particles and their behavior. But already, there are some very baby-stage prototypes. If you have watched science-fiction shows like StarTrek, you may have noticed that they don't use binary computers (with ones and zeros - 01010010) they use something more advanced. Maybe quantum computers are the future. They are supposed to be times faster, than any normal computer.

The lecture is 1hour, 15min long:

video at video.google.com

"Daniel Gottesman - Perimeter Institute for Theoretical Physics Sensitive information can be valuable to others - from your personal credit card numbers to state and military secrets. Throughout history, sophisticated codes have been developed in an attempt to keep important data from prying eyes. But now, new technologies are emerging based on the surprising laws of quantum physics that govern the atomic scale. These powerful techniques threaten to crack some secret codes in widespread use today and, at the same time, offer new quantum cryptographic protocols which could one day profoundly alter the way we safeguard critical information."

Saturday, January 17, 2009

#"Turn me up" vs the "LW"

The loudness war takes its victims every year. Lots of CDs are released with tracks limited to the extremes and with very high RMS levels. I've recently bought a couple of electronic music CD's. The music on both CD's is great, however the levels of one of them are pushed to the limits. I end up listening more to the less maximized CD - And I honestly enjoy it much more. The same artist from the maximized CD, was a favorite of mine in the days around 1998. His style hasn't changed much but the levels of his new music are just way too much.

Some thoughts on the 'War'
The 'loudness war' hasn't stopped for many years simply because, it always comes down to the end consumer. And the average consumer's needs for quality are not well defined. If you grab a 'squashed' CD and play to a group of ten people, there is a chance, that none of them will notice the levels and sound quality of the CD. The end consumer's needs are always a priority, but they want it really loud in most cases. Some people are more interested how the record sales will go, that the quality of their music.

Artist with no technical background will always try to compete for the volume of their CD. But what about the engineer's involvement into the process? I think engineers are the ones, who are supposed to explain to the artist, that they are losing quality when the mix is pushed hard. The engineer should always give options to the artist: "Would you like it loud, with tonal balance or would you like it well balanced, not that loud, but without losing quality"? If the engineer, always gives these options to the client maybe the client will start to understand and care more about his own record.

I'm more on the hunt to buy old records which aren't remastered, than taking my chances with modern music that is squashed ('in the face'/'wall of sound') nowadays.

After all, sound quality is not a function of loudness!

'But I like to do everything myself. What levels should I aim for?'
In practice there isn't a single answer to that technical question, simply because the levels you end up with are dependent from the material you are mixing. You shouldn't compare a techno track with a chilled ambient track. The most important bit - learn to distinguish, an unnecessarily loud mix from a well balanced mix. Then try to match the levels of the well balanced mix.

'My track sounds quiet and with less energy compared to other tracks'
Do not fall into the trap. First of all, mix the levels of your track to sound normal! Have you noticed that we use the volume knob of amplifiers less these days. Technically this is not a good thing and speaks bad for the quality of the music we are listening to.

'How do we stop the war?'
As most wars, were started by 'leaders' in the history of human kind. The 'loudness war' should be stopped by the people who originally started it - those who are famous in the music industry. The 'leaders' aka the famous people/groups/bands of POP, METAL, ROCK, HOUSE, R&B music and all other modern styles. Famous mastering engineers should officially declare 'I will not master this record' if the client wants it way too lound. If you get Madonna, Metallica, Benny Benassi, Beyonce and other to release their music with the levels taken into consideration maybe the whole industry will change.

Soon...maybe next year? Not likely, If you ask me. It would be a very slow process to bring back the dynamics. Stop the war now or it will stop the record sales.

'Turn me up'
If you are an artist, a producer, engineer or just a person who appreciates quality music you can support 'Turn me up'.

http://www.turnmeup.org


Famous engineer/producer Charles Dye is behind 'Turn me up' and the idea of the project is simple. First of all its a non commercial project. If you are an artist, who is soon about to release a CD to the market, you can register for a 'Turn me up' certificate and put their logo on your CD. By doing so you can go easy on the levels and not compete with other loud mixes. If you are a mixing/mastering engineer you can offer the ideas of 'Turn me up' to your customers and not use much limiting when working on the tracks.

You can visit their website and read some of the articles on the 'Loudness war' if you are interested.

Lubomir

Sunday, January 11, 2009

#Web browsers in the beginning of 2009

The truth about Internet Explorer 7
As a regular Windows XP user, I've been testing many web projects that I'm working on with IE6 (SP2). Since IE is a browser that many people are supposed to use, I regulary check if the project has compatibility with it.
However recently I noticed that more and more new stuff isn't working quite well (or slightly out of order) with IE6. For example a button on a major site misplaced, flash player loading issues etc. So I've decided that I should upgrade to IE7. The download was 15MB. Installs ok. I did a test run. First impressions: very nice look on the buttons, text was blured by default with 'ClearType'. Some new cool settings...
But as soon as I started testing to see if those issues mentioned above are fixed not much happened. Everything was exactly the same. Lots of JavaScript in the console and blog pages which look exactly the same in Opera, Chrome & FF in IE7 had strange misplacement effects appearing all over the place :(. So what exactly is the IE6 to IE7 update? I have to say its similar to the update XP > Vista which I never intend to make for various reasons (But I've managed to configure Vista to run like XP on a laptop once). IE7 appears to be a fancy looking IE6. More and more developers are starting to completely ignore IE as a target browser. Well thats no good for the IE team because they would have to change a lot.

The 'innerHTML' issue in IE
The innerHTML property originated from the developers of IE at Microsoft. Its an excellent solution and it can be used instead of writing complex DOM code. 'innerHTML' treats all the nodes inside an object as a whole. If you say for example that you have a nested html tag structure... With DOM you can return the parent tag as an object by id or tagname and then via the innerHTML property you can assign the contents of this tag to a string variable. This makes things extremely easy now since you can modify this string (ex: add more tags) and then assign the modified string back to the html tag via the innerHTML property which basically will result a new structure. Sounds great! I often compare innerHTML to the PHP simpleXML extention which is also a great solution for parsing data without large sections of DOM code.

So...MS invented this awesome property but does it work under Internet Explorer? The answer is no :)). IE6 returns the infamous "Unknown runtime error", IE7 does the same. Are there any workaround? Yes they are some, but this is an actual bug (described here) and some of the workarounds aren't exactly working. 'innerHTML' isn't an 'official' property but its quite fast and awesome. To sum things up MS invented something very good then their own browser has problems with it, while all other browsers get along perfectly with it.

The chrome fox in the opera
To test websites, I often run them on different browsers (Windows), so I have some ideas about how these browsers perform and what are their pluses and minuses. These are the browsers I'm testing with: Opera, IE, Firefox, Chrome. My desktop PC isn't the top of the benchmark table, but in a way that's a good thing (you can get better idea of the performance of certain software on lowend machines). It seems strange to me that some people at forums say: I run Vista on my super new computer and the OS only takes 1GB of my RAM. Well...1GB for what exactly? Your OS should take around 200MB of RAM or so. Now the same applies to how browsers should work. A browser should not be a 'CPU hog' and should not take all your RAM away. There should be absolutely no reason for doing so unless its rendering some heavy graphics in realtime or if its compiling something. Also there should be options to disable the functionality which is creating this need for extra resources.

I have to say that I'm a recent Opera to Firefox convert. I'm still a big Opera fan and I follow its development closely. Opera is the fastest and the most light browser out there but I had a lot of problems loading websites with some footprint AJAX. So I've switched to FF as my default (Most dev writes for FF as their default target btw). But then...I had the issue of huge memory leak with FF. So I had to fix this with a 'hidden' setting (in a way its not that easy for some users to find this setting without googling on the subject). I think the same solution to the problem is explained here. This issue almost send me back to Opera.

I also monitor the development Google's new Chrome browser. They have a great technology concept and a lot of unique features. So far, I'm seeing it as a faster and lighter alternative to FF. The 'import' settings from different browsers is cool too. And everything seems to open properly. But its quite stripped down and there is something very strange! If I open Youtube for example and then my mail account on another window the cpu usage goes up to 40%!?. There must be something really expensive and hidden going on (probably some sort of caching which is absolutely unnecessary). The options menu of Chrome are very simple so there is no function to disable this behavior. I have great respect for Google and I believe they will eventually add a function to disable extras.

So to sum this up: IE needs lots of work (DOM2 compitabuility, lots of bugs), Opera definitely still needs some work to support the new technologies, FF uses way too much RAM by default, Chrome needs more settings so that the user can turn of the so called 'inovative' stuff.
We end up with a slightly broken set of tools...I'm currently using a tweaked Firefox. But don't get me wrong all of the listed browsers can do their job but IMHO its just silly when you visit a site with IE and the site dev hasn't added support for it. Or when you use fresh installed FF and your RAM usage meter shows 400MB ram if you open a couple of video sites.

The future is bright
I think that all browser author companies's goal should be: To show contents of the Web in exactly the same way, while sticking to the same standards and not to force website developers to write extra code for browser compatibility. And I'm seeing more and more of that which is a very good thing. The frustration of website developers (including myself :) may be eventually reduced to minimum. We shall see. :)

Lubomir

Saturday, January 10, 2009

#SJEA - Simple Java Encryption Algorithm

Not long ago (around 2007), I wrote this simple encryption algorithm to help out a friend with the master's degree in computing. After a while I realized this could turn out to be a great stand alone project.

It was collecting dust for quite some time (one year or so) and I've decided that I should work more on this and complete it as a accessible public package. So recently I've managed to tidy the source, make some examples, write the documentation and now its finished - SJEA (Simple Java Encryption Algorithm). I have to admit the name is a bit silly for the simple reason that the 'J' can be replaced very easily (with source porting) to 'C' as a 'Simple C Encryption Algorithm' SCEA or anything else to be honest.

Going back to cryptography studies was pure fun. Back in the day around y2000 I was reading a lot on the subject and this resulted a lot of drafts. I guess this project will be the first I release under GPL. Now back on the topic.
SJEA v1.0
SJEA started when I was looking for an alternative solution (a completely custom algorithm) to all the pre-made libraries in JAVA, C etc. Having something for granted is cool, but making your own tools may give you some great satisfaction. The idea of the project was that the result are good (hard to hack/decrypt) but the source (roots of the algorithm) easy to understand by people who are new to this type of study. So I've decided to have a go with Block and XOR ciphers. I was dealing with such for quite a while, so it wasn't a problem to implement them into some sort of a starting template.

The XOR method (the method behind all the calculation) is quite simple to understand:
We have an input byte that we sum with a key (modifier) and then we have a result. But if we subtract the key from the end result we will get the original input byte.

where A-input, B-mod, C-sum for a single byte entry
A+B=C //encryption
C-B=A //decryption


In SJEA the 'ECB' (Electronic codebook) window method can be found since we use a user password as our key. The password is used as a first layer of encryption. A vector byte-array is also present as a second layer. This complicates things a little (not that much) since even if you know the key modifier layer you wouldn't know the value of the vector.

Here is the 2-layer encryption scheme:

     (bytes)
      input: AAAAAAAAAAAAAAAAAAAAA + (sum)
     vector: 01234567890ABCDEF0123 + (sum)
   password: HELLOHELLOHELLOHELLOH =
     result: XXXXXXXXXXXXXXXXXXXXX


The project can be aimed at the following audiences:
- students of computing
- future algorithm programmers
- people who a learning into cryptography

It may eventually grow into a lot bigger project with many different encryption examples.

And here is a brand new website hosted by sourceforge.net:


http://sjea.sourceforge.net/


or the googlecode page:
http://code.google.com/p/sjea/

Lubomir

Wednesday, January 7, 2009

#MP3 player in blog - done easy

I've extended the 'hcon' JS lib to allow quick embedding of MP3 files.

The MP3 embed code is also stored here:
<script src='http://sites.google.com/site/neolit123/Home/hcon' type='text/javascript'/>

The above line should be embedded in you blog template.

How does it work:
<mp3 file="http://locationtomyfile.com/file.mp3" title="Song title goes in here"></mp3>

Demo:


The code is using 'innerHTML' once again so it may not work under IE.
If you wish to modify the JS (mp3 player URL, style etc) download it from here(rename to .js). More info about the player: http://www.1pixelout.net/.

Enjoy
Lubomir