|
From: TJF <tjf...@we...> - 2010-05-26 08:27:04
|
Hi,
on my libsox way I found a mistake. The generated wav-file (with
effects) shows always this mistakes (see also below). A 44100/16 wav is
upsampled to 88200/32:
frames : 0
data : 0
*** Unknown chunk marker (0) at position 80. Exiting parser.
Duration : 00:00:00.000
Signal Max : 0 (-1.#J dB)
The file has the right size (bytes) and plays fine. But the player-API
could not find the end.
Here is the code (beneath the file-analysis).
Regards
Thomas
------------------------------------------------------
sox_init();
data.fd_in = sox_open_read(file, NULL, NULL, NULL);
data.fd_out = sox_open_write("temp.wav", &data.fd_in->signal, NULL,
NULL, NULL, NULL);
data.fd_out->encoding.bits_per_sample = 32;
data.fd_out->signal.rate = 88200;
data.fd_out->signal.length = data.fd_out->signal.length * 4; // 2 x
upsampling + 16 to 32 bit
data.chain = sox_create_effects_chain(&data.fd_in->encoding,
&data.fd_out->encoding);
data.e = sox_create_effect(sox_find_effect("input"));
args[0] = (char *)data.fd_in, assert(sox_effect_options(data.e, 1, args)
== SOX_SUCCESS);
assert(sox_add_effect(data.chain, data.e, &data.fd_in->signal,
&data.fd_out->signal) == SOX_SUCCESS);
if (data.fd_in->signal.rate != data.fd_out->signal.rate)
{
std::cout << "signal.rate is processed!\n";
data.e = sox_create_effect(sox_find_effect("rate"));
args[0] = "-v", assert(sox_effect_options(data.e, 1, args) ==
SOX_SUCCESS); // VHQ
args[0] = "-b 99", assert(sox_effect_options(data.e, 1, args) ==
SOX_SUCCESS); // 95 (VHQ) to 99 % (-s)
args[0] = al, assert(sox_effect_options(data.e, 1, args) ==
SOX_SUCCESS); // Allow aliasing/imaging above the pass-band
args[0] = phase, assert(sox_effect_options(data.e, 1, args) ==
SOX_SUCCESS); // 0 = minimum, 25 = intermediate, 50 = linear
assert(sox_add_effect(data.chain, data.e, &data.fd_in->signal,
&data.fd_out->signal) == SOX_SUCCESS);
}
data.e = sox_create_effect(sox_find_effect("output"));
args[0] = (char *)data.fd_out, assert(sox_effect_options(data.e, 1,
args) == SOX_SUCCESS);
assert(sox_add_effect(data.chain, data.e, &data.fd_in->signal,
&data.fd_out->signal) == SOX_SUCCESS);
sox_flow_effects(data.chain, NULL, NULL);
-------------------------------------------------
-------------------------------------------------
File : D:\Sox\temp.wav
Length : 110318252
RIFF : 60
WAVE
fmt : 40
Format : 0xFFFE => WAVE_FORMAT_EXTENSIBLE
Channels : 2
Sample Rate : 88200
Block Align : 8
Bit Width : 32
Bytes/sec : 705600
Valid Bits : 32
Channel Mask : 0x0 (should not be zero)
Subformat
esf_field1 : 0x1
esf_field2 : 0x0
esf_field3 : 0x10
esf_field4 : 0x80 0x0 0x0 0xAA 0x0 0x38 0x9B 0x71
format : pcm
fact : 4
frames : 0
data : 0
*** Unknown chunk marker (0) at position 80. Exiting parser.
----------------------------------------
Sample Rate : 88200
Frames : 0
Channels : 2
Format : 0x00130004
Sections : 1
Seekable : TRUE
Duration : 00:00:00.000
Signal Max : 0 (-1.#J dB)
|