Log in

View Full Version : 90 second speedup possible in AGK?


felixk
9th July 2005, 03:12
Hi there,

When I was staring at the AutoGK progress, i noticed that normalize.exe is taking quite a while for reading the 1GB+ wav audio track, and writing the normalized track back to disk.
This process can be sped up by piping the normalized wav file directly into lame (lame supports reading from stdin) so that the disk does not need to read and write huge chunks of data at the same time. The problem was that normalize did not support writing to stdout.
Luckily, normalize is GNU GPL'ed and I could modify the code so that streaming the wave to stdout is now possible.
Passing the normalized wav directly to lame is a bit faster, as my timings showed on a AthlonXP 3200+ with a 2-hour audio track:

Writing normalized wave to disk:
azid: 3:40
normalize: 2:18
lame: 4:27
(normalize+lame: 6:45)
Total: 10:25 minutes

Piping normalized wav to lame:
azid: 3:35
normalize+lame: 5:14
Total: 8:49 minutes.

Len0x, could you have a look at my version of normalize?
Is it possible to use this method in AutoGK?

Cheers,
Felix

----------
I attached a zip file containing:
modified normalize.exe.
source code.
Batch files for testing. Results.

len0x
9th July 2005, 11:42
Looks interesting. I'll have a look, thanks.

len0x
14th July 2005, 22:07
Unfortunately atm this won't work as shell is not executed, but just processes are started (so piping is not possible).

felixk
20th July 2005, 09:12
What a pity ;-(
Thanks for checking this.

felixk
20th July 2005, 09:40
... but then again, why not start a console?
Instead of calling the programs directly, ask cmd.exe to start them, using the /c option.
cmd /c "normalize -o - song.wav | lame - song.mp3"
(I don't know, however, if the 'command' command of Windows 9x has this ability, too.)

mimungr
20th July 2005, 14:20
With the CreateProcess API, you can set the standard input, output, and error handles for the process. Look at the STARTUPINFO struct. When you create normalize, you can pass lame's input handle as its output handle.

felixk
22nd July 2005, 16:16
With the CreateProcess API, you can set the standard input, output, and error handles for the process. Look at the STARTUPINFO struct. When you create normalize, you can pass lame's input handle as its output handle.
So does this mean that piping doesn't work?
Isn't it possible to set the output handle of normalize to STDOUT and the input handle of lame to STDIN? (My C skills are low, so I'm just asking.)

Alternative answer:
I didn't mean to create a normalize process, but create a cmd.exe process instead. Cmd does the piping for you.

mimungr
23rd July 2005, 03:34
No, your approach is fine, too. I was just suggesting an alternative. My approach saves the overhead of launching cmd.exe.

felixk
23rd July 2005, 15:49
you can pass lame's input handle as its output handle.
Where did the "not" go, that I read yesterday in your answer?:confused:
So everything is fine then. :D