-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wav-reverberate.cc and modify the scripts using it. #76
Conversation
$src_dir/wav.scp $log_dir/corrupted_${random_seed}.list $impnoise_dir \ | ||
$log_dir/corrupt_wavs.${random_seed}.list > $log_dir/num_corruption_jobs || exit 1; | ||
$dest_dir/wav.scp || exit 1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the "wc" command. At least print a message to say what the number means.
A side note: You can use sox to generate random signals. |
int xdim = x.Dim(); | ||
int M = h.Dim(); | ||
|
||
KALDI_LOG << "M is " << M; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the log output more descriptive.
e.g. "Length of the filter is " << M;
Break the code in main function into smaller parts. Move everything other than data reading and writing to separate functions. |
RepeatedlyAdd(src, noise); | ||
} | ||
|
||
float src_max2 = src.Min(); // for checking the negative max |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this code to a separate function called
MaxAbsolute(const Vector & vector, BaseFloat * max_value)
I may be misunderstanding what the code does, but just want to point FWIW that |
The code also computes the scaling coefficient for noise signal, this involves Vijay On Tue, Aug 18, 2015 at 5:45 AM, Kirill Katsnelson <notifications@github.com
|
Vijay, let me know when you think this is ready to merge. |
I have made the changes according to all your comments. |
Thanks. Vijay, please confirm when you think it's ready to commit, and On Thu, Aug 20, 2015 at 2:33 AM, tomkocse notifications@github.com wrote:
|
I am going through it now, will add comments soon. Vijay On Thu, Aug 20, 2015 at 2:32 PM, Daniel Povey notifications@github.com
|
|
||
srfft_->Compute(signal_block_padded.Data(), true); | ||
|
||
for (int i = 0; i < fft_length / 2; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate out the for loop into a function like ElementwiseProductOfFft. Same in the ConvolveSignals block above.
// compute the energy | ||
return VecVec(early_reverb, early_reverb) / early_reverb.Dim(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When defining a function, parameter order is: inputs, then outputs.
Add a comment describing what the function does above it.
Added comments to the code. |
the room impulse response). This function returns the energy in | ||
this early reverberation component of the signal. | ||
The input parameters to this function are the room impulse response, the signal | ||
and their sampling freqency respectively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/freqency/frequency/
Vijay, is this ready for me to review? |
Yes, its ready except for one suggested change to function signature. Vijay On Wed, Sep 2, 2015 at 2:44 PM, Daniel Povey notifications@github.com
|
I'll wait. On Wed, Sep 2, 2015 at 2:53 PM, Vijayaditya Peddinti <
|
Function signature changed. |
/* | ||
This function implements convolution of two signals. | ||
However this should be an inefficient version of BlockConvolveSignals() | ||
as it process the entire signal with a single FFT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process -> processes
Can you please clean up the commit history to have a single commit with a suitable message? pick 48dc4cc nnet3: fix to how objective function is normalized in nnet3-show-progress Rebase 3e76aa5..85aa227 onto 3e76aa5Commands:p, pick = use commitr, reword = use commit, but edit the commit messagee, edit = use commit, but stop for amendings, squash = use commit, but meld into previous commitf, fixup = like "squash", but discard this commit's log messagex, exec = run command (the rest of the line) using shellThese lines can be re-ordered; they are executed from top to bottom.If you remove a line here THAT COMMIT WILL BE LOST.However, if you remove everything, the rebase will be aborted.and you edit the first line's commit message to the overall commit message you want for the whole thing, and the other ones from 'pick' to 'f' (or 'fix'), and their commit messages will be ignored. pick 48dc4cc nnet3: fix to how objective function is normalized in nnet3-show-progress Then push it (you may need an option like --no-ff) to force the push because it's not fast forward). |
namespace kaldi { | ||
|
||
void ElementwiseProductOfFft(const Vector<BaseFloat> &a, Vector<BaseFloat> *b) { | ||
for (int i = 0; i < a.Dim() / 2; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good practice to use a temporary
e.g.
int32 num_fft_bins = a.Dim() / 2;
and do i < num_fft_bins, to avoid the function call being repeated.
Also, inside the loop, please replace your code with:
// do complex multiplication b _= a.
ComplexMul(a(2_i), a(2_i + 1), &(b(2_i)), &(b(2*i + 1)));
which will be clearer.
c26da38
to
759114e
Compare
The test for non-FFT-based convolution is added. |
OK, I'll merge now. Thanks for putting up with the process! |
Add wav-reverberate.cc and modify the scripts using it.
update WSJ result
Please comment.