Skip to content

Conversation

@imaginary-person
Copy link
Contributor

@imaginary-person imaginary-person commented Feb 17, 2021

With advice & help from @mthrok, added htk format to sox_io's save function & info test.

htk is a single channel 16-bit PCM format used by HTK, a toolkit for building Hidden Markov Model speech processing tools.

Edit comment to trigger CI
Copy link
Contributor

@mthrok mthrok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @imaginary-person

Thanks for the contribution. The PR looks good. Can you resolve the conflict due to #1275 ?

@imaginary-person
Copy link
Contributor Author

Can you resolve the conflict due to #1275 ?

Done. Thank you!

@imaginary-person imaginary-person changed the title Added HTK format support to sox_io's save function Added HTK format support to sox_io's save function & info test Feb 18, 2021
Update comment to trigger CI
Merge latest code from main repo
@mthrok mthrok changed the title Added HTK format support to sox_io's save function & info test Add HTK format support to sox_io's save & info Feb 19, 2021
@mthrok mthrok merged commit 3488f31 into pytorch:master Feb 19, 2021
@mthrok
Copy link
Contributor

mthrok commented Feb 19, 2021

Thanks!

@mthrok
Copy link
Contributor

mthrok commented Feb 19, 2021

@imaginary-person

I forgot to mention adding one validation. Could you do a follow-up?
Since HTK only supports one-channel data, we would like to raise an error if the input tensor is multi-channel. In the following two locations can you add a check for the number of channels, similar to amr-nb case?

if (filetype == "amr-nb") {
const auto num_channels = tensor.size(channels_first ? 0 : 1);
if (num_channels != 1) {
throw std::runtime_error(
"amr-nb format only supports single channel audio.");
}
}

if (filetype == "amr-nb") {
const auto num_channels = tensor.size(channels_first ? 0 : 1);
TORCH_CHECK(
num_channels == 1, "amr-nb format only supports single channel audio.");
}

@imaginary-person
Copy link
Contributor Author

imaginary-person commented Feb 19, 2021

@mthrok, thanks a lot for all your help so far!
I submitted #1291, but don't have the requisite permissions to add you as a reviewer.

mthrok pushed a commit that referenced this pull request Feb 23, 2021
mthrok pushed a commit to mthrok/audio that referenced this pull request Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants