Skip to content

Conversation

@SeanNaren
Copy link
Contributor

Ported the code from here to save tensors! Should also close #2, let me know if any feedback

func = th_sox.libthsox_Int_write_audio_file
elif isinstance(src, torch.LongTensor):
func = th_sox.libthsox_Long_write_audio_file
func(bytes(filepath), src, extension.replace('.', ''), sample_rate)

This comment was marked as off-topic.

elif isinstance(src, torch.IntTensor):
func = th_sox.libthsox_Int_write_audio_file
elif isinstance(src, torch.LongTensor):
func = th_sox.libthsox_Long_write_audio_file

This comment was marked as off-topic.


def save(filepath, src, sample_rate):
assert torch.is_tensor(src)
assert not src.is_cuda

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@SeanNaren
Copy link
Contributor Author

Thanks for the feedback @apaszke, made a few changes if you could review again!

Copy link
Contributor

@apaszke apaszke left a comment

Choose a reason for hiding this comment

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

One last nit. I don't know sox so I'm leaving the review for @soumith

audio.save(
string, # path to file
tensor, # NSamples x NChannels 2D tensor
number, # sample_rate of the audio to be saved as

This comment was marked as off-topic.

@soumith soumith merged commit 2936245 into pytorch:master Jun 1, 2017
@SeanNaren SeanNaren deleted the save branch June 1, 2017 19:28
mingbowan added a commit that referenced this pull request Nov 25, 2019
* adding smoke test

* adding smoke test

* fix config.yml

* trigger smoke test

* test aws erc credential

* test aws erc credential

* test aws erc credential

* test aws erc credential

* adding ecr cred

* test aws erc credential

* test aws erc credential

* test aws erc credential - different way

* test aws erc credential - different way #2

* test aws erc credential - different way #3

* test aws erc credential - different way #4

* test aws #1

* test aws erc credential, after enabling circleci setting

* fixing conda init

* add verbose output for smoke test

* add docker image build workflow

* add docker image build workflow

* fix aws ecr login

* use images build from circelci

* ready for review

* updated Readme with instructions on nightly install, also updated docker image which can make nightlies installed via pip pass

* nit

* reduce size
mthrok pushed a commit to mthrok/audio that referenced this pull request Feb 26, 2021
Update .grad attribute type
mpc001 pushed a commit to mpc001/audio that referenced this pull request Aug 4, 2023
Making CUDA optional for MNIST example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need API for saving to file.

3 participants