Log in

View Full Version : NicAudio 2.0.6 in CodePlex project


Pages : 1 [2]

Midzuki
22nd June 2009, 02:54
Here it goes:

http://au.geocities.com/rashojin_mizuki/docs/

(filename = "mpthree-issue.zip") <-- no longer available

tebasuna51
22nd June 2009, 11:53
Yep, NicMPG123Source() don't work with this sample.
The workaround is use BassAudioSource (like you say) or delete the ID3v2 Tag with winamp or other before decode.

BTW, NicMPG123Source() work fine with ID3v2 Tag make with winamp, I don't know if this ID3v2 with image is a hack or a official resource, or maybe there are a new mpg123 lib to solve the problem. I will see.

tebasuna51
25th June 2009, 15:47
Was easy to implement, now NicMPG123Source() ignore the initial ID3v2,3,4 tags in the new version NicAudio v2.0.3 (http://nicaudio.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29247#DownloadId=72888)

b66pak
25th June 2009, 16:19
thanks...
_

b66pak
17th July 2009, 18:18
often when i decode 1500kb 5.1 dts tracks to 5.1 wav files with eac3to i get "clipping detected, a 2nd pass will be necessary"...same tracks with nicaudio are decoded in one pass...how is dealing nicaudio with clipping?

also 1500kb 5.1 dts >> 448kb 5.1 ac3 is done in one pass with nicaudio + aften (with BeHappy)...

same thing with eac3to is done in two passes ("clipping detected, a 2nd pass will be necessary")...

witch is the proper way?
_

tebasuna51
21st July 2009, 23:48
When you encode audio data, with lossy formats, the max input value is 1.000, but when you decode these peaks you obtain 0.999 or 1.001 (because is lossy).
If you ignore the clip you have 0.999 and 1.000 values, if you make a second pass with an attenuation, you obtain values between 0.998 and 1.000.

A clip is a encode/decode error, make a second pass don't solve the problem only preserve the error.

NicAudio always ignore decoder clips.
When you only decode with eac3to you can use the -no2ndpass parameter.
If you make downmix use -normalize (2ndpass to maximize the output)

tebasuna51
12th August 2009, 20:36
Solved a bug writing last block with lpcm source.

NicAudio.dll v2.0.4 (http://nicaudio.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=31471#DownloadId=78960)

b66pak
13th August 2009, 19:41
thanks...
_

Underground78
11th November 2009, 20:08
Hello,

Can we hope something like NicEAC3Source() one day ?

tebasuna51
12th November 2009, 00:48
I do't know if the free decoder is finished or not.

After we need a volunteer to translate the decoder to AviSynth plugin (I can help but I'm not a programmer to do all the job).

And, after the BD victory, I don't know if there are sources to decode in eac3.

Underground78
13th November 2009, 22:13
And, after the BD victory, I don't know if there are sources to decode in eac3.

Here in France, EAC3 format is used for the HD channels of the Digital terrestrial television.

tebasuna51
14th November 2009, 02:22
Use Eac3to while wait for the volonteer.

Kurtnoise
14th November 2009, 09:17
Most of the EAC-3 streams from the french HD channels use spectral extension. However EAC3to doesn't support this yet. You need to update FFmpeg libraries from it to support this or use a FFmpeg patched build.

smok3
24th November 2009, 22:06
could we have:
bool 'apply delay based on filename, where filename was generated using 'neurons' demuxer'
switch ? (at least for mp2 files, i'am trying to convert bunch of hdv files, and i'd like really exact sync....

or if there is an alternative solution? (the kind that doesn't make /me write some funny text manipulation scripts)

tebasuna51
25th November 2009, 03:33
The solution is include a Delay() function in the .avs file. NicAudio is only a decoder.

IanB
25th November 2009, 07:24
...
File = "MyProject T01 2_0ch 228Kbps DELAY -248ms.mp2" # Set target filename

R = RevStr(File) # Reverse the string
P = Findstr(R, RevStr(" DELAY ")) # Find right most " DELAY "
Delay = P > 0 ? Value(RevStr(LeftStr(R, P)))/1000.0 : 0.0 # Value as fractional seconds

AudioDub(..., NicMPASource(File).DelayAudio(Delay))
...

or use the DGIndex template generation facility :-...
V=Mpeg2Source("__vid__")
A=NicMPASource("__aud__").DelayAudio(__del__)
AudioDub(V, A)
...This will create a script with the __vid__, __aud__ and the __del__ replaced with the appropriate values for the current project.

And of course DGIndex can be command line driven use the -AT=AVS_Template_File option to enable project script generation.

smok3
25th November 2009, 09:41
A=NicMPASource("__aud__").DelayAudio(__del__)
much appreciated!

(yes, i use templating system and it is cli driven, somehow i missed the __del__ option however...)

tebasuna51
25th November 2009, 13:35
A=NicMPASource("__aud__").DelayAudio(__del__)
...

The NicMPASource method don't exist in NicAudio 2.x versions. Use NicMPG123Source instead.

smok3
25th November 2009, 13:59
i used
NicAudio.dll v1.82 - AviSynth Audio Plugins for MPEG Audio/AC3/DTS/LPCM
patched by dimzon (dimzon541@gmail.com)
(patch for 44.1khz AC3 by tebasuna51 + fixes for corrupt streams)

tebasuna51
25th November 2009, 23:58
No problem for mp2.

henryho_hk
27th November 2009, 11:14
I found cases that, when there is no delay, or when it is a LPCM track, "__del__" is undefined.

IanB
28th November 2009, 22:19
I found cases that, when there is no delay, or when it is a LPCM track, "__del__" is undefined.
You probably should report this as a bug.

But :-...
Delay = "__del__" == "" ? 0.0 : Value("__del__")
...

medp7060
18th December 2009, 06:38
I loaded AC3 audio with NicAC3Source, but VirtualDSub cannot accept it for converting to MP3, is it a way to do that?

tebasuna51
18th December 2009, 12:30
You need downmix the ac3 5.1 (or other multichannel with more than 2 chanels) to stereo.
You can use NicAC3Source("your.ac3", 2) to obtain a dpl downmix, or make the downmix yourself in the .avs.
There are samples in DownMix.extension in BeHappy package.

After the downmix is always recommended a Normalize()

medp7060
19th December 2009, 00:49
Thanks, tebasuna51. Got it.

TDiTP_
3rd January 2011, 03:56
tebasuna51
May be you should use in NicAudio such downmix matrix as in BeHappy?
Now NicAudio's DPLII matrix is as in azid - surround isn't inverted.

tebasuna51
3rd January 2011, 12:45
NicAudio never do DPLII downmix.

The downmix provided for NicAc3Source or NicDtsSource is only the standard Dolby ProLogic (only one surround channel) downmix and was included in liba52/libdts decoders.

I tried don't change at all the original liba52/libdts decoders.
I think the downmix process must be out of the decoders and be generic for all kind of sources, like now we can do with AviSynth script.

Maybe I can include a generic downmix, with all the choices, for my uNicAudio version (http://forum.doom9.org/showthread.php?p=1207564#post1207564) but seems the users aren't interested: 0 answers to my beta test request.

Wilbert
22nd January 2014, 23:24
I was playing with 2.0.6 and suspect there is a bug NicLPCMSource.

I'm working on the documentation again and created a utility (avs2pcm.exe (http://avisynth.nl/index.php/Filter_SDK/avs2pcm)) which can be used to convert avs to pcm using the AviSynth api. Yes it only works for 16 bit and mono so far. Here is what i did:

1) I created the following script:

v = blankclip(24)
a = Tone(length=1, frequency=2, samplerate=48000, channels=1, type="sine", level=1.0).ConvertAudioTo16Bit()
audiodub(v,a)
audiograph(20)

It shows a sine wave. Note it's 48kHz, mono and 16 bit.

2) I opened the script in Virtualdub and encoded it to an uncompressed wav. If i open the wave file in AviSynth i get the sine wave again:

v = blankclip(1000)
a = WavSource("D:\AviSynth\Plugins\avs2pcm\audio_src.wav")
audiodub(v,a)
audiograph(20)

Ok, that's how it supposed to be.

3) I encoded the script in (1) to pcm with avs2pcm.exe. [There is actually no video needed in the script, but that's not relevant here.] With a hex editor i see that the file is exactly the same as the wave file (without the wave header of course). So that means the pcm file is created correctly right?

4) But if i open the wave file in AviSynth i get a garbled sine wave:

v = blankclip(1000)
a = NicLPCMSource("D:\AviSynth\Plugins\avs2pcm\test2.pcm", 48000, 16, 1)
audiodub(v,a)
audiograph(20)


All files can be found here: www.wilbertdijkhof.com/avs2pcm.zip

Two questions. Is there something wrong with NicLPCMSource or am i missing something obvious? If the former, how to fix NicLPCMSource?

tebasuna51
23rd January 2014, 16:52
...
3) I encoded the script in (1) to pcm with avs2pcm.exe. [There is actually no video needed in the script, but that's not relevant here.] With a hex editor i see that the file is exactly the same as the wave file (without the wave header of course). So that means the pcm file is created correctly right?

Nope. You make a .raw (a wav file without header)

A .pcm must have the 16 bit audio data in 2 bytes big endian order, not in little endian order like wav (or .raw).
Also the channel order is different but here there are only 1 channel.

Use
a = RaWavSource("D:\AviSynth\Plugins\avs2pcm\test2.pcm", 48000, 16, 1)
instead
a = NicLPCMSource("D:\AviSynth\Plugins\avs2pcm\test2.pcm", 48000, 16, 1)

StainlessS
23rd January 2014, 18:47
from NicAudio readme

Supported files (all can be > 4GB):
ac3 (TODO: support also eac3 files or Dolby Digital Plus)
dts also dtswav supported
mpa mpeg files: mp1, mp2 and mp3
lpcm from DVD Audio, from BluRay with -SampleBits
raw and uncompressed formats: WAV, WAVE_FORMAT_EXTENSIBLE, W64, BWF, RF64, AU, AIFF and CAF

I guess that it could be better explained in NicAudio readme, exactly what format (subset of DVD Audio) is acceptable.

Perhaps this is the best available definition at present:

A .pcm must have the 16 bit audio data in 2 bytes big endian order, not in little endian order like wav (or .raw).
Also the channel order is different but here there are only 1 channel.

EDIT:
The readme also says this
"SampleBits" Necessary for lpcm and raw files. Valid values 8/16/24/32 (also 33 (32 float) for raw)
(lpcm also accept 20 and -8/-16/-24/-32. Negative values are for BluRay lpcm (big-endian))


Which would seem to indicate that only correct ordering of samples is required as you can set endian-ness as
a function arg via SampleBits (+ve/-ve SampleBits).

Is DVD Audio really little endian, DVD Video-audio is I think big endian ?
(I'm reading previous text as meaning that DVD is little endian, and BluRay lpcm is big endian)


a = NicLPCMSource("test2.pcm", 48000, -16, 1)

produces same sounding noise as without '-' sign

So, does the SampleBits +ve/-ve setting actually work (ordering of samples is irrelevant for mono).

Wilbert
23rd January 2014, 23:08
In addition to the response of StainlessS
A .pcm must have the 16 bit audio data in 2 bytes big endian order, not in little endian order like wav (or .raw).
As i understand it lpcm can be in little or big endian order (see for example here (http://wiki.multimedia.cx/index.php?title=PCM)). I haven't found anything which claims the contrary. This link (https://ccrma.stanford.edu/courses/422/projects/WaveFormat/) says that wav is little endian, so the pcm that i created is little endian too. I guess i need to investigate further ...

tebasuna51
24th January 2014, 14:01
Of course PCM (Pulse Code Modulation) is really generic and there are many options. Without a header we can't know if data is big or little endian, signed, unsigned, int, float, what bitdepth, samplerate, numchannels and order. NicAudio try to open the most standard formats, but can't support all.

You can see m2audio_lpcm.cpp source to know the supported formats.
Revision History:
* Oct 3, 2004: Created by Attila Afra
...
* Aug 21, 2007: Bug fixes, remove restrictions, generalize code. IanB
* Feb 29, 2008: Cancel obsolete code. Support for > 4 GB files. Map channels for new mode IsBluRay. Bugfix for count>Left. Tebasuna

IanB make the actual code for DVD PCM (SampleBits > 0). See the special order for 20/24 bits in your wiki link (http://wiki.multimedia.cx/index.php?title=PCM)

But I see than don't work for .pcm files extracted by eac3to from BluRay's.
Then I make a new mode BluRay with -SampleBits than don't use IanB code to reorder audio data. Is not a simple diference between big and little endian.
The BluRay mode use a more simple way and work with .pcm extracted by eac3to from Bluray, also this channel order and big-endian style is the required by tsMuxeR (with some header added by Pcm2Tsmu.exe)

In m2audio_lpcm.cpp I use a remap matrix:

// Other kind of lpcm with simple big-endian order and channels remapped
if ( SampleBits < 0 ) {
bIsBluRay = true;
SampleBits = 0 - SampleBits; // Valid parameter for BluRay: -16, -24, -32 (?)
Quant = SampleBits / 8; // Quant only auxiliar here to prepare the matrix
// Initializing remap matrix
for (Channels=0; Channels < ChannelCount; Channels++) map[Channels] = (Channels + 1) * Quant;
if (ChannelCount > 5) {
map[ChannelCount - 1] = 4 * Quant; // LFE from last to fourth
map[3] = 5 * Quant; // BL to fifth
map[ChannelCount - 2] = 6 * Quant; // BR from penultimate to sixth
}
if (ChannelCount > 6) map[4] = 7 * Quant; // SL or BC
if (ChannelCount > 7) map[5] = 8 * Quant; // SR
}

And after remap channels, and change big to little endian, Input buffer to Output buffer with:
if ( bIsBluRay ) {
byt = InQuant / 8;
for (i = 0; i < FrameLength; i += InBlock)
for (k = 0; k < ChannelCount; k++)
for (j = 1; j < byt + 1; j++) {
Output[i + map[k] - j] = Input[0];
Input++;
}
}

My question now is for what you need avs2pcm.exe?
What soft need read your .pcm file without headers?

Wilbert
24th January 2014, 23:55
To start with your questions

My question now is for what you need avs2pcm.exe?
What soft need read your .pcm file without headers?
It's just a toy utility that i want to use to explain some things about the avisynth api, and i want to know how to import it in AviSynth.

I did some further digging

RaWavSource("D:\AviSynth\Plugins\avs2pcm\test2.pcm", 48000, 16, 1)

loads it fine since RaWavSource doesn't reorder any bytes and my lcpm was little-endian. (Yes it loads raw files too.)

To my surprise (upon inspection of the code):

NicLPCMSource("D:\AviSynth\Plugins\avs2pcm\test2.pcm", 48000, 16, channels)
NicLPCMSource("D:\AviSynth\Plugins\avs2pcm\test2.pcm", 48000, -16, channels)

results in the same output (number of channels not important). For both the bytes will be swapped, so you can use both if you have a big-endian lpcm file.
I guess for the other samplebits (except 8 bit which is not supported) you will get differences, but i didn't look at that.

So if DVD pcm and BluRay pcm are both big-endian, what is the exact difference between the two?

tebasuna51
25th January 2014, 11:47
The number of channels is important because DVD PCM code don't make channel remap, BluRay code make remap if ChannelCount > 5 (see my first code).

A .pcm 5.1 from BluRay (extracted by eac3to) with 16 like SampleBits finish with a incorrect channel map FL,FR,FC,BL,BR,LFE
With -16 like SampleBits finish with correct FL,FR,FC,LFE,BL,BR. With 6.1 and 7.1 there are diference also.

And the bytes swap for 24 bits is different also:

24 bits BluRay code: B3,B2,B1 -> B1,B2,B3
24 bits DVD code: like wiki link (http://wiki.multimedia.cx/index.php?title=PCM#24-Bit_PCM)

Wilbert
25th January 2014, 23:49
The number of channels is important because DVD PCM code don't make channel remap, BluRay code make remap if ChannelCount > 5 (see my first code).
Ok i see, i missed that at first. Thanks for your explanation.