Apply De-emphasis?

This section is now closed
Forum rules
Audacity 1.2.x is now obsolete. Please use the current Audacity 2.1.x version.

Mac 0S X 10.3 and earlier are no longer supported but you can download legacy versions of Audacity for those systems HERE.
aka
Posts: 10
Joined: Sat Jan 24, 2009 7:50 pm
Operating System: Please select

Apply De-emphasis?

Post by aka » Tue Mar 17, 2009 7:20 pm

I have files (.wav from an 80's Japan CD) that have pre-emphasis applied - is there a way to apply de-emphasis to correct these using Audacity?

kozikowski
Forum Staff
Posts: 68653
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Apply De-emphasis?

Post by kozikowski » Tue Mar 17, 2009 7:27 pm

Can you find a technical definition of the characteristic? Don't worry if you don't understand it We'll take care of that.

FM broadcasting in the US uses a 75 microsecond pre-emphasis characteristic and I have all the charts and graphs and books about how that's supposed to work, but I've never heard of this one.

Koz

aka
Posts: 10
Joined: Sat Jan 24, 2009 7:50 pm
Operating System: Please select

Re: Apply De-emphasis?

Post by aka » Tue Mar 17, 2009 7:33 pm

Koz,

I don't know a lot about the technicalities - but this is how SoX handles it (from the SoX PDF doc):

deemph
Apply ISO 908 de-emphasis (a treble attenuation shelving filter) to 44.1kHz (Compact Disc)
audio.
Pre-emphasis was applied in the mastering of some CDs issued in the early 1980s. These included
many classical music albums, as well as now sought-after issues of albums by The Beatles, Pink
Floyd and others. Pre-emphasis should be removed at playback time by a de-emphasis filter in the
playback device. However, not all modern CD players have this filter, and very few PC CD drives
have it; playing pre-emphasised audio without the correct de-emphasis filter results in audio that
sounds harsh and is far from what its creators intended.
With the deemph effect, it is possible to apply the necessary de-emphasis to audio that has been
extracted from a pre-emphasised CD, and then either burn the de-emphasised audio to a new CD
(which will then play correctly on any CD player), or simply play the correctly de-emphasised
audio files on the PC. For example:
sox track1.wav track1-deemph.wav deemph
and then burn track1-deemph.wav to CD, or
play track1-deemph.wav
or simply
play track1.wav deemph
The de-emphasis filter is implemented as a biquad; its maximum deviation from the ideal response
is only 0.06dB (up to 20kHz).

Thanks,
aka

kozikowski
Forum Staff
Posts: 68653
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Apply De-emphasis?

Post by kozikowski » Tue Mar 17, 2009 8:09 pm

OK. I found the PDF (on an insanely slow server) and as soon as it comes down, I'll see if I can sweet talk Steve into writing it.

Koz

kozikowski
Forum Staff
Posts: 68653
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Apply De-emphasis?

Post by kozikowski » Tue Mar 17, 2009 8:31 pm

Found one. I can almost write this myself....

http://www.audioxpress.com/magsdirx/ax/ ... lo3025.pdf

I'll try it later.

Koz

aka
Posts: 10
Joined: Sat Jan 24, 2009 7:50 pm
Operating System: Please select

Re: Apply De-emphasis?

Post by aka » Tue Mar 17, 2009 9:02 pm

Excellent!

Thank you for your time and effort, Koz.

I await your reply....

aka

kozikowski
Forum Staff
Posts: 68653
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Apply De-emphasis?

Post by kozikowski » Wed Mar 18, 2009 6:42 am

We are exposing one shortcoming of Audacity and that's the need to manually edit the equalizing curves.

Get a strong cup of coffee.

<curve name="RedBookPre">
<point f="700.000135021151" d="0.000000000000"/>
<point f="1000.101652520304" d="-0.500512741089"/>
<point f="1950.142416511543" d="-1.398496627808"/>
<point f="3000.068564380608" d="-2.502575836182"/>
<point f="5000.000948851137" d="-5.004147338867"/>
<point f="10000.005928346302" d="-7.520062176514"/>
<point f="20000.322508988818" d="-9.504367828369"/>
</curve>

Reader's Digest version: Copy that code and paste it into EQCurves.xml. When you open the equalizer for your project, there should be a new curve called RedBookPre. Apply it.


Non Reader's Digest Version:

I did this in Audacity 1.3, not 1.2.

/Users/koz/Library/Application Support/audacity/EQCurves.xml

Open EQCurves.xml in TextEdit (set for Plain Text, not Rich Text) and you will see many more complex filters like the one above. Pull out the TextEdit window really wide. Follow the natural rhythm of the programming and paste that above programming in with the others. Save the file.

Open up your show and Select the whole performance. Effect > Equalization. (This tool location is different on every Audacity. Sorry).

One of the equalization filters should be RedBookPre. Select and apply it. The brightness in the music should vanish.

I took the web site and copied the cardinal data points from the graph and translated them into action points for the filter. I expect the errors to be functionally invisible.

Koz

aka
Posts: 10
Joined: Sat Jan 24, 2009 7:50 pm
Operating System: Please select

Re: Apply De-emphasis?

Post by aka » Wed Mar 18, 2009 1:28 pm

Man, they need a :bow: smilie!

Thank you, Koz!

This is truly above and beyond!

off to tinker...
aka

ps: Yes!! Perfect! Hat's Off, Koz!
:D

steve
Site Admin
Posts: 80326
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Apply De-emphasis?

Post by steve » Wed Mar 18, 2009 10:06 pm

You can do something very similar using Nyquist, though it will be very much slower than using the Equalizer.
(Also, it may require Audacity 1.3 rather than 1.2)

I don't have any suitable material for testing to find the optimum settings, but the values used here are hopefully about right.

Code: Select all

(if (arrayp s)
   (vector (eq-highshelf (aref s 0) 4000 -9.6 0.7)
           (eq-highshelf (aref s 1) 4000 -9.6 0.7))
   (eq-highshelf s 4000 -9.6 0.7))
If you want to test this out, simply select some audio and from the Effects menu select "Nyquist Prompt", then copy and paste the code into the Nyquist dialogue box. The advantage of using Nyquist is that the values can be easily be adjusted - the disadvantage is that it is a lot slower than the Equalizer.

If you would like to try it as a plug-in, download the attachment and unzip it into your plug-ins folder. When you restart Audacity it will be listed in the Effects menu as "De-emphasis..."
This plug-in has been tested on Audacity 1.3 only.

I would be interested to hear what settings work best - I can then set those as the defaults.
Attachments
de-emphasis.ny.zip
De-Emphasis plug-in for Audacity 1.3.x
(438 Bytes) Downloaded 579 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 68653
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Apply De-emphasis?

Post by kozikowski » Thu Mar 19, 2009 12:08 am

Where did you get the numbers from? The only defined points I know about are from the web site at 1061, 3183, and 20000. And the two time constant numbers, of course.

Given enough calculations, you can get back and forth between them.

That makes my head hurt...

Koz

Locked