Skip to content
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

Synth1b1 dataset #415

Open
arlorostirolla opened this issue May 12, 2023 · 3 comments
Open

Synth1b1 dataset #415

arlorostirolla opened this issue May 12, 2023 · 3 comments

Comments

@arlorostirolla
Copy link

Is it possible to download the synth1b1 dataset? I can't seem to find it anywhere

@jorshi
Copy link
Collaborator

jorshi commented May 16, 2023

@arlorostirolla -- synth1B1 isn't saved anywhere, it is deterministically generated on the fly. Check out the quickstart for info on how to generate the dataset https://torchsynth.readthedocs.io/en/latest/getting-started/quickstart.html. In this way, you can just iterate over the batches of the dataset during training. You could of course save the audio to disk and use the audio/parameters in a pytorch Dataset or similar.

A bit more info on the synth1B1 https://torchsynth.readthedocs.io/en/latest/reproducibility/synth1B1.html

@arlorostirolla
Copy link
Author

Thanks for your help! just one more quick question, is there a way to load the tensor of parameters returned when generating synth1b1 data into the Voice module? In the docs the set parameters function takes a dictionary with (module, parameter) : tensor entries. Whereas output from Voice is a tensor of size 78. I'm not quite sure how to interpret the output or convert it into the dictionary format.
For clarity I'm trying to create a model that maps from audio data to the parameters, and want to eventually generate parameters for audio not found in synth1b1.

@jorshi
Copy link
Collaborator

jorshi commented May 18, 2023

No worries! If you're wanting to update all the parameters at once the easiest would be to directly set them in the voice. This would expect that all the parameters are in a normalized range between 0 and 1.

import torch
from torchsynth.synth import Voice
from torchsynth.config import SynthConfig

# We set reproducible False so we can call Voice without passing in a batch_num
config = SynthConfig(reproducible=False, batch_size=64)
voice = Voice(config)

audio, params, _ = voice()

# (batch_size, num_params)
assert params.shape == (64, 78)

# Generate new random params in range [0,1], which is required for internal
# torchsynth parameters
new_params = torch.rand_like(params)

# Now directly set Voice params
for p, new_p in zip(voice.parameters(), new_params.T):
    p.data = new_p.detach()

audio_2, params_2, _ = voice()

# output of voice is different now and used updated params
assert not torch.allclose(audio_2, audio)
assert torch.allclose(params_2, new_params)

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

No branches or pull requests

2 participants