PDA

View Full Version : BeHappy - AviSynth based audio transcoding tool (UPD 19-07-2006)


Pages : [1] 2 3 4 5

dimzon
27th December 2005, 13:45
http://img464.imageshack.us/img464/2619/bh720je.png

Use-Case
BeHappy is designed mostly for movie audiotrack transcoding. It's powerfull BeLight/BeSweet replacement. So do not ask me about:

Batch trancoding support
Tags support

If You need to transcode multiple files at "one click" and/or tagging support - use foobar2000 (http://foobar2000.org/) converter

Screenshots
http://img107.imageshack.us/img107/8316/untitled6ta.png

http://img167.imageshack.us/img167/7659/untitled5vg.png

http://img288.imageshack.us/img288/9819/untitled8kq.png http://img259.imageshack.us/img259/7243/untitled2xe.png

http://img101.imageshack.us/img101/9778/untitled4ey.png http://img127.imageshack.us/img127/2340/111111111111118dm.png http://img99.imageshack.us/img99/4794/untitled2uy1.png

http://img62.imageshack.us/img62/6428/c19lr.png

http://img232.imageshack.us/img232/274/aftenam4.png

http://img88.imageshack.us/img88/5688/untitled5ez1.png

http://img142.imageshack.us/img142/6162/untitled0lk2.png

http://img139.imageshack.us/img139/3029/untitled8rr.png

http://img114.imageshack.us/img114/2207/untitled7bq.png

http://img105.imageshack.us/img105/6730/untitled7ir.png

System requirements

Supported operating systems: Windows 2000, Windows XP, Windows XP 64-bit edition, Windows Vista
RAM: 128MB
Display: 800x600 resolution
Microsoft .NET Framework Version 2.0 (http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en)
Avisynth v2.56 (http://sourceforge.net/project/showfiles.php?group_id=57023)


Installation

Download and extract latest BeHappy from BeHappy Workspace (http://workspaces.gotdotnet.com/behappy)
Download and extract latest NicAudio.dll from BeHappy Workspace (http://workspaces.gotdotnet.com/behappy), place NicAudio.dll to AviSynth plugins folder
If You plan to use Stereo To 5.1 UpMix functionality download and extract latest SoxFilter from here, place it to AviSynth plugins folder
If You plan to use AudX MP3 5.1 surround encoding download and extract latest enc_AudX_CLI from BeHappy Workspace (http://workspaces.gotdotnet.com/behappy), place enc_AudX_CLI.exe and audxlib.dll to BeHappy folder
If You plan to encode to MP3 download and extract Lame encoder from rarewares (http://rarewares.org/mp3.html) (recomended version is 3.97b2). Place lame.exe into BeHappy folder
If You plan to encode to OggVorbis download and extract fresh OggEnc2 from rarewares (http://rarewares.org/ogg.html), place oggenc2.exe to BeHappy folder
If You plan to encode to FLAC download and extract fresh FLAC (http://flac.sourceforge.net/) coder, place flac.exe into BeHappy folder
If You plan to encode to WavPack download and extract fresh WavPack encoder (http://www.wavpack.com/), place wavpack.exe into BeHappy folder
If You plan to use Coding Technologies AAC encoder (http://codingtechnologies.com/products/aacPlus.htm)

Download and extract latest enc_aacPlus from BeHappy Workspace (http://workspaces.gotdotnet.com/behappy), place enc_aacPlus.exe to BeHappy folder
Download and extract latest GPAC's MP4Box, place mp4box.exe to BeHappy folder
Download and install fresh WinAmp player (http://winamp.com/player/free.php) (Full version is enought)
Copy enc_aacplus.dll and nscrt.dll from Winamp\Plugins to BeHappy folder
If You doesn't want to use WinAmp You can uninstall it now ;)

If You plan to encode to Nero AAC download and extract fresh FREE NeroDigital AAC (http://www.nero.com/nerodigital/eng/Nero_Digital_Audio.html), place neroAacEnc.exe and neroAacEnc_SSE2.exe into BeHappy folder




Original idea


Workspace (http://workspaces.gotdotnet.com/behappy) is hosted @ http://www.gotdotnet.com/workspaces/ui/resources/gdn/images/logo.jpg (http://workspaces.gotdotnet.com/behappy)

Note
MeGUI since v 0.2.3.2038 23 Jan 2006 share same code with BeHappy. So you can use MeGUI for audio encoding via AviSynth too. MeGUI audio part has less functionality/flexibility but is more stable

Mini FAQ:
TODO

tebasuna51
27th December 2005, 20:48
*** READ THIS: actualized 2008-02-05 ***

- BeHappy Workspace link don't work because GotDotNet Workspaces have been phased out.

- New BeHappy home: CodePlex BeHappy project (http://www.codeplex.com/BeHappy) with last mod's included.


------------------------------------------
*** Now the original post ***
------------------------------------------

Good job, Dimzon!

For me work the 'Delay', 'Split', 'Downmix', ...

Only with the 'Upmix' I get always:
Error: Can't find audio stream!

Please be patient with me, because I have a lot of comments:

Questions
In Avisynth internal plugin info say SuperEq(string filename), then wait for a parameter like this:
SuperEq("C:\Equalizer Presets\Loudness.feq")
Can work SuperEq(clip, values="0 0...96...0")?

In Upmix using Reverberation you put the plugin reverb(). Is a external plugin and need be downloaded?

EnsureVBRMP3Sync(). We can work with mp3 audio?. Is not necessary a decoder first to work with uncompressed audio?

If is possible, EnsureVBRMP3Sync() must be before AudioDubEx(BlankClip(...)) or after?

Petitions
With buttons 'New' and 'Edit' in Source, DSP and Destination we can test others decoders, DSP functios and encoders.

Please include the Downmix - DPL I, like DPL II but:
ssr = MixAudio(sl, sr, 0.2222, 0.2222)
ssl = Amplify(ssr, -1.0)


Bugs
The last buffer send to the encoder can be incomplete but is send complete, then there are extrabytes at end.
The RiffChunkSize in wav header is incorrect.

A example (without DSP), the same Input.wav and three outputs:
Input.wav (with correct classical wav header)
--------------
FileLength ..: 1920044 bytes
RiffChunkSize: 1920036 Ok = FileLength - 8 = DataLength + 36
DataLength ..: 1920000
Duration ...: 10.000000 sec.

Output.wav (RiffChunkSize error, Extrabytes at end of file)
--------------
FileLength ..: 1933356 bytes
RiffChunkSize: 1920450 Error: Must be FileLength - 8 = 1933348
DataLength ..: 1920000 Warning: ExtraBytes at end of file, bytes = 13312
Duration ...: 10.000000 sec. (with DataLength Ok, extrabytes are ignored)

Output.dat (Raw PCM, without header)
--------------
FileLength ..: 1933312 bytes
Duration ...: 10.069333 sec. Error: Extrabytes interpreted as data

Output.ogg
--------------
Duration ...: 10.069333 sec. Error: Extrabytes interpreted as data
Another warning: with source 5.1, 48 KHz (ac3, aac, dts, ...) greater than 124 min. 16.54 sec
m_nSizeInBytes = m_nSampleCount * nBlockAlign is > 2^32, then we need a int64 variable in source code.

chros
28th December 2005, 11:04
Isn't there mp3 output yet ?

dimzon
28th December 2005, 12:34
@tebasuna51
Upmix is not forking yet, this is just algorytm, not working script yet!

EnsureVBRMP3Sync - I think it must be right after decoder. I believe this is just buffering to avoid desync and it can be used with any source type (maybe i'm wrong?)

Petitions
Please include the Downmix - DPL I, like DPL II but:
ssr = MixAudio(sl, sr, 0.2222, 0.2222)
ssl = Amplify(ssr, -1.0)

I beleive you can do it yourself - just edit downmix.extension via notepad - I believe you are able to do it. And don't forget to share modified file with me :D

With buttons 'New' and 'Edit' in Source, DSP and Destination we can test others decoders, DSP functios and encoders.
there are some troubles implementing this functionality... But you can add new Source, DSP and Destination manualy:
Creating new Source
Use nicaudio.extension as starting point for new source. Copy it to yorsource.extension and open via notepad. Don't forget to generate new UUID(GUID) for UniqueID attribute
Edit Name attribute and
Edit <Script> element
{0} means input file name
{1} means output file name
{2} means unique string (to use as part of identifier)
{3} means '{' character (to allow '{' to be used)
{4} means '}' character (to allow '}' to be used)
Add/Delete/Edit <SupportedFileExtension> element

Sample:
<?xml version="1.0"?>
<BeHappy.Extension
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioSource Name="MySourceName" UniqueID="5D209A6D-E6EA-4640-AF60-BAE14A529792">
<Script>SomeSource("{0}")</Script>
<SupportedFileExtension>ext1</SupportedFileExtension>
<SupportedFileExtension>ext2</SupportedFileExtension>
<SupportedFileExtension>ext3</SupportedFileExtension>
</AudioSource>
</BeHappy.Extension>

Creating new DSP
There are 2 ways to create simple DSP:
Creating very simple DSP
Example:

<BeHappy.Extension
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP Name="Normalize to 100%" UniqueID="6158f79f-d8a0-4021-89ae-b77b37c04c55">
<Script>
# Some script:
Normalize()
</Script>
</AudioDSP>
</BeHappy.Extension>
Creating multioption DSP
Take look @ DownMix.extension and UpMix.extension - good examples of multioption DSP
<?xml version="1.0"?>
<BeHappy.Extension
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>DSP Name, Selected Option = {0}</TitleFormatString>
<ScriptPrologue>
# ScriptPrologue
# this part of script will be included in resulting script without any conditions
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</ScriptPrologue>
<Option>
<Name>Option Name 1</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<Option>
<Name>Option Name 2</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<Option>
<Name>Option Name 3</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<Option>
<Name>Option Name 4</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<Option>
<Name>Option Name 5</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<Option>
<Name>Option Name 6</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<Option>
<Name>Option Name 7</Name>
<Value>
# this part of script will be included in resulting script only if this option is selected
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</Value>
</Option>
<ScriptEpilogue>
# ScriptEpilogue
# this part of script will be included in resulting script without any conditions
# {0} means input file name
# {1} means output file name
# {2} means unique string (to use as part of identifier)
# {3} means '{' character (to allow '{' to be used)
# {4} means '}' character (to allow '}' to be used)
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

Creating new Destination
Creating new Destination is very close to new Source. Take look @ ffmpeg-ac3.extension, enc_aacPlus.extension, wavpack.extension, flac.extension
<ExecutableArguments>
{0} means output file name
{1} means samplerate in Hz
{2} means bits per sample
{3} means channel count
{4} means samplecount
{5} means size in bytes

Example:
<?xml version="1.0"?>
<BeHappy.Extension
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioEncoder Name="EncoderName" UniqueID="83517DA6-B34F-45ee-B48C-5D9370CC6032">
<Script>#Some script to be used for this encoder</Script>
<ExecutableFileName>encoder.exe</ExecutableFileName>
<ExecutableArguments>- "{0}" --cbr 32000</ExecutableArguments>
<SupportedFileExtension>ext1</SupportedFileExtension>
<SupportedFileExtension>ext2</SupportedFileExtension>
<SupportedFileExtension>ext3</SupportedFileExtension>
</AudioEncoder>
</BeHappy.Extension>

Creating a really complex Source/DSP/Encoder with it's own GUI
If you are familiar with .NET you can create really fine and complex extension. Take look @ BeHappy.OggVorbis.Encoder.Extension project.
You must:

Create Class Library
Add reference to BeHappy.Extensibility.dll
Impelent IDigitalSignalProcessor or IAudioSource or IAudioEncoder interface
Optionally implement ISupportConfiguration interface
Create .extension file (refer to BeHappy.OggVorbis.Encoder.extension for example)


PS. One *.extension can contain any amount of DSP Source and Encoder at same time

dimzon
28th December 2005, 14:11
fresh beta out

dimzon
28th December 2005, 15:12
Bugs
The last buffer send to the encoder can be incomplete but is send complete, then there are extrabytes at end.
Finally I found a bug in Microsoft VfW AVIStreamRead function - it still "read" data even if EOF is alredy occured....

Now I'm using such workaround:

int nHowMany = Math.Min((int) (m_aviStreamInfo.dwLength-frameSample), MAX_SAMPLES_PER_ONCE) ;
AVIStreamRead(m_aviStream, frameSample, nHowMany, h.AddrOfPinnedObject(), frameBufferTotalSize, out bytesRead, out samplesRead);

dimzon
28th December 2005, 19:42
http://img309.imageshack.us/img309/1055/untitled2222bw.jpg

download it @ workspace @ gotdotnet.com

tebasuna51
29th December 2005, 02:22
Thanks for your rapid and large answer. I have a lot of work to do.
First I want answer your questions.
EnsureVBRMP3Sync - I think it must be right after decoder. I believe this is just buffering to avoid desync and it can be used with any source type (maybe i'm wrong?)
I think is not necessary for uncompressed audio, but I'm not sure.
Which software did You use for such diagnostic?
I make a little utility to read wav header. But with a hex editor (I use WinHex) you can see the header (only 44 bytes). Here is a graphical description of wav header:
http://ccrma.stanford.edu/courses/422/projects/WaveFormat/
I can use int64 in source BUT there are only 4 bytes in WAV HEADER - how I must write this to WAV?
This is the problem for the wav limit 4 GB. And 2 GB limit is for soft using 'signed long int' for these fields.
The faad decoder (aac) can generate 'invalid' wav's > 4 GB, and fill these fields (RiffLength and DataLength) with 0xFFFFFF00.
Foobar also make 'invalid' wav's > 4 GB, and fill these fields with the 4 low order bytes.
Really the only way, afaik, to use a wav > 4 GB is split it in mono wav's. Then Tranzcode, WaveWizard and BeSplit can generate valid (not for BeSplit because a bug in BlockAlign field) mono wav's with the original length. The method is ignore these fields and continue working until end of file.
I prefer the faad method (0xFFFFFF00) because Foobar method can be confused with valid fields.
Can you fix my source?
I send you a PM (2005-12-19) about this. In your previous BeHappy version you use for DataLength:
Int64 nByteSize = streamSampleLength * m_WavHeader.nBlockAlign;
target.Write(BitConverter.GetBytes((uint)Math.Min(nByteSize,uint.MaxValue)),0,4);
And I suggest you use the same method for RiffLength. In actual version the int64 is missing and you use for DataLength the method from RiffLength (?).

In the actual version, the variable with possible overflow is used also in:
private uint m_nSizeInBytes;
...
m_nSizeInBytes = m_nSampleCount*m_wavHeader.nBlockAlign; // may be > 2^32
...
private void createEncoderProcess()
...
info.Arguments = string.Format(m_commandLine, m_output,
m_wavHeader.nSamplesPerSec, m_wavHeader.wBitsPerSample,
m_wavHeader.nChannels,m_nSampleCount,m_nSizeInBytes);

dimzon
29th December 2005, 10:56
I prefer the faad method (0xFFFFFF00) because Foobar method can be confused with valid fields.

pleaese check this code:


private long m_nSizeInBytes;
...
private void writeHeader(Stream target )
{
const uint FAAD_MAGIC_VALUE = 0xFFFFFF00;
const uint WAV_HEADER_SIZE = 36;
bool useFaadTrick = m_nSizeInBytes>=(uint.MaxValue-WAV_HEADER_SIZE);
target.Write(System.Text.Encoding.ASCII.GetBytes("RIFF"),0,4);
target.Write(BitConverter.GetBytes(useFaadTrick?FAAD_MAGIC_VALUE:(uint)(m_nSizeInBytes + WAV_HEADER_SIZE)),0,4);
target.Write(System.Text.Encoding.ASCII.GetBytes("WAVEfmt "),0,8);
target.Write(BitConverter.GetBytes((uint)0x10),0,4);
target.Write(BitConverter.GetBytes(m_wavHeader.wFormatTag),0,2);
target.Write(BitConverter.GetBytes(m_wavHeader.nChannels),0,2);
target.Write(BitConverter.GetBytes(m_wavHeader.nSamplesPerSec),0,4);
target.Write(BitConverter.GetBytes(m_wavHeader.nAvgBytesPerSec),0,4);
target.Write(BitConverter.GetBytes(m_wavHeader.nBlockAlign),0,2);
target.Write(BitConverter.GetBytes(m_wavHeader.wBitsPerSample),0,2);
target.Write(System.Text.Encoding.ASCII.GetBytes("data"),0,4);
target.Write(BitConverter.GetBytes(useFaadTrick?FAAD_MAGIC_VALUE:(uint)m_nSizeInBytes),0,4);
}

tebasuna51
29th December 2005, 12:26
@Dimzon
Yes, I think can work OK.
Thanks.

dimzon
29th December 2005, 13:45
introducing new feature - Multioption encoder (wait for fresh beta)
http://img521.imageshack.us/img521/5043/cool3oj.png

scharfis_brain
29th December 2005, 14:54
I don't know whether you are already doing this:

any_audiosurce()
ConvertAudioTo24bit() #or better float or 32bit
downmix() / upmix() / normalize()
ConvertAudioTo16bit()

this should effectively reduce rounding errors.

dimzon
29th December 2005, 15:07
I don't know whether you are already doing this:

any_audiosurce()
ConvertAudioTo24bit() #or better float or 32bit
downmix() / upmix() / normalize()
ConvertAudioTo16bit()

this should effectively reduce rounding errors.
thanx, i will implement it nex year!

dimzon
29th December 2005, 15:27
New beta is out!
Get it @ workspace @ gotdotnet.com

Prodater64
29th December 2005, 15:32
Usually, ac3 to ac3 encodings with besweet (and also with ffmpeg as i heard) has a problem, that resulting ac3 has low volume.
Has BeHappy same problem or does it manage this issue well?

dimzon
29th December 2005, 15:43
Usually, ac3 to ac3 encodings with besweet (and also with ffmpeg as i heard) has a problem, that resulting ac3 has low volume.
Has BeHappy same problem or does it manage this issue well?
BeHappy use ffmpeg for AC3 encoding bcz there are not any another free avaluable AC3 encoder :(

dimzon
29th December 2005, 16:51
Hey! Now we can create more advanced DSP using Sox Audio Effect Filter !

dimzon
29th December 2005, 17:43
2 All
Hi! You can help BeHappy project!
I need:
New DSP scripts - Dinamyc Range Compression e.t.c
BeHappy logo & icons

tebasuna51
30th December 2005, 17:24
Now BeHappy works Ok with wav header and without extrabytes at end.

I make a test with a source 5.1, 48 KHz (ac3) > 132 min. and BeHappy works Ok for wav > 4 GB and for a transcode to aac.

Relevant info of input.ac3
SampleRate 0 : 48000 KHz.
BitRate 15 : 448 Kb/s.
Audio coding mode (acmod) 7 : 3/2 - L, C, R, SL, SR
Low Frequency Effects channel 1 : Present
FileSize : 444358656 bytes.
Frames : 247968
Duration : 7934.976 seconds ( 2 h. 12 m. 14.976 s.)

Relevant info of output.wav
FileSize ....: 4570546220
RiffLength...: 4294967040 (= 0xFFFFFF00) Error: ... (always with > 4GB)
NumChannels .: 6
SampleRate ..: 48000
OffsetData ..: 44
DataLength ..: 4294967040 (= 0xFFFFFF00) Warning: assumed Datalength = 4570546176 (FileSize - 44)
Duration ...: 7934.976 sec., (2h. 12m. 14.976 s.)
For aac transcode I use:
behappy.extension.encoder.nero7aac.exe -o "D:\...\132.mp4"
-rr 48000 -rb 16 -rc 6 -vbr_streaming
-aacprofile_he -codecquality_high

Relevant info of output.mp4 (from Foobar2000 v0.8.3)
bitrate = 191
samplerate = 48000
channels = 6
aac_profile = HE AAC
codec = AAC
tool = Nero AAC Codec 4.2.1.0
samples = 380878848
FileSize = 189,944,318 Bytes (181.15 MB)
Length = 2:12:14.976

As you can see the duration is preserved exactly. Congratulations Dimzon.

FredThompson
31st December 2005, 04:40
What ideas do you have for the logo? (colors, style, some logos you like, etc.)

To buttress the Hun's suggestion: http://www.digitalprosound.com/Htm/SoapBox/soap2_Apogee.htm

It deals with sample rate, not resolution but the concept still applies, expand to at 2x, preferably 4x, do the modifications, downsample.

tebasuna51
31st December 2005, 12:02
I don't know whether you are already doing this:

any_audiosurce()
ConvertAudioTo24bit() #or better float or 32bit
downmix() / upmix() / normalize()
ConvertAudioTo16bit()

this should effectively reduce rounding errors.
From AviSynth doc:

Starting from AviSynth v2.5. If some filters doesn't support a specific sample type, they are converted to the format preserving most quality (most often floats). Float samples are also automatically converted back to 16bit before delivering them as output.
SoxFilter converts audio to 32 bit integers.
Amplify: 8bit and 24bit Audio samples are converted to float in the process, the other audio formats are kept.
Normalize: The audio sample type is converted to float or is left untouched if it is 16 bits.
SSRC Shibata Sample Rate Converter is a resampler. Audio is always converted to float.
...

Then a first conversion to a specific format don't guarantee maintain this format along a DSP function.
We can analyze each DSP to search the optimum format.

scharfis_brain
31st December 2005, 12:31
since we are using several chained instances of mixaudio, we need to process in a higher bit depth than 16 bit.

Prodater64
2nd January 2006, 04:53
I don't understand how does it work.
I want to know how to do any format to ac3 output.
Could it be reached from command line?
Is ac3 output configurable (channels, hz, kbps, etc.)
Once the script is created, with which app i will obtain the final ac3 audio file?
TIA.

tebasuna51
2nd January 2006, 11:58
since we are using several chained instances of mixaudio, we need to process in a higher bit depth than 16 bit.
The Downmix DSP function's can be improved replacing the line 9 from file DownMix.extension:

c{2}=last

with:

c{2}=ConvertAudioToFloat(last)

All internal plugins used (GetChannel, MixAudio, Amplify and MergeChannels) support float format (also Normalize if you want use this DSP after the Downmix).

In a simple test the differences between the int16 and float methods are below 0.0001 (-80.76 dB)

Mr_Odwin
3rd January 2006, 15:22
ConvertAudioTo24bit() #or better float or 32bit
ConvertAudioTo16bit()

this should effectively reduce rounding errors.

A bit off topic I know, but what do those functions do? What is the difference between 16 bit, 24 bit, 32 bit and float? Is one 'more accurate' but more cpu-intensive? Google wouldn't tell me. :(

tebasuna51
8th January 2006, 14:30
BeHappy New Year!

I make some mod's to BeHappy and I have also a petition, all included in:
http://personal.telefonica.terra.es/web/burgosrosa/behappym.zip
Here is a brief description:

1) I don't know how generate UniqueID, then for new extension I copy the Downmix UniqueID and I make a little change. Works for me.

2) Downmix: Mod <AudioDSP> Append DPL I option and c{2}=ConvertAudioToFloat(last) in <ScriptPrologue>

3) SSRC: New <AudioDSP> multioption. The samplerate conversion utility.

4) Mono -> Stereo: New <AudioDSP> without comment.

5) TimeStretch: New <AudioDSP> Only to check this function with 'tempo' parameter and two common presets. Maybe we need a complex emergent window to select between the three parameters 'tempo', 'pitch' and 'rate' and their associate values (like Belight 'SoundTouch').
At last the most used 'tempo' need a capture box to put manualy exact values (a slider don't work). Maybe at 'Tweak' section?.

6) MPASource: New <AudioSource>: Tested this decoder plugin (avisynth.org) and work ok for mp3 and mp2 inputs.

7) ffmpeg MP2: New <AudioEncoder>: Tested ffmpeg like mp2 encoder.

8) TODO:
We can use avs input to emulate the BeSweet input .mux (6 mono wav like input), with this merge.avs:

m1 = WAVSource("D:\Test\Mono_FL.wav")
m2 = WAVSource("D:\Test\Mono_FR.wav")
m3 = WAVSource("D:\Test\Mono_C.wav")
m4 = WAVSource("D:\Test\Mono_LFE.wav")
m5 = WAVSource("D:\Test\Mono_SL.wav")
m6 = WAVSource("D:\Test\Mono_SR.wav")
MergeChannels(m1, m2, m3, m4, m5, m6)

But I don't know how split a multichannel wav in mono wavs with BeHappy.
Maybe Dimzon can include a new 'Destination' item 'Mono wavs Writer' inside BeHappy code, or anybody can make a 'decoder' with standar input support.
I think is easy to do, but out of my knowledge. I only can can write a simple standalone app to do this job with a multichannel wav file input, included (Wav2mono.zip) in behappym.zip.

I appreciate test and comment.

dimzon
10th January 2006, 11:35
BeHappy New Year!
I make some mod's to BeHappy and I have also a petition, all included in:
http://personal.telefonica.terra.es/web/burgosrosa/behappym.zip
Here is a brief description:

WOW, Thanx a lot!
Unfortunally I can't download it now :(


1) I don't know how generate UniqueID, then for new extension I copy the Downmix UniqueID and I make a little change. Works for me.

http://kruithof.xs4all.nl/uuid/uuidgen


7) ffmpeg MP2: New <AudioEncoder>: Tested ffmpeg like mp2 encoder.

Why ffmpeg and not tooLame? Does ffmpeg produce better quality?


or anybody can make a 'decoder' with standar input support.
I will write it a little later :)

tebasuna51
10th January 2006, 14:12
Thanks for the reply.
Why ffmpeg and not tooLame? Does ffmpeg produce better quality?
I don't know if there are quality differences, but TooLame don't work for me.
I tried TooLame v0.2k and v0.2l.

The unique partial success I get is with TooLame v0.2l and this parameters:
<ExecutableArguments>- "{0}"</ExecutableArguments>

Partial because:
- TooLame don't read the header and is treated as raw PCM, then there are a initial click and the data is treated as 44100 (default for TooLame)

- Insert a:
<UseRawPCM>true</UseRawPCM>
seems don't work for this kind of extension.

- Insert a parameter to override the default 44100 like:
<ExecutableArguments>-s 48000 - "{0}"</ExecutableArguments> or
<ExecutableArguments>- -s 48000 "{0}"</ExecutableArguments>
Produce a:
Error: Can't start encoder: Cannot process request because the process (1644) has exited.

- With TooLame v0.2k the parameters:
<ExecutableArguments>- "{0}"</ExecutableArguments>
work without errors but the encoded file is incorrect (a click and a short silence).

- Any other combination of parameters produce errors like:
Error: Abnormal encoder termination 1 OR
Error: Can't start encoder: Cannot process request because the process (596) has exited.

Maybe I don't found the correct method.

Prodater64
14th January 2006, 10:26
I asked a question on jan/2 http://forum.doom9.org/showthread.php?p=760695#post760695

Could somebody answer me, please.


I don't understand how does it work.
I want to know how to do any format to ac3 output.
Could it be reached from command line?
Is ac3 output configurable (channels, hz, kbps, etc.)
Once the script is created, with which app i will obtain the final ac3 audio file?
TIA.

tebasuna51
14th January 2006, 13:11
I don't understand how does it work.
Refer to original idea for a complete discussion:
http://forum.doom9.org/showthread.php?t=103069

Basically:
1) Open/Decode any audio source to obtain a uncompressed audio.
You can use a specific audio decoder plugin (NicAudio for dts/ac3, MpaSource for mp2/mp3) or the generic DirectShowSource then the adequate installed filter is used. If you have ffdshow installed you can use Audio decoder configuration facility.

2) Use any DSP or Tweak option to modify the uncompressed audio. Then you can: Delay, Split, Downmix, Resample (SSRC), Stretch, Amplify, Normalize, ...(the Upmix option don't work now).

3) Recompress the audio (or save as wav) with any of the tested encoders.

I want to know how to do any format to ac3 output.
1) Select the source and the appropriate decoder (or DirectShowSource).
2) Apply the desired DSP and/or Tweak options. (maybe nothing)
3) Select the output filename and ffmpeg ac3 encoder
4) Add to Job Control and run the job (in Job Control window)

Could it be reached from command line?
Then you need write the avs script (or use Export Avisynt Script from BeHappy), and use BePipe (see the related thread 'original idea')

Is ac3 output configurable (channels, hz, kbps, etc.)
The free encoder ffmpeg only accept, afaik, the bitrate parameter (like ac3enc with BeSweet). The channels and Hz are taken from the source (DownMix or Resample can modify this).

Once the script is created, with which app i will obtain the final ac3 audio file?
Add to Job Control and run the job (in Job Control window) and the ac3 is obtained.

tebasuna51
16th January 2006, 18:42
Tested TwoLAME 0.3.3 Release 2005-06-09, (The fork of the tooLAME project. ICL4.5), from http://www.rarewares.org/mp3.html

It work fine with BeHappy and is based in TooLAME 0.2mbeta, then can be used instead ffmpeg for mp2 encoder.

There are new version 0.3.4 and 0.3.5 (Last updated 29-Nov-2005) in http://www.twolame.org/ , but I don't found any Windows compiled exe.

Included in http://personal.telefonica.terra.es/web/burgosrosa/behappym.zip with other minor changes (interested see the readme inside the zip).

dimzon
16th January 2006, 18:47
Tested TwoLAME 0.3.3 Release 2005-06-09, (The fork of the tooLAME project. ICL4.5), from http://www.rarewares.org/mp3.html

It work fine with BeHappy and is based in TooLAME 0.2mbeta, then can be used instead ffmpeg for mp2 encoder.

There are new version 0.3.4 and 0.3.5 (Last updated 29-Nov-2005) in http://www.twolame.org/ , but I don't found any Windows compiled exe.

Included in http://personal.telefonica.terra.es/web/burgosrosa/behappym.zip with other minor changes (interested see the readme inside the zip).

can you reupload it to http://www.mytempdir.com

tebasuna51
16th January 2006, 18:55
@Dimzon
Upload bhappym.zip: http://www.mytempdir.com/388248

dimzon
16th January 2006, 19:05
@Dimzon
Upload bhappym.zip: http://www.mytempdir.com/388248

Ok, Thanx!
according documentation SSRC can't convert any samplerate to any another.
http://www.avisynth.org/SSRC

but You can use ResampleAudio http://www.avisynth.org/ResampleAudio

So I think better solution will be to write more intellectual function. It must check: does SSRC applicable to this samplerates and use ResampleAudio if not

tebasuna51
16th January 2006, 19:12
Also TimeStretch can do the job:
"Adjusting "Rate" is equivalent to using AssumeSampleRate and ResampleAudio, but at very high quality."

buttfacepoop
23rd January 2006, 07:16
great work dimzon. i switched over to behappy from besweet as encoding with nero 7's aac was becoming too difficult with besweet.

just one question - is it not possible to do 2-pass encoding with your tool because of the stdin input?

dimzon
23rd January 2006, 09:21
great work dimzon. i switched over to behappy from besweet as encoding with nero 7's aac was becoming too difficult with besweet.

just one question - is it not possible to do 2-pass encoding with your tool because of the stdin input?
Does you really need it? Can you post me link @ 2-pass audio encoder?

buttfacepoop
24th January 2006, 00:51
Does you really need it? Can you post me link @ 2-pass audio encoder?

sorry i mean normalizing.

dimzon
24th January 2006, 11:42
sorry i mean normalizing.
normalizing are possiible via AviSynth ( Normalize() )

NorthPole
29th January 2006, 01:02
Really liked the idea behind behappy and looking forward to the upmix option (if it is possible).

I had a question about the bepipe command line utility. Currently I am upmixing audio for recorded TV. I have been using fbr2k with a dsp plugin to convert and write the 6 channel wave. Then I was pluggin the wave into behappy to get the correct ac3 file. I tried to go directly from the mp2 to the ac3 in fb2k but can't because of the ac3 channel mapping problem. I had the idea of calling bepipe from fb2k to remap (i think its just frameserving) the audio and encode with ffmpeg.
To see if it could worked I tried to get bepipe working from the command prompt with the following command line:

BePipe.exe --script "WavSource(^incorrect.wav^) AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)),width=32,height=32,pixel_type=^RGB24^,fps=1000),last) 6==Audiochannels(last)?GetChannel(last,1,3,2,5,6,4):last AudioDubEx(Tone(),last)" | ffmpeg.exe -i - -y -acodec ac3 -ab 448 "correct.ac3" <incorrect.wav

No luck. runs fine but doesn't remap the channels. Any suggestions?

tebasuna51
29th January 2006, 03:28
I think Bepipe can't work from fb2k because you need the physical file "incorrect.wav" and can't be supplied by "< incorrect.wav".

Work ok with:
BePipe.exe --script "WavSource(^incorrect.wav^).GetChannel(1,3,2,5,6,4)" | ffmpeg.exe -i - -y -acodec ac3 -ab 448 "correct.ac3"

With your command line ffmpeg encode directly "incorrect.wav".

NorthPole
29th January 2006, 13:45
@tebasuna51

thanks for the reply.

I get a pipe error why I try your command line?

C:\Temp>BePipe.exe --script "WavSource(^incorrect.wav^).GetChannel(1,3,2,5,6,4)" | ffmpeg.exe -i - -y -acodec
ac3 -ab 448 "correct.ac3"
***************************************
BePipe by dimzon
***************************************
Script used:
# BEGIN
WavSource("incorrect.wav").GetChannel(1,3,2,5,6,4)
# END


ffmpeg version CVS, build 3277056, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-a52 --enable-gpl --enable-memalign-hack
built on Dec 8 2005 10:06:35, gcc: 3.4.2 (mingw-special)
Scanning for Audio Stream...
Found Audio Stream
Channels=6, BitsPerSample=16, SampleRate=48000Hz
Writing Header...
Writing Data...
0% pipe:: Error while opening file
Done!

Any ideas?
Tried 2 different builds of ffmpeg. The one above and the one from the ffmpeggui setup.

NorthPole
29th January 2006, 14:15
@tebasuna51

Runs ok when I use this command line but doesn't remap channels

C:\Temp>BePipe.exe --script "WavSource(^incorrect.wav^).GetChannel(1,3,2,5,6,4)" | ffmpeg.exe -i - -y -acodec
ac3 -ab 448 "correct.ac3" <incorrect.wav
ffmpeg version CVS, build 3277056, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-a52 --enable-gpl --enable-memalign-hack
built on Dec 8 2005 10:06:35, gcc: 3.4.2 (mingw-special)
Input #0, wav, from 'pipe:':
Duration: N/A, bitrate: 4608 kb/s
Stream #0.0: Audio: pcm_s16le, 48000 Hz, 5:1, 4608 kb/s
Output #0, ac3, to 'correct.ac3':
Stream #0.0: Audio: ac3, 48000 Hz, 5:1, 448 kb/s
Stream mapping:
Stream #0.0 -> #0.0
***************************************
BePipe by dimzon
***************************************
Script used:
# BEGIN
WavSource("incorrect.wav").GetChannel(1,3,2,5,6,4)
# END


Scanning for Audio Stream...
Found Audio Stream
Channels=6, BitsPerSample=16, SampleRate=48000Hz
Writing Header...
Writing Data...
size= 957kB time=17.5 bitrate= 448.0kbits/s s/s
video:0kB audio:957kB global headers:0kB muxing overhead 0.000000%
Done!

Note: input says it is coming from pipe?
Running winxp operating system.

NorthPole
29th January 2006, 14:24
Final Note:

The version of bepipe that I am using was download from the link on the first post. Datestamp on the file is 11/25/05 even though the date on the website says 12/09/05. File version 1.0.2155.27457.

I believe I have the latest and perhap the only released version of bepipe.

tebasuna51
30th January 2006, 04:08
I have same versions:
fmpeg version CVS, build 3277056
Last Bepipe version 1.0.2155.27457

Yesterday work ok, and now I get the same error:
0% pipe:: Error while opening file

I test:
BePipe.exe --script "WavSource(^incorrect.wav^).GetChannel(1,3,2,5,6,4)" > correct.wav

and work. Maybe is a sync issue betwen bepipe and ffmpeg.
Sorry, I can't help you, maybe Dimzon ...

About:
"Note: input says it is coming from pipe?"

The chars "< | >" are called 'pipe' commands, the input file for ffmpeg is taken from "< incorrect.wav" and not from bepipe output, then the channels aren't remapped.

damrod
30th January 2006, 11:56
nice tool !

i will give it a try...

btw with nero aac can you make abr encoding?? if you specify bitrate it's cbr and vbr is not abr... i want to make true abr@64 for exemple...can find the parameters in cmdline for aacenc32.exe (i use it to attack nero7 dlls)

is nero aac he-aac v2 or v1...the v2 is aac+ with SP i think (same quality @44 than he-aac@64..if i remember right)

NorthPole
30th January 2006, 14:43
@tebasuna51
BePipe.exe --script "WavSource(^incorrect.wav^).GetChannel(1,3,2,5,6,4)" > correct.wav

works ok for me too.

Thanks for your efforts. Maybe I'll give the upmix option a shot.

NorthPole
31st January 2006, 04:08
Ok, I modified the upmix extension with the following and got some 6 channel upmixes.

<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>{0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Upmix Using SuperEQ Files</Name>
<Value>
# SuperEq files with 20ms delay
fl_{2} = SuperEQ(Stereo_{2}.getleftchannel,"c:\program files\behappy\front.feq")
fr_{2} = SuperEQ(Stereo_{2}.getrightchannel,"c:\program files\behappy\front.feq")
cc_{2} = SuperEQ(Stereo_{2}.ConvertToMono,"c:\program files\behappy\center.feq")
lfe_{2} = SuperEQ(Stereo_{2}.ConvertToMono,"c:\program files\behappy\lfe.feq")
sl_{2} = SuperEQ(Stereo_{2}.getleftchannel,"c:\program files\behappy\back.feq")
sr_{2} = SuperEQ(Stereo_{2}.getrightchannel,"c:\program files\behappy\back.feq")
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Upmix using Sox Filter</Name>
<Value>
# Sox filter with 20ms delay
Front_{2} = mixaudio(Stereo_{2}.soxfilter("filter 0-600"),mixaudio(Stereo_{2}.soxfilter("filter 600-1200"),Stereo_{2}.soxfilter("filter 1200-7000"),0.45,0.25),0.50,1)
Back_{2} = mixaudio(Stereo_{2}.soxfilter("filter 0-600"),mixaudio(Stereo_{2}.soxfilter("filter 600-1200"),Stereo_{2}.soxfilter("filter 1200-7000"),0.35,0.15),0.40,1)
fl_{2} = GetLeftChannel(Front_{2})
fr_{2} = GetRightChannel(Front_{2})
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 65")
sl_{2} = GetLeftChannel(Back_{2})
sr_{2} = GetRightChannel(Back_{2})
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

This is a pretty basic approach.

If you want to use the supereq option (built into avisynth) you need to run fb2k and save a equalizer frequency file from the dsp manager, equalizer tab. I saved one for the front, center, lfe and back. I would upload them but I don't know how or where to do that. (This is similar to kpexs' upmix program method). Note that you need to change the reference in the above code to point to your appropiate .feq files.

If you use the sox filter mentioned earlier in this thread (I think its page 1, near the bottom) you can find a link to the sox avisynth beta plugin. You have to copy that to your avisynth plugin subdirectory. That it.

If anybody has better ideas for the sox settings, let me know. Thanks.

@tebasuna51,
A while back you asked about the reverb function/program/option. It is a soxs' filter option that you can access with the sox plugin.

dimzon
31st January 2006, 11:23
@NorthPole
Nice. Can you post your EQ-files too?

tebasuna51
31st January 2006, 13:56
I would upload them but I don't know how or where to do that.
The .feq files are plain text and very short. You can use Notepad to Copy and Paste in the post directly.
@tebasuna51,
A while back you asked about the reverb function/program/option. It is a soxs' filter option that you can access with the sox plugin.
Thanks, but I think is Dimzon who ask about reverb.

I don't know very much about upmix procedures. Maybe if ursamtl read this post can help with their expert opinion about upmix.

Now I'm working with compand function from Sox, trying to do a Dynamic Range Compression DSP function for BeHappy. If anybody work about this, let me know.

dimzon
31st January 2006, 13:59
Now I'm working with compand function from Sox, trying to do a Dynamic Range Compression DSP function for BeHappy.
Sounds great! Please, keep me informed. I'm working on MeGUI right now and have no time for BeHappy

NorthPole
31st January 2006, 14:42
@dimzon

here are the feq files that I used

Front.feq
-96
-96
-96
-4
-4
-4
-4
-4
-4
-4
-4
-4
-4
-4
-4
-96
-96
-96

center.feq
-96
-96
-96
-96
-96
-96
3
3
3
3
3
3
3
3
3
3
3
3

lfe.feq
0
0
0
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96

back.feq
-96
-96
-96
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-96
-96
-96

They are just text files that can be cut and pasted using notepad.
I didn't spend as much time on these as I did the sox filter because I thought the sox filter had better potential. However these do work fine. Both methods were geared toward more of a "surround sound" mix for dvd movies and recorded tv. I was trying to get the dialoge in the center channel and added a 20ms delay on the back channels.

dimzon
31st January 2006, 15:11
@NorthPole

sl_{2} = SuperEQ(Stereo_{2}.getleftchannel,"c:\program files\behappy\back.feq")
sr_{2} = SuperEQ(Stereo_{2}.getrightchannel,"c:\program files\behappy\back.feq")


Is'nt more efficient to use
temp{2} = SuperEQ(Stereo_{2}, "c:\program files\behappy\back.feq");
sl_{2} = temp{2}.getleftchannel()
sr_{2} = temp{2}.getrightchannel()

NorthPole
31st January 2006, 17:48
@dimzon

Yes, your code looks better, only one pass thru with the eq. then split.

2 comments on the sox method.

I think the lfe is either too loud or needs lower freq. setting. Currently at 65
for lowpass

May be more efficient to run sox mixaudio once on stereo source then split for left and right like it is currently but then instead of running sox filter again on stereo source for back channels, just reduce volume by a percentage from the front channels?

NorthPole
31st January 2006, 18:02
@dimzon

Is semicolon important at the end of you temp{2} line or is it a typo?

dimzon
31st January 2006, 18:56
@dimzon

Is semicolon important at the end of you temp{2} line or is it a typo?
typo ;)

NorthPole
31st January 2006, 19:06
@dimzon

I think the lfe is either too loud or needs lower freq. setting. Currently at 65
for lowpass


I think this is better

lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol 0.5")

NorthPole
31st January 2006, 19:20
May be more efficient to run sox mixaudio once on stereo source then split for left and right like it is currently but then instead of running sox filter again on stereo source for back channels, just reduce volume by a percentage from the front channels?

Tried to change volume and/or amplify front_{2} but doesn't work. Behappy terminated almost immediately. I think the sox filter crashes behappy in this situation.

dimzon
1st February 2006, 14:14
http://img64.imageshack.us/img64/7012/newpng5lg.png
new enc_aacplus.extension is avaluable @ BeHappy workspace

tebasuna51
2nd February 2006, 13:43
DynRanComp: New <AudioDSP> Dynamic Range Compression based in compand function from Sox.
Compression curves based in Anex C from Dolby Digital Professional Encoding Guidelines. There are a link for this document and graphs in:
http://forum.doom9.org/showthread.php?t=56020

This is a test release for discussion about the following problems:

1) The DSP function, outside the ac3 decoder, can't know the original ac3 Dialog Normalization and DRC method, then must be supplied by the user.
The DRC method can be selected in DSP configure, but the DialNorm can be set with:
- Another DSP multioption (31) to use before DynRanComp.
- With the 'Tweak' Amplify, but don't work with negative values (? to Dimzon).
- Editing DynRanComp.extension before run BeHappy. Method selected in this test release.

2) The Normalize() function don't work after Sox compand, maybe because:
"compand is very hard to control, and doesn't support restarts (crash)"
(in "Sox Audio Effect Filter for AviSynth" doc.)
Then maybe we need another set of 'normalized' curves to avoid the low volume problem.

3) The compand function don't work fine with segments 20:1.
For segment (-21,-21)-(0,-20) I obtain a output (-21,-21)-(0,-18)

4) The compand parameters (attack1,decay1,...,delay) may need optimization.

The DynRanComp.extension file is:
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="934f5ce0-9203-11da-a72b-0800200c9a66">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>DynRanComp - {0}</TitleFormatString>
<ScriptPrologue>
# Dialog Normalization. Amplify by: -31 -(DialNorm), 0 for DN=-31, -4 for DN=-27, -11 for DN=-20 ...
# AmplifydB(-4.0)
# Define transformation function
</ScriptPrologue>
<Option>
<Name>Film Standard</Name>
<Value>
# Film Standard. Segments: (Noise) +6dB 2:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-64,-43,-37,-31,-31,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Film Light</Name>
<Value>
# Film Light Segments: (Noise) +6dB 2:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-64,-53,-47,-41,-41,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Music Standard</Name>
<Value>
# Music Standard Segments: (Noise) +12dB 2:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-58,-55,-43,-31,-31,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Music Light</Name>
<Value>
# Music Light Segments: (Noise) +12dB 2:1 = 2:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-58,-65,-53,-41,-41,-21,-21,0,-11 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Speech</Name>
<Value>
# Speech Segments: (Noise) +15dB 5:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-55,-50,-35,-31,-31,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<ScriptEpilogue>
# Normalize recommended because volume is always less than -20 dB (except Music Light -11)
# Normalize() # But Normalize don't work after SoxFilter("compand...")
# SoxFilter work with 32 bit integer, and at last wav output is send 32 bit. Then maybe...:
# ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

dimzon
2nd February 2006, 13:54
@tebasuna51
Great!
Unfortunally I'm not DSP expert.
Why not to use Normalize() BEFORE Dynamic Range Compression?

tebasuna51
2nd February 2006, 15:54
Why not to use Normalize() BEFORE Dynamic Range Compression?
The decoder output (NicAudio) have the full dynamic range and can have samples with 0 dB, then the Normalize function do nothing with this signal.

We need, also, apply attenuation over the decoder output to compensate DialNorm (if distinct of -31 dB) for input correctly in DRC curves.

The solution is make alternate curves with normalized output. I'm work about this.

dimzon
2nd February 2006, 16:34
The decoder output (NicAudio) have the full dynamic range and can have samples with 0 dB, then the Normalize function do nothing with this signal.

Do not forget - we can use DRC on NON-AC3 input ;)

The solution is make alternate curves with normalized output. I'm work about this.
Yeah, it's the best

dimzon
2nd February 2006, 18:57
fresh beta is out

Dayvon
2nd February 2006, 19:34
2 All
Hi! You can help BeHappy project!
I need:
BeHappy logo & icons

I'd like to help with this Dimzon. You have any preferences or specifics in mind?

NorthPole
3rd February 2006, 04:34
Made some changes to the upmix extension I posted earlier...

Removed the option to use the avisynth equilizer because it is extremely slow in execution.

I added a second upix option that tries to remove most of the dialog from the left, right and surround speakers and sends it just to the center speaker.
Also, inverted the LFE, attenuated and delayed the surround speakers as before.

<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>{0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Upmix with equalizer adjustments</Name>
<Value>
# Sox filter using frequency selection, 20ms surround delay and attenuation
Front_{2} = mixaudio(Stereo_{2}.soxfilter("filter 0-600"),mixaudio(Stereo_{2}.soxfilter("filter 600-1200"),Stereo_{2}.soxfilter("filter 1200-7000"),0.45,0.25),0.50,1)
Back_{2} = mixaudio(Stereo_{2}.soxfilter("filter 0-600"),mixaudio(Stereo_{2}.soxfilter("filter 600-1200"),Stereo_{2}.soxfilter("filter 1200-7000"),0.35,0.15),0.40,1)
fl_{2} = GetLeftChannel(Front_{2})
fr_{2} = GetRightChannel(Front_{2})
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol -0.5")
sl_{2} = GetLeftChannel(Back_{2})
sr_{2} = GetRightChannel(Back_{2})
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Upmix with center channel dialog</Name>
<Value>
# channel subtraction with sox filter, 20ms surround delay and attenuation
left_{2} = stereo_{2}.GetLeftChannel()
right_{2} = stereo_{2}.GetRightChannel()
fl_{2} = mixaudio(left_{2}.soxfilter("filter 0-24000"),right_{2}.soxfilter("filter 0-24000"),0.6,-0.5)
fr_{2} = mixaudio(right_{2}.soxfilter("filter 0-24000"),left_{2}.soxfilter("filter 0-24000"),0.6,-0.5)
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol -0.5")
sl_{2} = mixaudio(left_{2}.soxfilter("filter 0-24000"),right_{2}.soxfilter("filter 0-24000"),0.5,-0.4)
sr_{2} = mixaudio(right_{2}.soxfilter("filter 0-24000"),left_{2}.soxfilter("filter 0-24000"),0.5,-0.4)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

@tebasuna51

Nice dynamic range compression extension. I agree that it would be nice to be able to use negative values in tweak.

@Dimzon

I tried this code but it executed extremely slowly

left_{2} = last.GetLeftChannel()
right_{2} = last.GetRightChannel()
fl_{2} = mixaudio(left_{2},right_{2},0.6,-0.5)
fr_{2} = mixaudio(right_{2},left_{2},0.6,-0.5)
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol -0.5")
sl_{2} = mixaudio(left_{2},right_{2},0.5,-0.4)
sr_{2} = mixaudio(right_{2},left_{2},0.5,-0.4)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)

dimzon
3rd February 2006, 11:07
I'd like to help with this Dimzon. You have any preferences or specifics in mind?
Just make it eyecandy ;)

Dayvon
3rd February 2006, 16:39
Just make it eyecandy ;)

Is this creative liberty you've given me? :D :devil:

dimzon
3rd February 2006, 16:45
Is this creative liberty you've given me? :D :devil:
Yes.
By the way - since BeHappy is avisynth based software maybe we can use portion of avisynth logo in it (just proposal, feel free not to do it)

Dayvon
3rd February 2006, 17:12
Yes.
By the way - since BeHappy is avisynth based software maybe we can use portion of avisynth logo in it (just proposal, feel free not to do it)

I'll look into it! :cool:

tebasuna51
4th February 2006, 12:59
@Dimzon
I get incorrect wav output (BlockAlign incorrect) with your last release (and also incorrect aac encodes).

Maybe there are a bug in Encoder.cs (now there are 2 writeHeader routines)

CORRECT:
private void writeHeader(Stream target ) {
...
target.Write(BitConverter.GetBytes(m_wavHeader.nBlockAlign),0,2);
target.Write(BitConverter.GetBytes(m_wavHeader.wBitsPerSample),0,2);
...
}

INCORRECT:
private void writeHeader(Stream target, AviSynthClip x ) {
...
target.Write(BitConverter.GetBytes(x.BitsPerSample/8),0,2); // ?????
target.Write(BitConverter.GetBytes(x.BitsPerSample),0,2);
...
}
BUG: BlockAlign = ChannelsCount * BitsPerSample/8

TheBashar
4th February 2006, 22:07
Can someone please give me a sanity check with this scheme? I like to cut out the opening and ending credits of my TV series encodes with something like Trim(90,6000)+Trim(9000,61000) for the video. Cutting, merging, and muxing the audio is ehh okay, but I've always struggled with some synch issues.

I'd like to try avisynth processing via BeHappy to see if I can use the same Trim statements to manipulate the audio as I do with the video so maybe I can avoid or eliminate the synch issues.

I set up BeHappy to do an ac3 -> aac conversion and exported the avs to look at. I was wondering if this would work.


audio = DirectShowSource("audio.ac3")
audio = EnsureVBRMP3Sync(audio)
# Above same as BeHappy Generated:
video = MPEG2Source("video.d2v")
AudioDeubEx(video, audio)
# Use same trim arguments as in video encoding script:
Trim(90,6000)+Trim(9000,61000)
AudioDubEx(Tone(), last)
# Below same as BeHappy Generated:
AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)), width=320,height=32,pixel_type="RGB24",fps=1000), last)
Normalize...
Encode...
Kill Video again...

So in essence I'd bring in the audio, apply the vbrsynch black magic, dub it to the actual video clip, trim with the video trim settings, kill the real video, dub it to the 1000 fps blank video, normalize, encode, and kill the blank video.

Is this a sane way to go about this task?

Thanks!

tebasuna51
5th February 2006, 01:37
You don't need:

AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)), width=320,height=32,pixel_type="RGB24",fps=1000), last)
...
Kill Video again...

Because this AudioDubEx sentence is only to use Trim in ms. (fps=1000), and Trim is used before based in video fps.

If you want maintain the ac3 without re-encode there are other method to trim the audio with DelayCut:

You want a first segment like this: Trim(90,6000)
If fps is 25 (replace 25 with your appropriate fps) you want a segment between 90/25 = 3.6 sec and 6000/25 = 240 sec. Then open DelayCut and Cut your original ac3 between Start = 3600 and End = 240000 ms.

For the second segment Cut between 360000 ms (9000/25 sec) and 2440000 ms. (61000/25 sec).

After join the two segments with:

> copy /B first.ac3 + second.ac3 full.ac3

dimzon
6th February 2006, 11:56
BUG: BlockAlign = ChannelsCount * BitsPerSample/8
Are you 100% shure? (this will affect MeGUI too)

tebasuna51
6th February 2006, 13:06
Are you 100% shure? (this will affect MeGUI too)
With this kind of wavheader (PCM 16 or 32 bits int) always:

BlockAlign = ChannelsCount * BitsPerSample/8

dimzon
6th February 2006, 13:09
With this kind of wavheader (PCM 16 or 32 bits int) always:

BlockAlign = ChannelsCount * BitsPerSample/8
Thanx a lot, will be fixed soon

dimzon
6th February 2006, 14:34
http://forum.doom9.org/showthread.php?t=83752 - additional info about 5.1 upmix

3dsnar
7th February 2006, 15:27
Hi Dimzon. I have prepared the pseudosurround DLL for ya :D

I cannot attach it to this post, cause it is to big.
Please drop me an email: programmers AT aud-x.com
and I will reply and send you the attachement.

(ie. the DLL, and the complete project. Maybe it will be useful)

After downloading, please let me know, and I will remove it.
I will be happy to answer all your questions (if you have any).

shon3i
7th February 2006, 15:33
@Dimzon how to boost 6ch audio aac like hibridgain in besweet or autogk with mp3 ,with behappy

grokwik
14th February 2006, 00:11
Dimzon, thanks a lot for this awsome tool !
I can now transcode audio from multiple avi quickly. Every thing works fine.
I have noticed that nero aac encode works with or without neroipp.dll without any difference. Is this dll really necessary ?

dimzon
14th February 2006, 12:23
I have noticed that nero aac encode works with or without neroipp.dll without any difference. Is this dll really necessary ?
It's really necessary if you does not have Nero installed

JoeBG
14th February 2006, 19:44
I cant get work
- upmix (is it still not supportet) (invalid arguments to function "SuperEq"
- normalize (nothing happens)

Do I need some special software packages?

tebasuna51
14th February 2006, 20:05
- Upmix is in experimental stage by NorthPole, and need Sox Audio Effect Filter ( http://forum.doom9.org/showthread.php?t=104792 ), see the post:
http://forum.doom9.org/showpost.php?p=779538&postcount=66

- Normalize works fine (amplify the signal until the required level).

JoeBG
14th February 2006, 20:50
- Upmix is in experimental stage by NorthPole, and need Sox Audio Effect Filter ( http://forum.doom9.org/showthread.php?t=104792 ), see the post:
http://forum.doom9.org/showpost.php?p=779538&postcount=66

Works fine now, many thanks ;)



- Normalize works fine (amplify the signal until the required level).

What means "amplify the signal until the rquired level

I told the tool to normalize to 100 %. Is this not ok?

tebasuna51
15th February 2006, 01:23
What means "amplify the signal until the rquired level
I told the tool to normalize to 100 %. Is this not ok?
I say "required level" only because you can select other value than 100% with the Configure button.

But, is true, the Normalize() function don't work after the upmix because do a second pass (the first to know the max value) to amplify the sound. And some Sox filters doesn't support restarts (crash), like say the documentation.

I have the same problem with the Dynamic Range Compession function and the compand Sox filter.

NorthPole
16th February 2006, 01:43
Well here is the latest revision on the upmix extension

<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>5.1 Upmix - {0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Audio with mostly dialog (ie. Comedy, Drama)</Name>
<Value>
# Profile to use with audio sources that has mostly mono content. 20ms delay and -2db attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.794,-0.794)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.794,-0.794)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.224,0.224)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.562")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.631,-0.631)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.631,-0.631)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Audio with a mix of sounds (ie. Action, Adventure)</Name>
<Value>
# Profile to use with audio sources that more range of sound content. 20ms delay and -2db attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.398,0.398)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.447")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

changes are as follows:
- removed the frequency adjustment option because the quality was not very good.
- optimized sox filter usage to speed up execution.
- created 2 different sound profiles to use on different types of audio.

Notes on Usage:
1. You need to have the avisynth sox filter in the avisynth plugin subdirectory. See tebasuna51s' post above for the link.
2. Normalize you audio before upmix.
3. Choose a profile to upmix with from the 5.1 upmix config button.

If after upmixing, you can't hear the center channel dialog because the L & R channels are drowning it out, then try the other profile.
Also, you can add your own profile or change the above ones as needed.

@dimzon

Small feature request...

When you add a file to convert, the name of the destination file is shown as the same as the input file (excluding the dot extension) which is good. But when you add a 2nd file to convert, the destination file name doesn't change (it remains the same as the first). Therefore, you have to type in the destination file name.

Not a big deal if its a problem to change... I hope I explained that clearly enough?

iceborne
16th February 2006, 03:03
does downmixing dts to DLP II wav really work in behappy? wanted to know cause i like to trancode DLP II wav to itunes's aac format.

could you also clarify between DPL II and DPL II(lfe)?
which one is equivalent to "-azid( -s dplii -c normal -L -3db )"?

tebasuna51
16th February 2006, 17:53
DPL II is equal to "-azid( -s dplii )" (copied matrix).
DPL II(lfe) equivalent to "-azid( -s dplii -L -3db )".
The "-azid( -c normal )" switch is for Dynamic Range Compression not yet implemented in BeHappy (problem with compand Sox Filter and Normalice see: http://forum.doom9.org/showpost.php?p=779165&postcount=60 ).

If you have ffdshow like default directshow filter to play dts files you can use DirectShow input instead NicDtsSource, and use ffdshow Audio Decoder Configuration to set:
- Codecs -> Dtd - libdts, Dynamic range compression (Checked)
- Mixer -> Dolby Prologic II, LFE (Unchecked)
-Output -> Output sample - only checked 16 bit integer, Don't use WAVEFORMATEXTENSIBLE ...(Checked)

This is equivalent to "-azid( -s dplii -c normal -L -3db )". After use the Normalice DSP function in BeHappy and select your desired encoder.

I test this method with ac3 source, I hope works also with dts.

Edit: I make a test with dts source:
- Same volume output with NicDtsSource and with ffdshow (drc checked and drc unchecked) (?).
- The output length with NicDtsSource is 2:06.688 (like input) and with ffdshow is cut at 1:50.851 (?)

iceborne
16th February 2006, 23:39
from this thread
http://forum.doom9.org/showthread.php?s=&threadid=27936

"Pro Logic II with LFE (Not recommended by Dolby)"

... so i shouldn't even be using "-azid( -s dplii -L -3db )" anyways, correct?


For downmix you ever have to use DRC because more acoustic power will be concentrated in less channels!
what is frank trying to say? not use dynamic range or to use dynamic range on downmix?

tebasuna51
17th February 2006, 01:55
See also http://forum.doom9.org/showthread.php?t=57988 with the definitive matrix used in azid 1.9 and in DPL II in BeHappy.

... so i shouldn't even be using "-azid( -s dplii -L -3db )" anyways, correct?
From "214_Mixing with Dolby Pro Logic II Technology.pdf" :
"There are other concerns when adding an LFE signal to the mix. If the LFE is simply redistributed within the other channels of the mix, they will usually be subject to some low-frequency bandpass filtering. This filtering causes phase shifts of the LFE signal. When they are acoustically added within a room, these phase shifts are fairly subtle and often go unnoticed. However, when they are electronically added together with the five main channels in the encoder, they may produce less than desirable results at certain frequencies. For this reason, it is recommended that the LFE signal not be used in a Dolby Pro Logic II downmix unless it contains unique information that is not repeated in any of the five main channels."
Is your choice, possible artifacts/lose unique info (my choice is don't include LFE).
"For downmix you ever have to use DRC because more acoustic power will be concentrated in less channels!"
what is frank trying to say? not use dynamic range or to use dynamic range on downmix?
I think not use DRC. But isn't my opinion.

You must use DRC to decrease the original signal Dynamic Range if:
1) The source have a wide Dynamic Range (dialogs at -30 dB and explosions at 0 dB).
2) You have a bad/normal audio equipment without support for this wide range (noise with dialogs or explosions distorted) or you don't want disturb the neighbors.
3) You want reencode to a format without support for DRC in play time (mp3, aac, ...)

The DRC is independent and must be do before any downmix.

JoeBG
17th February 2006, 13:04
Hi,

upmix to 5.1 aac works great now for me. :) Many thanks.

What not works is AC3. Do I need any special plugins? ffmpeg or something like this? Can someone give a small HowTo? Thanks :)

dimzon
17th February 2006, 13:21
Hi,

upmix to 5.1 aac works great now for me. :) Many thanks.

What not works is AC3. Do I need any special plugins? ffmpeg or something like this? Can someone give a small HowTo? Thanks :)
You must place ffmpeg.exe into BeHappy folder
Warning! Some ffmpeg versions has buggy stdin support - such versions doesn't work with BeHappy. This version works fine:
ffmpeg version CVS, build 3211776, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-theora --enable-mp3lame --enable-libogg --enable-vorbis --enable-faad --e
nable-faac --enable-xvid --enable-x264 --enable-mingw32 --enable-a52 --enable-dts --enable-pp --enab
le-gpl --enable-memalign-hack --enable-amr_nb --enable-amr_wb
built on Sep 9 2005 04:00:51, gcc: 3.4.4 (mingw special)

NorthPole
18th February 2006, 02:29
I found some additional information on upmix profiles from a couple of other threads

http://forum.doom9.org/showthread.php?p=442997#post442997

http://forum.doom9.org/showthread.php?p=558760#post558760

So I added them to the upmix extension:

<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>5.1 Upmix - {0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Audio with mostly dialog (ie. Comedy, Drama)</Name>
<Value>
# Profile to use with audio sources that have mostly mono content. 20ms delay and -3db attenuation on surround
# Note: the center channel is very weak for this profile
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.794,-0.794)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.794,-0.794)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.224,0.224)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.596")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.562,-0.562)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.562,-0.562)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Audio with a mix of sounds (ie. Action, Adventure)</Name>
<Value>
# Profile to use with audio sources that have a wider range of sound content. 20ms delay and -3db attenuation on surround
# Note: General purpose profile
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.398,0.398)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.447")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.473,-0.473)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.473,-0.473)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Gerzen Profile</Name>
<Value>
# Gerzen approach Profile modified with 20ms delay and some attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.885,-0.115)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.885,-0.115)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.4511,0.4511)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Farina Profile</Name>
<Value>
# Farina/Sursound approach Profile M=L+R, S=L-R, c=0.75, L' = (1-c/4)*M+(1+c/4)*S, C' = c*M, R' = (1-c/4)*M-(1+c/4)*S
# also added with 20ms delay and some attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,1.1875)
fr_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,-1.1875)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.375,0.375)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Multisonic Profile</Name>
<Value>
# Multisonic approach Profile modified with 20ms delay and some attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),1,-0.5)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),1,-0.5)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.5,0.5)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Sound On Sound Profile</Name>
<Value>
# SOS approach Profile with 20ms delay and some attenuation on surround
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = stereo_{2}.GetLeftChannel()
fr_{2} = stereo_{2}.GetRightChannel()
cc_{2} = mixaudio(stereo_{2}.GetRightChannel(),stereo_{2}.GetLeftChannel,0.5,0.5)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

JoeBG
18th February 2006, 05:13
@ dimzon

I took the one from 15.02.2006 from celtic druid, works very good

@ northpole

I´ll try it immediatly

NorthPole
19th February 2006, 00:59
Sorry about so many revision on this upmix extension...

This pretty much finishes what I have been able to come up with so here it is

<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>5.1 Upmix - {0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
stereo_{2} = convertaudiotofloat(last)
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
</ScriptPrologue>
<Option>
<Name>Balanced Center Channel Profile</Name>
<Value>
# Balanced approach L' = (L-R)*0.668 R' = (R-L)*0.668 C' = (L-L')*0.398 + (R-R')*0.398
# Profile for general purposes to use with audio sources that have a wide range of sound content
# Attempts to balance sound levels of L', R' and C' with common mono content in center only
# 20ms delay and -2db attenuation on surround SL' = (L-R)*0.531 SR' = (R-L)*0.531
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.398,0.398)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.500")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Decreased Center Channel Profile</Name>
<Value>
# Decreased center approach L' = (L-R)*0.668 R' = (R-L)*0.668 C' = (L-L')*0.224 + (R-R')*0.224
# Profile to use for older movies or videos with mostly mono content.
# Same as balanced approach but with significally reduces C' power
# 20ms delay and -2db attenuation on surround SL' = (L-R)*0.531 SR' = (R-L)*0.531
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.224,0.224)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.596")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Increased Center Channel Profile</Name>
<Value>
# Increased center approach L' = (L-R)*0.596 R' = (R-L)*0.596 C' = (L-L')*0.473 + (R-R')*0.473
# Profile to use with audio sources where quieter dialog or lots of loud sound effects.
# Same as balanced approach but with slightly higher C' power and slightly lower L' and R' power
# 20ms delay and -2db attenuation on surround SL' = (L-R)*0.473 SR' = (R-L)*0.473
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.596,-0.596)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.596,-0.596)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.473,0.473)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.473")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.473,-0.473).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.473,-0.473).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Gerzen Profile</Name>
<Value>
# Gerzen approach L' = (0.885*L)-(0.115*R) C' = (L+R)*0.4511 R' = (0.885*R)-(0.115*L)
# Modified by adding 20ms delay and some attenuation on surround SL' = (L-R)*0.531 SR' = (R-L)*0.531
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.885,-0.115)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.885,-0.115)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.4511,0.4511)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Farina Profile</Name>
<Value>
# Farina/Sursound approach M=L+R, S=L-R, c=0.75, L' = (1-c/4)*M+(1+c/4)*S, C' = c*M, R' = (1-c/4)*M-(1+c/4)*S
# Modified by adding 20ms delay and some attenuation on surround SL' = (L-R)*0.562 SR' = (R-L)*0.562
fl_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,1.1875)
fr_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,-1.1875)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.375,0.375)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.562,-0.562).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.562,-0.562).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Multisonic Profile</Name>
<Value>
# Multisonic approach L' = L-(0.5*R) C' = (L+R)*0.5 R' = R-(0.5*L)
# Reduced above formula by 10% to eliminate potential clipping on L' and R'
# Modified by adding 20ms delay and some attenuation on surround SL' = (L-R)*0.596 SR' = (R-L)*0.596
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.9,-0.45)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.9,-0.45)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.45,0.45)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.596,-0.596).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.596,-0.596).DelayAudio(0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>

Changes:
- Tweaked most of the surround levels to try and match the particular profile.
- Nuked the sound on sound profile (the last one) because it was just the alot of same sound from the L, R & C (not much channel or dialog separation).
- Changed the names on the first 2 profiles to better explain what they are trying to do.
- Added another profile to increase the center channel levels.
- Added some notes, etc.

Thanks again dimzon for this slick audio convertion tool.

dimzon
19th February 2006, 12:40
@NorthPole
Thanx for Your investigations.
I just wrote a tool, but You and tebasuna51 fill it life

By the way - future of BeHappy
I'm really waitng when MeGUI refacoring done. Probably BeHappy will be assimilated by MeGUI completly (currently it share same code but MeGUI has subset of BeHappy functionality)

JoeBG
19th February 2006, 19:54
@NorthPole
Thanx for Your investigations.
I just wrote a tool, but You and tebasuna51 fill it life

By the way - future of BeHappy
I'm really waitng when MeGUI refacoring done. Probably BeHappy will be assimilated by MeGUI completly (currently it share same code but MeGUI has subset of BeHappy functionality)

Please leave it as a standalone tool :)

dimzon
19th February 2006, 20:29
Please leave it as a standalone tool :)
Why? Why does not combine them with MeGUI (preserving BeHappy functionality/flexibility)

JoeBG
20th February 2006, 20:08
Why? Why does not combine them with MeGUI (preserving BeHappy functionality/flexibility)

OK, this makes sense. :) I just want to be able to use it without MeGUI for quick encoding decisions.

dimzon
1st March 2006, 14:45
The solution is make alternate curves with normalized output. I'm work about this.
Hi! Any progress with it?

tebasuna51
1st March 2006, 17:50
No progress. I make many test, but there are unpredictable peaks in sudden volume changes and are clipped with normaliced curves.

After a DRC film standard (with a theoretic max output -20 dB) is sure amplify +10 dB, but some sources go to 0 dB and others remains at -10 dB or less.

For ac3 decode, this problem (Normalize don't work after a DRC based in Sox filter), and don't now Dialog Normalization and DRC recommended in ac3 stream, make unusable this function.

If we need DRC decoding ac3 we can use ffdshow (with DirectShowSource). The output is equivalent to BeSweet-azid settings: -azid( -n1 -c normal)
After we can use Normalize without problems.

dimzon
1st March 2006, 17:52
@tebasuna51
brrr... seems like i realy misunderstood... maybe i need to read theoretical materials?
or i need step-by step explanation in easy english

tebasuna51
1st March 2006, 18:10
brrr... seems like i realy misunderstood... maybe i need to read theoretical materials?
or i need step-by step explanation in easy english
About peak problems or about correct method to apply DRC?

dimzon
1st March 2006, 18:15
About peak problems or about correct method to apply DRC?
About DRC itself. Sorry, I'm really far from DSP, and I even have very superfictial knowledge what is dB itself... I'm very confused, sorry..
Can you comment this post: http://forum.doom9.org/showthread.php?p=792680#post792680

tebasuna51
1st March 2006, 19:15
Can you comment this post: http://forum.doom9.org/showthread.php?p=792680#post792680
Yes is something like this. But:
"This transformation will increase volume for low-volume samples and keep volume untoched for hi-value samples."
is not exact, can be:
Low-volume increased, certain mid-range untouched and hi-volume decreased.

The Dolby defined curves are these. (http://pages.sbcglobal.net/wilsondr/ddcompprof.gif)

These curves are implemented in my initial post and can be used. But there are problems:

- The mid-range untouched is defined by Dialog Normalization in ac3 header:
the input audio (x-axis) must be attenuated before by 31 - (DialNorm) dB. For instance if DialNorm = -27 dB we need apply a Amplify(-4 dB) before use the appropriate curve.

- We don't know the appropriate curve. In ac3 stream each audio block have the needed amplify (+ or -) or don´t have nothing because this audio stream don't need DRC (option None in encoder).

- The theoretic max output is -20 dB (10% maxint, music & film standard), too low for standard audio equipments. And Normalize don't work after compand Sox function.

My first attempt to do "normalized" curves is similar to your curve: 100% (0 dB) input -> 100% output, "untouched for hi-value samples". Then I get another problem: "unpredictable peaks in sudden volume changes are clipped with normaliced curves".

To explain this problem a need a image. Maybe in other post.

dimzon
1st March 2006, 19:24
Yes is something like this. But:
"This transformation will increase volume for low-volume samples and keep volume untoched for hi-value samples."
is not exact, can be:
Low-volume increased, certain mid-range untouched and hi-volume decreased.

The Dolby defined curves are these. (http://pages.sbcglobal.net/wilsondr/ddcompprof.gif)

Hmm. Shifting this curves up we will transfer from "Low-volume increased, certain mid-range untouched and hi-volume decreased." to "Low-volume increased more, certain mid-range increased less and hi-volume untouched"...


These curves are implemented in my initial post with and can be used. But there are problems:

- The mid-range untouched is defined by Dialog Normalization in ac3 header:
the input audio (x-axis) must be attenuated before by 31 - (DialNorm) dB. For instance if DialNorm = -27 dB we need apply a Amplify(-4 dB) before use the appropriate curve.

- We don't know the appropriate curve. In ac3 stream each audio block have the needed amplify (+ or -) or don´t have nothing because this audio stream don't need DRC (option None in encoder).

- The theoretic max output is -20 dB (10% maxint, music & film standard), too low for standard audio equipments. And Normalize don't work after compand Sox function.

Brrr... Does I understand you right - you need actual mid-range magic value from AC3 header bcz this is not actual middle sound value == Int16.MaxValue/2 for Normalized audio but some another value?


To explain this problem a need a image. Maybe in other post.
Yes, picture, please!!!

dimzon
1st March 2006, 19:37
- The theoretic max output is -20 dB (10% maxint, music & film standard), too low for standard audio equipments. And Normalize don't work after compand Sox function.
Just one stupid question. Dosn't theoretic max output is -20 dB become actual max output is -20 dB when we using normalized audio as input? In this case (predictable max output) we doesn't need normalize AFTER, we must just Amplify to transfer actual max output is -20 dB to good value (i doesn't know wich value is equal to maxint for 16bit audio)

tebasuna51
1st March 2006, 20:18
Brrr... Does I understand you right - you need actual mid-range magic value from AC3 header bcz this is not actual middle sound value == Int16.MaxValue/2 for Normalized audio but some another value?
You can see in the picture. The mid-range is the linear part (1:1) in the curve and we need know DialNorm to apply the linear part to dialog values.

Imagine you have the dialog at -10 dB and apply the curve directly (20:1 near horizontal line), then the dialog are distorted. If you apply before -21 dB the dialog go to linear part and is not distorted (output at -31 dB).

Well, I don't like this obsolete Dolby system based in normalize the audio dialog at -31 dB, but ... work so.
The goal is maintain constant the volume across any source, but don't work because cheap audio equipment don't support this wide dynamic range and other sources (mp3, CD Audio, commercials in TV, ...) works with narrow dynamic range near the 0 dB.

tebasuna51
1st March 2006, 20:22
Just one stupid question. Dosn't theoretic max output is -20 dB become actual max output is -20 dB when we using normalized audio as input? In this case (predictable max output) we doesn't need normalize AFTER, we must just Amplify to transfer actual max output is -20 dB to good value (i doesn't know wich value is equal to maxint for 16bit audio)
I say:

"After a DRC film standard (with a theoretic max output -20 dB) is sure amplify +10 dB, but some sources go to 0 dB and others remains at -10 dB or less."

This is the peaks problem, be patient.:)

dimzon
1st March 2006, 21:30
After a DRC film standard (with a theoretic max output -20 dB) is sure amplify +10 dB, but some sources go to 0 dB and others remains at -10 dB or less.
Does it mean

Normalize()
DrcFilmStandard()


can go to 0 dB

tebasuna51
2nd March 2006, 02:26
"After amplify +10 dB"

For instance, my test_channels.ac3 (only voice) after
Normalize()
DrcFilmStandard()
Amplify(10 dB)

go to 0 dB (can't accept further amplify without clipping)

dimzon
2nd March 2006, 08:05
@tebasuna51
ok, i realize the problem, seems like i need to perform modification of NicAc3Source in order to implement build-in DRC control...
Shit, I hate C/C++ and I have not enought knowledge about AC3...
Will You help me with theory/math ?

Edit: Will try to asc Nic first: http://forum.doom9.org/showthread.php?t=108066

tebasuna51
2nd March 2006, 13:48
ok, i realize the problem, seems like i need to perform modification of NicAc3Source in order to implement build-in DRC control...
I think this is the correct way.

Maybe is easy modify NicAudio.dll:

From a52dec-0.7.4/doc/liba52.txt
Dynamic range compression
-------------------------

void a52_dynrng (a52_state_t * state,
sample_t (* call) (sample_t, void *), void * data);

This function is purely optional. If you dont call it, liba52 will
provide the default behaviour, which is to apply the full dynamic
range compression as specified in the A/52 stream. This basically
makes the loud sounds softer, and the soft sounds louder, so you can
more easily listen to the stream in a noisy environment without
disturbing anyone.

If you do call this function and set a NULL callback, this will
totally disable the dynamic range compression and provide a playback
more adapted to a movie theater or a listening room.

If you call this function and specify a callback function, this
callback might be called up to once for each block, with two
arguments: the compression factor 'c' recommended by the bitstream,
and the private data pointer you specified in a52_dynrng(). The
callback will then return the amount of compression to actually use -
typically pow(c,x) where x is somewhere between 0 and 1. More
elaborate compression functions might want to use a different value
for 'x' depending wether c>1 or c<1 - or even something more complex
if this is what you want.

From NicAudio/m2_audio_ac3.cpp
bool m2AudioAC3Source::DecodeFrame() {
...
// Dynamic range compression
a52_dynrng(State, 0, 0);
AFAIK NicAudio cancel the default Dynamic range compression from liba52.
For test pourpose, only if you comment the a52_dynrng line and compile NicAudio.dll, I can test if default DRC from liba52 works ok.

After we can add a new parameter to NicAc3Source call, like DRC true/false and use:
if (!DRC) { a52_dynrng(State, 0, 0) };

dimzon
2nd March 2006, 14:10
try http://www.mytempdir.com/487451

dimzon
2nd March 2006, 14:41
btw
now I have perfect sample how to write AviSynth input audio plugins... Maybe I can join yet another MPASource into nicaudio and even add somethig like faadSource ;)

tebasuna51
2nd March 2006, 16:40
try http://www.mytempdir.com/487451
Work!

Wait for complete test ...

dimzon
2nd March 2006, 16:59
btw
there are
// Dynamic range compression
dts_dynrng(State, 0, 0);

in m2audio_dts.cpp

what does you know about DRC for DTS ?

tebasuna51
2nd March 2006, 17:56
what does you know about DRC for DTS ?
Sorry, I don't know DTS format.

First test with new NicAc3Source: the DRC info in ac3 stream is applied, now work exactly like BeSweet -azid( -c normal )

Seems OK.

dimzon
2nd March 2006, 19:23
Sorry, I don't know DTS format.
Ok

First test with new NicAc3Source: the DRC info in ac3 stream is applied, now work exactly like BeSweet -azid( -c normal )

Seems OK.
Very well. Any idea how to implement other DRC modes?

tebasuna51
2nd March 2006, 21:26
Very well. Any idea how to implement other DRC modes?
AFAIK liba52 only apply the attenuation found in ac3 stream, don't have any algorithm to do DRC, remember (previous post):
"If you call this function and specify a callback function, this callback might be called up to once for each block, with two arguments ..."

But I think is not necesary, now work like ffdshow, Cyberlink PowerDVD 6, ...

dimzon
2nd March 2006, 22:20
But I think is not necesary, now work like ffdshow, Cyberlink PowerDVD 6, ...
I really want to cover all besweet functionality. Seems like I must write some custom callback to realize additional DRC modes. Can You help me to write it (i need math and valid coefficients)

Talking about DRC in DTS, maybe it's possible to use same function in it? Does You have DTS samples for testing (i have not)

dimzon
3rd March 2006, 12:06
http://forum.doom9.org/showthread.php?p=793573#post793573

tebasuna51
3rd March 2006, 13:08
I really want to cover all besweet functionality.
Nice. The most important for me is accept any kind of wav input and split in mono waves (to send after to good ac3 encoders).
Maybe also cover WaveWizard functionality accepting wav > 4GB and WAV_FORMAT_EXTENSIBLE headers.

Seems like I must write some custom callback to realize additional DRC modes. Can You help me to write it (i need math and valid coefficients)
I think you need not easy algorithms. Just I learn a few with Compand Sox function and there are involved parameters like attack, dekay, delay, ... and I don't understand very much how work. See this image (http://www.mytempdir.com/489584)

I think is not a priority, with your new NicAudio.dll is enough for MeGUI.

About NicAc3Source I detect a bug decoding 5.0 (without LFE) ac3 streams. Make a wav 6 channels (with LFE empty) but wrong mapping C_SL_FR_FL_SR_LFE, need Getchannels(4,3,1,6,2,5).

Talking about DRC in DTS, maybe it's possible to use same function in it? Does You have DTS samples for testing (i have not)
I have a swedish test channel but decoded with NicAudio, foobar, Tranzcode or ffdshow (with errorrs) is always the same. Maybe don't have DRC (optional in DTS, like in Ac3).
I can't test DTS because I don't own a DTS encoder. Maybe other user can test your new NicAudio.dll.

tebasuna51
3rd March 2006, 14:23
I still have problems with BeHappy new version.

Using like input this Test1.avs (3 stereo wav's to wav 6 channels)
flfr = WavSource("g:\Test_FL_FR1.wav")
fl = GetChannel(flfr, 1)
fr = GetChannel(flfr, 2)
clfe = WavSource("g:\Test_C_LFE1.wav")
c = GetChannel(clfe, 1)
lfe = GetChannel(clfe, 2)
slsr = WavSource("g:\Test_SL_SR1.wav")
sl = GetChannel(slsr, 1)
sr = GetChannel(slsr, 2)
MergeChannels(fl, fr, c, lfe, sl, sr)

With BeHappy v0.1.0.30756 (20051229) work fine, but with BeHappy v0.1.0.28107 (20060206) don't work, I get:
Starting job Test1.avs->Test.wav
Found Audio Stream
Channels=6, BitsPerSample=16, SampleRate=48000Hz
Writing RIFF header to encoder's StdIn
Writing PCM data to encoder's StdIn
Error: BeHappy.AviSynthException: AudioStreamSource
at BeHappy.Encoder.encode()

Please, if you need make a new BeHappy version for include NicAudio options, and is easy to modify:
- Don't include EnsureVBRMP3Sync(), or make it optional with a checkbox in Tweak section.
- Don't include the two AudioDubEx() if the checkbox Split is not marked.
- Accept negative values in Amplify.

Thanks.

dimzon
3rd March 2006, 15:16
Maybe also cover WaveWizard functionality accepting wav > 4GB and WAV_FORMAT_EXTENSIBLE headers.
Isn't possible to accept such files just using DirectShowSource instead WavSource?

split in mono waves (to send after to good ac3 encoders).
I'm planning to perform some reverse-engineering of Dolby AC3 encoder Dll's in order to write my own CLI frontend for it (acceptable to encode 6ch WAV directly) but I plan to do it much more later...


I think you need not easy algorithms. Just I learn a few with Compand Sox function and there are involved parameters like attack, dekay, delay, ... and I don't understand very much how work. See this image (http://www.mytempdir.com/489584)
I'm just talking about standart DRC in addition to normal: Neavy/Normal/Light/Inverse


About NicAc3Source I detect a bug decoding 5.0 (without LFE) ac3 streams. Make a wav 6 channels (with LFE empty) but wrong mapping C_SL_FR_FL_SR_LFE, need Getchannels(4,3,1,6,2,5).
Seems like I found bug:
case A52_3F2R:
LFE = Flags && A52_LFE;
DecFlags = A52_3F2R;
if (LFE)
DecFlags |= A52_LFE;
ChannelCount = 6;
break;

In this case LFE variable is always = true.
Replaced to
LFE = 0!=(Flags &A52_LFE);
Same for DTS, try this binary: http://www.mytempdir.com/489796

I still have problems with BeHappy new version.
I have found same problem just 3 days ago. Unfortunally I can't say nothing about it except it's internal AviSynth problem (exeption is thrown by AviSynth) and it will occured sometimes (not every time). Try to open yor avs script using Import, not WavSource...


Please, if you need make a new BeHappy version for include NicAudio options, and is easy to modify:
- Don't include EnsureVBRMP3Sync(), or make it optional with a checkbox in Tweak section.
- Don't include the two AudioDubEx() if the checkbox Split is not marked.
- Accept negative values in Amplify.

All Your suggestions will be implemented in next build BUT I'm not planning to release new BeHappy version during at least next 2 weeks, sorry...

dimzon
3rd March 2006, 16:47
Sorry, I don't know DTS format.

The DTS Coherent Acoustics standard (ETSI 102 114 v1.2.1), as published by the ETSI, is available here (http://pda.etsi.org/pda/queryform.asp) (search for DTS Coherent Acoustics)

tebasuna51
5th March 2006, 05:00
The DTS Coherent Acoustics standard (ETSI 102 114 v1.2.1), as published by the ETSI, is available here (http://pda.etsi.org/pda/queryform.asp)[/COLOR][/B])
After read this I check my test.dts and is encoded without DRC.

Then if anybody want do the test before a new BeHappy version support this issue, can create a new file in BeHappy folder:

NicAudioDRC.extension
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioSource Name="NicAc3SourceDRC" UniqueID="79c27720-ab72-11da-a746-0800200c9a66">
<Script>NicAc3Source("{0}", DRC=1)</Script>
<SupportedFileExtension>ac3</SupportedFileExtension>
</AudioSource>
<AudioSource Name="NicDtsSourceDRC" UniqueID="880150e0-ab72-11da-a746-0800200c9a66">
<Script>NicDtsSource("{0}", DRC=1)</Script>
<SupportedFileExtension>dts</SupportedFileExtension>
</AudioSource>
</BeHappy.Extension>
With this there are two new input source methods:
NicAc3SourceDRC
NicDtsSourceDRC

The ac3 method work fine, and the bug with ac3 5.0 is also corrected.

Isn't possible to accept such files just using DirectShowSource instead WavSource?
Yes, configuring ffdshow Audio Decoder -> Codecs -> WAV -> All supported, I can open wav 32bit float, WAVE_FORMAT_EXTENSIBLE, ... (still not tested > 4 GB).
Is not a easy way, because I need uncheck other functions used for play and after do the conversion recheck them, but work.

I have found same problem just 3 days ago. Unfortunally I can't say nothing about it except it's internal AviSynth problem (exeption is thrown by AviSynth) and it will occured sometimes (not every time). Try to open yor avs script using Import, not WavSource...
Yes sometimes work. If you think the problem is solved using Import maybe we need a new source method:

AvsSource.extension
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioSource Name="AvsSource" UniqueID="0aa78710-aafd-11da-a746-0800200c9a66">
<Script>Import("{0}")</Script>
<SupportedFileExtension>avs</SupportedFileExtension>
</AudioSource>
</BeHappy.Extension>
and disable .avs like extension for WavSource.

I'm planning to perform some reverse-engineering of Dolby AC3 encoder Dll's in order to write my own CLI frontend for it (acceptable to encode 6ch WAV directly) but I plan to do it much more later...
Great notice. We need a good free ac3 encoder better than ffmpeg, ac3enc, ...

But split in mono wavs is also needed for other reasons and I think is really easy to do, don't forget this please.

And at last, but not the last, thanks for accept my suggestions for new BeHappy release.

dimzon
5th March 2006, 10:31
@tebasuna51
does you tested new binary (5.0 issue)?

scharfis_brain
5th March 2006, 10:58
Without having read the whole thread: is nicaudio capable of putting out more than 16bit audio sampling precision?

tebasuna51
5th March 2006, 11:22
does you tested new binary (5.0 issue)?
Yes:
"The ac3 method work fine, and the bug with ac3 5.0 is also corrected."

tebasuna51
5th March 2006, 11:38
Without having read the whole thread: is nicaudio capable of putting out more than 16bit audio sampling precision?
Ac3 is a old codec and, AFAIK, internal precision is not greater than 16 bit, you can convert the output to any precision for further conversions.

scharfis_brain
5th March 2006, 12:29
internal precision 'may' be only 16bit, but due to the internal dynamic range control of AC3 (in German it is "Hüllkurve") you won't loose precision in silent scenes when decoding to 24bit.

Also you may decode every psycoacoustic coding to arbitary bit depths because of its frequency nature. Of couse this precision is faked a bit, but it is much better than going from 16bit to 24 (or higher) bit after decoding.

dimzon
5th March 2006, 14:08
Yes:
"The ac3 method work fine, and the bug with ac3 5.0 is also corrected."
Oh sorry, thanx a lot for testing. Does it mean I can do new stable release of NicAudio?

Talking about AC3 compression - I have not plans to do it right now but can you tell me wich AC3 encoder does You prefer?

tebasuna51
5th March 2006, 14:44
Does it mean I can do new stable release of NicAudio?
Yes for me. Maybe any dts test, but seems dts_dynrng work like the equivalent ac3.

Talking about AC3 compression - I have not plans to do it right now but can you tell me wich AC3 encoder does You prefer?
About free encoders you can see: http://forum.doom9.org/showthread.php?p=759503#post759503

- DarkAvenger (HeadAC3he) seems solve the low volume issue (50%) in their ac3enc.dll.

- DRC info must be generated in ac3 stream.

- Others parameters: DialNorm, MixLevels, ... must be user defined.

With non-free encoders, I only test the old and slow Sonic Foundry SoftEncode.

dimzon
7th March 2006, 14:45
@tebasuna51
FYI
fresh NicAudio http://forum.doom9.org/showthread.php?t=108112
fresh BassAudio http://forum.doom9.org/showthread.php?t=108254

Can You play with / test BassAudio ?

NorthPole
7th March 2006, 15:12
@tebasuna51

I read your post in this thread http://forum.doom9.org/showthread.php?p=759503#post759503

Thanks for the work...very interesting. What program did you use to test the ac3 output levels?

Did you use wavewizard with the dark avenger ac3enc.dll or were you using the headAC3he frontend?

tebasuna51
7th March 2006, 18:54
What program did you use to test the ac3 output levels?
We need decode to wav the ac3 stream with BeHappy-NicAudio or BeSweet-Azid without DRC, ota-normalize, downmix,...
After any wav editor Audacity, Goldwave, Audition...

Did you use wavewizard with the dark avenger ac3enc.dll or were you using the headAC3he frontend?
The HeadAC3he frontend is needed because have the Gain parameter. The ac3enc.dll from HeadAC3he don't work with WaveWizard, but the used is supplied for Dark Avenger to Johnman.

AFAIK the problem is how send this Gain parameter to ac3enc.dll, because is applied internally.

NorthPole
8th March 2006, 01:19
@tebasuna51

Thanks for the reply. Sorry about the off thread topic. I have been doing the same as you. Decoding to wave and checking the levels with cooledit. I have been using ffmpeg from http://celticdruid.no-ip.com/xvid/

@Dimzon or maybe @Dayvon

The new logo looks good.

I'll try the bassAudio decoder and let you know if I have any problems.

tebasuna51
10th March 2006, 03:16
BASSAUDIO TEST

Seems work ok with mp2, mp3, ogg, wma and stereo aac (LC, HE and PS)
Also work with ac3 5.1 (without DRC), 6 channel ogg and wma.
And with wav stereo and multichannel int16, int32, float32 with canonical or WAVE_EXTENSIBLE_FORMAT headers.

Now is not necesary DirectShowSource for wav, wma, ogg or stereo aac files.

PROBLEMS

With ac3 2.0 make a wav 6 channels R_e_e_L_e_e (e=empty channel).

With aac 5.1 sometimes make a wav6 with all channels equal to a distorted Center channel, and sometimes:
Starting job Test6.aac->Test6.wav
Found Audio Stream
Channels=6, BitsPerSample=16, SampleRate=48000Hz
Writing RIFF header to encoder's StdIn
Writing PCM data to encoder's StdIn
Error: System.NullReferenceException: Object reference not set to an instance of an object.
at BeHappy.AviSynthClip.dimzon_avs_getaframe(IntPtr avs, IntPtr buf, Int64 sampleNo, Int64 sampleCount)
at BeHappy.Encoder.encode()

or

Error: System.NullReferenceException: Object reference not set to an instance of an object.
at BeHappy.AviSynthClip.dimzon_avs_destroy(IntPtr& avs)
at BeHappy.AviSynthClip.System.IDisposable.Dispose()
at BeHappy.Encoder.encode()

dimzon
10th March 2006, 08:33
PROBLEMS

With ac3 2.0 make a wav 6 channels R_e_e_L_e_e (e=empty channel).

With aac 5.1 sometimes make a wav6 with all channels equal to a distorted Center channel...

Hm. Thanx a lot, seems like this is BASS problem



and sometimes
How often does this bug reproducable. Does it only for 5.1 AAC decoding via bassAudio?

dimzon
10th March 2006, 12:01
With aac 5.1 sometimes make a wav6 with all channels equal to a distorted Center channel, and sometimes
Can you provide small samples to send it to BASS developers?

dimzon
10th March 2006, 13:25
I'm planning to write AudioLimiter plugin

output = tahh(input*factor) / tanh(factor)

http://img64.imageshack.us/img64/3035/tmp1141993187p629f25xl.gif
factor = 1
factor = 1.5
factor = 2
factor = 3
factor = 4


Does anybody know another sutable formulas?

dimzon
10th March 2006, 15:31
Yet another filter to play with / test - AudioLimiter
http://forum.doom9.org/showthread.php?t=108470

tebasuna51
10th March 2006, 16:45
Can you provide small samples to send it to BASS developers?
Here is: Test6HE.7z (http://www.mytempdir.com/506506)
The source Test6HE.aac is decoded ok by Foobar v0.8.3 for instance.

dimzon
10th March 2006, 17:53
Here is: Test6HE.7z (http://www.mytempdir.com/506506)
The source Test6HE.aac is decoded ok by Foobar v0.8.3 for instance.
please test this binary with your AAC
http://www.un4seen.com/filez/2/bass_aac.dll

tebasuna51
10th March 2006, 23:08
please test this binary with your AAC
http://www.un4seen.com/filez/2/bass_aac.dll
Sorry, same output.
Works for you?

gino25
11th March 2006, 14:39
i try to transcode a file wav (44100 hz, mono) into a aac+ 16kbps.

In [1] i select my wav file as "Wavsource", in [2] and [3] all are empty. In [4] i select aac+ 16kbps as adts aac

but i have this error

Starting job bri.wav->bri.aac
Error: BeHappy.AviSynthException: Script error: there is no function named "AudioDubEx"
at BeHappy.AviSynthClip..ctor(String func, String arg, AviSynthColorspace forceColorspace, AviSynthScriptEnvironment env)
at BeHappy.Encoder.encode()

gino25
11th March 2006, 14:39
ah this is the avc generated by behappy

########################################
#Created by BeHappy v0.1.0.28107
#Creation timestamp: 11/03/2006 14.39.50
########################################
#Source FileName:C:\Documents and Settings\Enea\Desktop\bri.wav
#Target FileName:C:\Documents and Settings\Enea\Desktop\bri.aac
########################################

########################################
# [Source: WavSource]
########################################
WavSource("C:\Documents and Settings\Enea\Desktop\bri.wav")

EnsureVBRMP3Sync() # Some black magic to avoid desync

########################################
# [BeHappy: Create fictive 1000fps video for triming]
########################################
AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)), width=32, height=32, pixel_type="RGB24", fps=1000), last)

########################################
# [Encoder: Coding Technologies AAC+ @ 16 kbps as ADTS AAC]
########################################


########################################
# [BeHappy: Kill video]
########################################
AudioDubEx(Tone(), last)

dimzon
11th March 2006, 15:09
@gino25
instal AviSynth 2.56

gino25
12th March 2006, 17:38
@gino25
instal AviSynth 2.56

thank you

3dsnar
14th March 2006, 07:26
I'm planning to write AudioLimiter plugin

output = tahh(input*factor) / tanh(factor)

http://img64.imageshack.us/img64/3035/tmp1141993187p629f25xl.gif
factor = 1
factor = 1.5
factor = 2
factor = 3
factor = 4


Does anybody know another sutable formulas?
Dimzon, I will send you a code for a limiter constructed from a sine glued with a linear section. It also has a limiting
knee that can be adjusted. Morover, this always limits to [-1, 1] range and up to some signal level is linear (no harmonic distortion).

dimzon
15th March 2006, 15:49
@tebasuna51
Please, test my AudioLimiter filter http://forum.doom9.org/showthread.php?t=108470

What does You think, does it acceptable to use it for DRC?

tebasuna51
16th March 2006, 03:52
@tebasuna51
Please, test my AudioLimiter filter http://forum.doom9.org/showthread.php?t=108470

What does You think, does it acceptable to use it for DRC?
I'm not a expert in DRC, but I think if DRC algorithms use parameters like attack and dekay is for good reasons.

A instant volume conversión with simple math formulas produce distort output like you can see in this image. (http://www.mytempdir.com/519521)

With a frequency analysis you can see the audible overtones, not present using more sophisticated algorithms:
Frequency Analysis. (http://www.mytempdir.com/519529)

For me the DRC is only useful with ac3 or dts sources, and this work ok with your modified NicAaudio.dll. For others uses the compand Sox function still work better than this AudioLimiters.

3dsnar
16th March 2006, 07:08
I'm not a expert in DRC, but I think if DRC algorithms use parameters like attack and dekay is for good reasons.

A instant volume conversión with simple math formulas produce distort output like you can see in this image. (http://www.mytempdir.com/519521)

With a frequency analysis you can see the audible overtones, not present using more sophisticated algorithms:
Frequency Analysis. (http://www.mytempdir.com/519529)

For me the DRC is only useful with ac3 or dts sources, and this work ok with your modified NicAaudio.dll. For others uses the compand Sox function still work better than this AudioLimiters.
Tebasune51 is right. The limiter (or also called soft clipper) is usually used to make the hard clipping effect more listenable. It is a useful tool, so it is good to have it. It also can be viewed as the simplest form of compressor.
---------------------------
However, for compressing the amplitude of the signal, usually a dynamic compressor is used (with the attack phase, release phase, compression ratio, and other parameters).
---------------------------
Dimzon, I have implemented in the past a very high quality (very low harmonic distortions) compressor for some pro-audio applications, and the code belongs to me (personally). I will have to just clean it a bit and will provide you with it. So you will be able to use it as open source, or in whaterver way you prefer. So I will get back with this to you soon.

dimzon
16th March 2006, 09:31
@3dsnar
Thanx a lot

@3dsnar, @tebasuna51
http://en.wikipedia.org/wiki/Amplitude_compression
I'm just trying to reproduce BeSweet's custom boost modes (LigH/Tera/DSPGuru) - there are no attac/decay parameters for it, seems like they are just limiters. Custom boost modes + additional AC3 DRC is last to cover all BeSweet functionality...

tebasuna51
16th March 2006, 17:38
I'm just trying to reproduce BeSweet's custom boost modes (LigH/Tera/DSPGuru) - there are no attac/decay parameters for it, seems like they are just limiters. Custom boost modes + additional AC3 DRC is last to cover all BeSweet functionality...
Really I never use the Boost BeLight section. I make some test with default values in BeLight:
- DSPguru method -boost( /b2=4 /l=0.95 ): Broken for input values > -7.16 dB. Don't need emulate.
- Tera method -boost( /b3=5 /l=0.95 ): low range values very amplified. Not similar behavior with your AudioLimiter functions.
- LigH method -boost( /b=3 /l=0.95 ): This method can be emulated with ExpotencialLimiter(2.4) with light differences.
All values are peak (-) dB

Met\Input 46.6 40.8 36.0 31.2 26.4 21.6 16.8 12.0 10.45 7.2 2.40
--------- ---- ---- ---- ---- ---- ---- ---- ---- ----- ---- -----
Tera_norm 30.3 25.6 21.1 16.8 12.7 9.1 6.0 3.5 2.85 1.7 0.45
LigH_norm 37.3 31.2 26.4 21.6 16.9 12.2 7.7 3.9 2.85 1.2 0.14
Expot 2.4 37.6 32.6 27.5 22.2 16.8 11.4 6.7 3.2 2.44 1.2 0.24
Expot 2.0 39.0 34.1 29.1 23.9 18.6 13.4 8.5 4.6 3.60 1.9 0.43
Expot 3.0 35.6 30.5 25.3 19.9 14.3 8.9 4.6 1.9 1.33 0.6 0.10

dimzon
16th March 2006, 17:58
@tebasuna51
Thanx a lot

Does anybody know good free math-modeling software (free MathLab analogue)?

dimzon
16th March 2006, 18:02
found very interesting site
http://musicdsp.org/

dimzon
16th March 2006, 18:18
Yet another fine link http://www.dspguru.com/sw/opendsp/mathclo2.htm

dimzon
16th March 2006, 18:29
fine, found some free matlab replacement
http://www.scilab.org/

will try it tonight

dimzon
17th March 2006, 00:17
Ok, second name for this Effect is Wavesharper
There are big amount of such formulas
http://musicdsp.org/archive.php?classid=4#207
http://www.google.com/search?lr=&ie=UTF-8&oe=UTF-8&q=Waveshaper

and finally found good approximation
http://img217.imageshack.us/img217/1803/testnew6pc.png
yellow is tera
pink is .55 * Math.Atan(6*x)

sasam
18th March 2006, 12:17
Hi dimzon,
That's a nice logo for behappy you have, looking like Google...
What do you think about this:
http://img112.imageshack.us/img112/6431/behappy4nd.png

tebasuna51
18th March 2006, 12:21
About new Bass_ac3.dll (http://www.maresweb.de/forums/index.php?showtopic=98#)
I don't know if you need make some modification to use with BeHappy, but a simple dll replace produce this wav output:

- Ac3 2.0: ok now
- Ac3 5.0: wrong channelmapping C_SL_FR_FL_SR_e (empty)
- Ac3 5.1: same wrong channelmapping C_SL_FR_FL_SR_e (empty), LFE missing.

I know bass_ac3 is not necessary for BeHappy (you have NicAudio), but bass_aac is really interesting and I hope maresweb developers can help us.

dimzon
23rd March 2006, 11:43
BeHappy in TOP 5 @ GotDontNet !

http://www.gotdotnet.com/workspaces/directory.aspx

http://img67.imageshack.us/img67/7726/bh0pz.th.png (http://img67.imageshack.us/img67/7726/bh0pz.png)

Congratulations :cool: :cool: :cool:

shon3i
23rd March 2006, 12:02
Congratulations to you dimzon and rockaria for very good app

3dsnar
23rd March 2006, 12:15
Congrats!!
Keep up the good work!

mxms
25th March 2006, 03:51
My appologies, I'm new to this thing but here is what I'm trying to do.

I have a 5.1 AAC file I converted to WAVE in 6 channels. I'm now trying to use BeHappy to conver from WAVE - AC3. Which when I try I get:


Starting job Track2.wav->Track2.ac3
Found Audio Stream
Channels=6, BitsPerSample=16, SampleRate=48000Hz
ffmpeg.exe -i - -y -acodec ac3 -ab 448 "C:\Documents and Settings\Nick\Desktop\ergo2\Track2.ac3"
Error: System.ApplicationException: Can't start encoder: The system cannot find the file specified ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()


What does it mean "The system cannot find the file specified ---> System.ComponentModel.Win32Exception" and how do I fix it?

What do I need to get this working properly?

tebasuna51
25th March 2006, 10:31
Maybe you need the encoder
ffmpeg (http://kurtnoise.free.fr/ffmpeg.7z)
uncompressed in BeHappy folder.

dimzon
29th March 2006, 10:06
future plans

Hi!
Since BeHappy is experimental application I decide to perform some experiments.
I'm planning to perform complete GUI redesign using Inductive UI paradigm (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/iuiguidelines.asp)
I'm planning to use HTMLayout (http://www.terrainformatica.com/htmlayout/) to create multilanguage skinable UI
I'm planning to use TIScript (http://www.terrainformatica.com/tiscript/) (JavaScript-like) to provide ability to create more complex and flexible extensions

dimzon
29th March 2006, 15:53
Ok, new GUI layout prototype is here
http://www.mytempdir.com/553286

please, post your comments and suggestions

sasam
29th March 2006, 16:25
It looks nice, but there is nothing wrong the old one. This one looks like some newbie "1click encoder".
In the old one we can see all in one screen and in the new one we have to click on the task to open it.

New users would probably love the new interface but I don't know about experienced...;)

3dsnar
29th March 2006, 16:38
I like it.
Very good for new users indeed.
Experienced users know already how to use it,
so it should not discourage them to continue using this app.

dimzon
29th March 2006, 16:43
New users would probably love the new interface but I don't know about experienced...;)
As I said before I'm planning to make BeHappy skinable - there will be special skin wich will look & feel mostly like current BeHappy

Unfortunally I'm not a designer so I need feedback & suggestions.

Please, post here Your ideas, draft design and sketches - everything are welcome ;)

Let's create ultimate easy-to-use interface together.

sasam
29th March 2006, 17:32
Here is a fast sketch I made... What do you think?

http://img149.imageshack.us/img149/6679/behappy0aa.png

dimzon
29th March 2006, 17:36
Here is a fast sketch I made... What do you think?

http://img149.imageshack.us/img149/6679/behappy0aa.png

Thanx for participation.
Unfortunally Queue is too narrow - there are many columns in Queue list. I believe we must make Queue 100% width...
And do not forget - we need some place for progress bar and log...

sasam
29th March 2006, 17:50
Maybe you could put expand button or something:) :

http://img138.imageshack.us/img138/802/behappy2qs.th.png (http://img138.imageshack.us/my.php?image=behappy2qs.png)

Users don't have to see all columns...(Only when they click expand button) As you said it is supposed to be for easy using. ;)

dimzon
29th March 2006, 17:53
Maybe you could put expand button or something:) :

http://img138.imageshack.us/img138/802/behappy2qs.th.png (http://img138.imageshack.us/my.php?image=behappy2qs.png)

Hmmm... Looks better.
So let's wait a little, maybe somebody provide another sketches...

dimzon
29th March 2006, 18:19
Just addition - current BeHappy implementation opens Decoder/DSP/Encoder configuration in modal dialog
In new UI layout I want to place it @ main form to avoid ModalDialogs

dimzon
29th March 2006, 18:57
Queue
http://img225.imageshack.us/img225/738/11115ce.th.png (http://img225.imageshack.us/my.php?image=11115ce.png)

stax76
29th March 2006, 19:39
How about a side bar like in so many MS UIs (e.g. 'Windows Movie Maker'), this gives you much more room.

AW-
31st March 2006, 21:18
Hello
I was wondering if BeHappy - AviSynth-based audio transcoding tool would help me with this problem.
I had made a backup of one of my Music Dvd's and I must have chose 6ch or dts and my brother cracked the original dvd taking it out of the case it came in, So the origanal is broke (cheap plastic) now i would like to encode the dts back to normal if i can, so i can play it without a digital reciever.
Thanks

NorthPole
2nd April 2006, 02:33
Hmmm... Looks better.
So let's wait a little, maybe somebody provide another sketches...

If you're looking for input, microsoft has a conversion utility included in some versions of xp. It is a 4 step process consisting of the following images:

step 1-

http://img216.imageshack.us/my.php?image=step10iu.png

step 2-

http://img90.imageshack.us/my.php?image=step23jc.png

step 3-

http://img118.imageshack.us/my.php?image=step37af.png

step 4-

http://img90.imageshack.us/my.php?image=step41ji.png

Just another option for you... Although I do like the current format better because it is a little less "newbie" like sasam said.

dimzon
2nd April 2006, 10:22
@NorthPole
Thanx, looking good for newbie

Mr_Odwin
5th April 2006, 10:34
Having looked at the downmixing that BeHappy does for 5.1 to stereo I have a question.

fl = GetChannel(a, 1)
fr = GetChannel(a, 2)
c = GetChannel(a, 3)
lfe = GetChannel(a, 4)
sl = GetChannel(a, 5)
sr = GetChannel(a, 6)
l_sl = MixAudio(fl, sl, 0.2929, 0.2929)
c_lfe = MixAudio(lfe, c, 0.2071, 0.2071)
r_sr = MixAudio(fr, sr, 0.2929, 0.2929)
l = MixAudio(l_sl, c_lfe, 1.0, 1.0)
r = MixAudio(r_sr, c_lfe, 1.0, 1.0)
return MergeChannels(l, r)

I have a 5.1 ac3 file and according to the Avisynth documentation (http://www.avisynth.org/GetChannel) the front center channel should be channel 2, but this doesn't seem to be the case and the above BeHappy generated code seems to be right. (If I do downmixing using the channel mapping from the documentation I get no dialogue in the resulting right stereo channel.)

Why is this?

dimzon
5th April 2006, 11:03
I have a 5.1 ac3 file and according to the Avisynth documentation (http://www.avisynth.org/GetChannel) the front center channel should be channel 2, but this doesn't seem to be the case and the above BeHappy generated code seems to be right. (If I do downmixing using the channel mapping from the documentation I get no dialogue in the resulting right stereo channel.)

Why is this?

Seems like NicAc3Source has build-in channel mapper wich map output to WAV 5.1 channel order
And any DirectShow decoder (by definition) must perform same mapping too

Actually I believe every valid multichannel decoder must provide WAV 5.1 channel order

Mr_Odwin
5th April 2006, 11:31
Cool. But it then seems a little redundant to mention other channel mappings in the documentation. Odd.
You've answered my question though.:thanks:

dimzon
5th April 2006, 13:59
Cool. But it then seems a little redundant to mention other channel mappings in the documentation. Odd.
You've answered my question though.:thanks:

Anycase You must look @ concrete decoder documentation (what channel mapping does it produce) rather this abstract documentation

thuongshoo
11th April 2006, 05:39
hi ! I want to use winamp encoder and but this encoder can't make a HC file , how can I do ?
I used Nero7WA but error , Perhaps I don't have nero7WA.exe .I searched it by google.com but I have no result . Where do I download it ?
Thanks !

chros
14th April 2006, 21:55
Ok, new GUI layout prototype is here
http://www.mytempdir.com/553286

please, post your comments and suggestions

I don't like the concept of these guis. (But this shouldn't put you out of concei :) ) . It's so Microsoft-ish ... which is (I think): the user shouldn't know how the app is working (of course it's not relying to you). The user must clicking so much to achive the result. (And these guis take time away from the developer !!!)
I prefer your app that way it was: simple, it stand in full view (!).

And last: if you remember the first public release of MPC, Gabest said: "feature: - no skin support" !!! :)

Keep up the good work !

thuongshoo
15th April 2006, 18:08
Behappy say that "... can not configure bsn ! .."
I don't know !. Belight still works well with bsn.dll which Behappy can't .
Can you give me your good bsn.dll ? thank you !
me email : yuyoonshoo@gmail.com

shon3i
15th April 2006, 18:50
You don't need to copy bsn.dll to behappy folder, than Aac.dll aacenc32.dll from belight or nero comon files folder.

thuongshoo
26th April 2006, 03:53
Thank shon3i ! :D
Can Nero encoder make a He-llc- file ?
http://img125.imageshack.us/img125/2651/aache0wx.th.png (http://img125.imageshack.us/my.php?image=aache0wx.png)

dimzon
26th April 2006, 14:31
Thank shon3i ! :D
Can Nero encoder make a He-llc- file ?
http://img125.imageshack.us/img125/2651/aache0wx.th.png (http://img125.imageshack.us/my.php?image=aache0wxpng)
This is mediaInfo bug, use Foobar0.9 instead

thuongshoo
28th April 2006, 12:58
I installed Foobar but What must I do ?
Foobar can't open my wav file. It is a wav file which made by VD. Foobar can't also display properties of media file
Gspot also says like MediaInfo ..

dimzon
5th May 2006, 11:14
BeHappy extension to support this (http://forum.doom9.org/showthread.php?p=823788&posted=1#post823788)perfect cli encoder is uploaded @ BeHappy Workspace @ gotDotNet (http://gotdotnet.com/Workspaces/Workspace.aspx?id=1bb59ddf-901b-43a5-bd54-b0999e8e223e)

shon3i
5th May 2006, 11:24
dimzon what about 2pass and other options like choosing betwen LC,HE,HEv2.

dimzon
5th May 2006, 11:52
dimzon what about 2pass and other options like choosing betwen LC,HE,HEv2.
for 2pass I need additional featiures (http://forum.doom9.org/showthread.php?p=823740#post823740) in Nero binary
other options working in automatic implicit mode, I will add explicit options much later (it reques some coding for me and I'm too busy IRL now)

dimzon
5th May 2006, 12:11
2 ALL
I'm planing to release fresh BeHappy beta in this month.
No new GUI yet (I'm too busy to do it) but new .NET Runtime (2.0) + some fixes/improvements

Future plans

Disable .avs like extension for WavSource
Separate source for .avs files (via Import)
Make EnsureVBRMP3Sync optional with a checkbox in Tweak section
Don't include the two AudioDubEx() if the checkbox Split is not marked
Move Amplify from Tweak section to DSP section, accept negative values in Amplify, allow to switch between AmplifyDB and Amplify
Multipupose multi-option Source to allow tweaks in sources (NicAc3Source/NicDtsSource w/wo DRC)
ND AAC encoder - completly new & flexible configuration dialog (+removing old Nero7 AAC one based on AAC.DLL)
OggVorbis encoder - additional controls in configuration dialog for advanced settings
CT AAC encoder - completly new & flexible configuration dialog
Collect fresh 3rd-party extentions
Create All-in-One bundle including BeHappy+Extensions+Encoders ( oggenc, ffmpeg, faac, enc_aacplus {w/o winamp dll itself}, wavpack, flac, twolame, lame)+Filters (NicAudio,SoX)


If You need some fix/improvement please let me know ASAP!

tebasuna51
5th May 2006, 13:42
Nice!.
Really I don't need new GUI, I prefer all of your "Future plans" before, and:

Don't forget BassAudio, is very useful to decode ogg, wma, stereo aac, and any kind of wav's. Now, for habitual formats, only aac 5.1 need DirectShowSource.

In order to reproduce all important (for me) BeSweet's features, remember my old petition to split multichannel wav's in mono wav's.

Thanks!

dimzon
6th May 2006, 01:48
New ND AAC dialog in action
http://img522.imageshack.us/img522/5394/untitled4dp2.jpg

Kostarum Rex Persia
6th May 2006, 02:24
Very very nice, Dimzon.

Can you give me download link to newest BeHappy beta with this new ND AAC dialog? Direct link, if possible.

Thank you.

tebasuna51
6th May 2006, 02:48
To avoid the problem for wav's > 4GB and neroAacEnc
http://forum.doom9.org/showthread.php?p=823985#post823985

"I check wav's > 4GB with any value in DataLength and +36 in RiffLength and always work with neroAacEnc -ignorelength, then the problem is use same value for the two fields.

For BeHappy the solution is fill DataLength with 0xFFFFFEDC (0xFFFFFF00 - 36)."

dimzon
6th May 2006, 07:31
Very very nice, Dimzon.

Can you give me download link to newest BeHappy beta with this new ND AAC dialog? Direct link, if possible.

Thank you.
It is not complete yet, wait for 1-2 week...

shon3i
7th May 2006, 13:42
@dimzon i founded one small bug into enc_aacPlus.exe. When use LC-AAC and MP4 container i get fake SBR which have 88.2kHz instead 44kHz and in foobar says that is SBR present but insn't when i remuxed this file with YAMB everything is fine, that is probably because you forgot to clear switch -sbr in mp4box comandline for LC-AAC.

tebasuna51
7th May 2006, 16:44
@Dimzon
Good news at http://forum.doom9.org/showthread.php?p=824472#post824472

New ffmpeg CVS_2006-04-28 works with BeHappy and preserve the 100% original wav volume. In my first test new ffmpeg is better than HeadAC3he v0.24-a13 with 6 db gain.

thuongshoo
8th May 2006, 09:37
HI dimzon! http://img135.imageshack.us/img135/2531/neroheaac6qk.th.png (http://img135.imageshack.us/my.php?image=neroheaac6qk.png). No program can know He-AAC

jjseth
8th May 2006, 11:12
Here is a simply and basic BeHappy MusePack extension.

http://d.turboupload.com/d/584079/mpcextension.rar.html

The extension and the mppenc.exe from www.musepack.net must be in the BeHappy folder of course.

@dimzon:
Maybe you want improve the extension (change the uniqueID, or add a logo), or reject it ;)

shon3i
8th May 2006, 11:21
HI dimzon! http://img135.imageshack.us/img135/2531/neroheaac6qk.th.png (http://img135.imageshack.us/my.php?image=neroheaac6qk.png). No program can know He-AAC
That is everything fine, that is MP4 container bug.

tebasuna51
8th May 2006, 12:24
Here is a simply and basic BeHappy MusePack extension.
...

Hi Shet!. Nice to meet you here.

Thanks for your contribution. Works fine, and also .mpc decode is well supported by BassAudio.

jjseth
8th May 2006, 12:37
Hi Shet!. Nice to meet you here.

Thanks for your contribution. Works fine, and also .mpc decode is well supported by BassAudio.

Hi tebasuna51!!! Nice to meet you too.
My posts in Doom9 are a rara avis cause my english is ¿?¡?¿T?¿¡()((... but i'm an "always on" reader.:D

NorthPole
9th May 2006, 03:08
If You need some fix/improvement please let me know ASAP!

Just had a couple of suggestions if you have a chance.

Anyway to get a "Clear All Jobs" on the job control page.
(now you have to delete jobs one at a time)

Also, have the destination filename change to match the source filename anytime it changes after the inital selection.
(I usually convert 3 - 5 files at a time.)

Otherwise, I like it the way it is now. Thanks again.

NorthPole
9th May 2006, 03:10
New ffmpeg CVS_2006-04-28 works with BeHappy and preserve the 100% original wav volume. In my first test new ffmpeg is better than HeadAC3he v0.24-a13 with 6 db gain.

Thanks for the tip.

thuongshoo
9th May 2006, 06:56
That is everything fine, that is MP4 container bug. really ? shon3i! What do you base on when you say that ? :D
I regret a thing that I dont know any program which can read AAC files except Gspot. Zen( author of MediaInfo) says that reading AAC files is a request :D

buzzqw
10th May 2006, 14:22
Hi Dimzon !

I would like to know if there is any update to BePipe ! i would use it in my mkvmagic (if you agree)

thanks

BHH

buzzqw
10th May 2006, 20:27
sorry to bother but i have some problem with enc_AudX_CLI.exe


C:\Programmi\PureBasic\Prove>BePipe.exe --script "import(^test.avs^)" | enc_AudX_CLI.exe - qqq.mp3
--q 2
##################################################################
Aud-X multichannel encoder CLI frontend
this algorithm has been prepared by: [Aud-X Team www.aud-x.com]
##################################################################
***************************************
BePipe by dimzon
***************************************
Script used:
# BEGIN
import("test.avs")
# END


Scanning for Audio Stream...
Found Audio Stream
Channels=6, BitsPerSample=32, SampleRate=48000Hz
Writing Header...
Writing Data...
0% System.NotSupportedException: Il flusso non supporta la ricerca. ---> "stream doesn't support seek" i can translate
in System.IO.__Error.SeekNotSupported()
in System.IO.__ConsoleStream.get_Position()
in enc_AudX_CLI.WaveFormat.ReadWavHeader(BinaryReader reader)
in enc_AudX_CLI.Main(String[] args)
Done!

C:\Programmi\PureBasic\Prove>


this is my test.avs

loadplugin("C:\Programmi\PureBasic\Prove\exe\filter\nicaudio.dll")
nicac3source("C:\Programmi\PureBasic\Prove\aaa.ac3")

the same script is fine wth oggenc/lame/neroaacenc.exe

any suggestion ?

thanks

BHH

Edit: typos

shon3i
10th May 2006, 20:54
Did you have installed lastest Aud-X codec.

buzzqw
10th May 2006, 21:19
i use audxlib.dll and enc_AudX_CLI.exe present in enc_AudX_CLI.zip on dimzon gotnet page.

need i something other ?

BHH

tebasuna51
11th May 2006, 01:44
The last alpha Bepipe still have the bug writing wav headers detected for BeHappy in my post:
http://forum.doom9.org/showthread.php?p=758076#post758076

Maybe enc_AudX_CLI.exe detect the error and abort. See the routine name in log:
" in enc_AudX_CLI.WaveFormat.ReadWavHeader"

Others encoders may ignore the error (isn't a important parameter).

In any case, I agree with buzzqw, Bepipe can be used in others app. (see NeroAacEnc thread) and may need a update.

buzzqw
11th May 2006, 08:11
@tebasuna51
Thanks for the info.

since avs2wav isn't so good i will hope in bepipe update !

BHH

dimzon
13th May 2006, 20:00
@Dimzon
Good news at http://forum.doom9.org/showthread.php?p=824472#post824472

New ffmpeg CVS_2006-04-28 works with BeHappy and preserve the 100% original wav volume. In my first test new ffmpeg is better than HeadAC3he v0.24-a13 with 6 db gain.
WOW! Really good news! Thanx a lot!

enc_AudX_CLI.exe bug will be fixed a little later...

shon3i
13th May 2006, 20:03
@dimzon you finaly back, can you check aslo this bug in encaacplus.exe

@dimzon i founded one small bug into enc_aacPlus.exe. When use LC-AAC and MP4 container i get fake SBR which have 88.2kHz instead 44kHz and in foobar says that is SBR present but insn't when i remuxed this file with YAMB everything is fine, that is probably because you forgot to clear switch -sbr in mp4box comandline for LC-AAC.

dimzon
13th May 2006, 20:08
@dimzon you finaly back, can you check aslo this bug in encaacplus.exe
Just one question - does anybody still need this encoder since 100% free and legal solution from Nero are avaluable?

shon3i
13th May 2006, 20:11
Just one question - does anybody still need this encoder since 100% free and legal solution from Nero are avaluable?
I think just me ;)

NorthPole
13th May 2006, 20:46
Just one question - does anybody still need this encoder since 100% free and legal solution from Nero are avaluable?

Not me! Using either the free nero encoder or the new ffmpeg encoder.

dimzon
15th May 2006, 15:37
@dimzon you finaly back, can you check aslo this bug in encaacplus.exe
done ;)

dimzon
15th May 2006, 16:02
Ok, second name for this Effect is Wavesharper
There are big amount of such formulas
http://musicdsp.org/archive.php?classid=4#207
http://www.google.com/search?lr=&ie=UTF-8&oe=UTF-8&q=Waveshaper

and finally found good approximation
http://img217.imageshack.us/img217/1803/testnew6pc.png
yellow is tera
pink is .55 * Math.Atan(6*x)

Some code from LigH
http://www.ligh.de/software/booster.zip
const
HalfPi = Pi/2;

function BoostStrong(Value: Single): Single;
begin
Result := TanH(Value);
end;

function BoostMedium(Value: Single): Single;
begin
Result := ArcTan(Value*HalfPi)*HalfPi;
end;

function BoostSoft(Value: Single): Single;
begin
Result := Value/(Abs(Value)+1);
end;

Another good news is BeHappy is now @ third place
http://img169.imageshack.us/img169/650/bh33zw.th.png (http://img169.imageshack.us/my.php?image=bh33zw.png)

shon3i
15th May 2006, 17:30
done ;)
Nice, everything work pefertly now. Thanks

dimzon
16th May 2006, 02:30
new UNSTABLE version is out
get it @ BeHappy workspace at Your own risk

http://img226.imageshack.us/img226/1974/14oa1.png

http://img226.imageshack.us/img226/222/20mg.png

http://img226.imageshack.us/img226/2333/33ut.png

http://img55.imageshack.us/img55/4022/48vn.png

Yama4050242
16th May 2006, 03:48
both BeHappy & megui do not support nero 2pass? why?

buzzqw
16th May 2006, 08:15
Using avisynth isn't possibile to do a 2 pass encoding (with piping).

Behappy should first dump the wav file then do the 2 pass encoding... it's a quite long process

BHH

shon3i
16th May 2006, 12:38
@dimzon, one question:

did you include new CT dialog or not

and can you use mp4 for default extesion insted m4a

buzzqw
16th May 2006, 13:18
and can you use mp4 for default extesion insted m4a

afaik mp4 mean m4a muxed into mp4 container... so is different from m4a

BHH

dimzon
16th May 2006, 13:38
afaik mp4 mean m4a muxed into mp4 container... so is different from m4a
Wrong! m4a is AAC in MP4 container. So it's just mp4 renamed to m4a

@dimzon, one question:
did you include new CT dialog or not
Not yet.

and can you use mp4 for default extesion insted m4a
Personally I prefer m4a for audio-only and mp4 for audio+video
bcz I'm using foobar2000 to play m4a (via file association) and MPC to play mp4 (via file association)...
Actually I believe that different extension for audio-only media is good way:


RIFF: WAV & AVI
ASF: WMA & WMV
Matroska: MKA & MKV
MP4: M4A & MP4
OGM: OGG & OGM

shon3i
16th May 2006, 13:55
Personally I prefer m4a for audio-only and mp4 for audio+video
damn, i just prefer mp4 for both audio and video, can you in next release show nero and ct encoders as extension, so than i can change this manunaly, if that possible

Not yet.approx.

dimzon
16th May 2006, 14:16
damn, i just prefer mp4 for both audio and video, can you in next release show nero and ct encoders as extension, so than i can change this manunaly, if that possible
approx.
Hmm... Maybe I will add ability to use last used extension by default instead first from the list.

Kurtnoise
16th May 2006, 14:33
@Dimzon : looking at the Lame picture, the window title is wrong I think. ;)

m4a is AAC in MP4 container
We can store also mp3 and alac into the m4a. :)

dimzon
16th May 2006, 14:49
@Dimzon : looking at the Lame picture, the window title is wrong I think. ;)
Copy/Paste - the greatest programming paradigm ;)


We can store also mp3 and alac into the m4a. :)
Agreed

Rockaria
16th May 2006, 16:53
Another good news is BeHappy is now @ third place
http://img169.imageshack.us/img169/650/bh33zw.th.png (http://img169.imageshack.us/my.php?image=bh33zw.png)
Also do you agree that you don't need to (& should not) use my id in your project as I said long ago? It is not only reflecting the reality wrongfully, I am not feeling any honered by those kind of fixture at all.
It's not a simple idea, but a complete set of my philosophy through my own career. I have been independant since very long ago, so should it be reflected as such.

SirLamer
17th May 2006, 03:32
I am having trouble getting this to run. I know I am doing something dumb, but... I need help! heh

When I try to convert from an AC3 into AAC using BeHappy, I get this error log:

Starting job VTS_01_1 01 en-English 3_2ch 448Kbps DELAY 0ms.ac3->moulin rouge audio.mp4
Error: BeHappy.AviSynthException: Script error: there is no function named "NicAc3Source"
at BeHappy.AviSynthClip..ctor(String func, String arg, AviSynthColorspace forceColorspace, AviSynthScriptEnvironment env)
at BeHappy.Encoder.encode()

I have put NicAudio.dll in the MeGUI folder (where I put BeHappy as well) and AviSynth's plugins folder. Does anyone have any ideas?

Also, I am curious - while I know AAC supports 96kHz sample rates, does it also support 24bit fidelity? I have found nothing that says it is either 16bit or 24bit. Does anyone know?

SirLamer
17th May 2006, 06:17
Hey,

I found out that the error is because the generated AviSynth script is missing a line of code:

LoadPlugin("NicAudio.dll")

It sould appear before the nic script is called.

dimzon
17th May 2006, 07:11
Also, I am curious - while I know AAC supports 96kHz sample rates, does it also support 24bit fidelity? I have found nothing that says it is either 16bit or 24bit. Does anyone know?
ATM BeHappy doesnt support anything except 16 bit

Hey,

I found out that the error is because the generated AviSynth script is missing a line of code:

LoadPlugin("NicAudio.dll")

It sould appear before the nic script is called.
No. Just place NicAudio.dll into AviSynth plugin folder

SirLamer
17th May 2006, 19:04
Well I did that, and it wasn't sufficient.

Adding the line of code made it work suddenly.

dimzon
17th May 2006, 19:18
Well I did that, and it wasn't sufficient.

Adding the line of code made it work suddenly.
impossible

SirLamer
18th May 2006, 02:19
Okay, then don't believe me. You could focus on a possible bug in your program, or you can claim it to be fantasy, it is your choice.

I don't have AviSynth installed in the default location. I will try reinstalling it in the default folder and see if that fixes things.

By the way, it would be nice if one were able to export AAC in a .mp4 container, since it has support with more media players.

UPDATE: Indeed, installing AviSynth at its default location corrected the error.

ANOTHER UPDATE: I had StaxRip installed, and it's possible that it decided to swap the registry link from the AviSynth folder I installed to its own plugins folder.

dimzon
18th May 2006, 09:41
new unstable development build out!

New CT AAC encoder GUI
New TimeStretch encoder GUI

dimzon
18th May 2006, 09:44
Okay, then don't believe me. You could focus on a possible bug in your program, or you can claim it to be fantasy, it is your choice.

I don't have AviSynth installed in the default location. I will try reinstalling it in the default folder and see if that fixes things.

By the way, it would be nice if one were able to export AAC in a .mp4 container, since it has support with more media players.

UPDATE: Indeed, installing AviSynth at its default location corrected the error.

ANOTHER UPDATE: I had StaxRip installed, and it's possible that it decided to swap the registry link from the AviSynth folder I installed to its own plugins folder.

So this is not a bug in BeHappy application as I said before. You just placed NicAudio.dll in wrong folder.

shon3i
18th May 2006, 11:41
new unstable development build out!

New CT AAC encoder GUI
New TimeStretch encoder GUI
Nice, Thank You.

stax76
18th May 2006, 14:41
Any chance adding COM automation suport?

dimzon
18th May 2006, 14:51
Any chance adding COM automation suport?
Any reason to ask about it? :rolleyes:

stax76
18th May 2006, 15:39
In my case I'm interested to use BeHappy for audio encoding with StaxRip. A CLI might even be better since StaxRip has already generic CLI support. Generally scripting and CLI is always a good thing, don't you think?

There is always a feature missing and scripting is often the rescue here. I've extened dozens of applications for personal use including most of my media apps like MediaMonkey, iTunes, DVBViewer, they all got a huge scripting SDK.

BeHappy would then be usable from the command prompt, batch files, and all serious programming and scripting languages. It can already be hacked easily from .NET but it's nicer to use a real SDK, late binding etc. instead of reflection on private code.