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

Allow one-shot tuning metadata #1126

Closed
mortfell opened this issue Sep 5, 2019 · 11 comments
Closed

Allow one-shot tuning metadata #1126

mortfell opened this issue Sep 5, 2019 · 11 comments
Labels
Audio Formats DSP Issues and feature requests related to sound generation in the synth Feature Request New feature request

Comments

@mortfell
Copy link

mortfell commented Sep 5, 2019

Not sure if this is a bug or limitation of the current system:
If you import a pitched one-shot, and turn keytracking off the sample plays back 31 semitones above it's original key.

So in order to get a pitched one-sample to play a "C" by default, I have to import an "F" a couple octaves lower..

Just making a few more one-shots and I wanna know, should I wait for a fix?
or just work with this?
I only have a couple presets that actually take advantage of the one-shots so far, so if it's an easy fix I can edit those presets no problem.
If it's a tricky limitation thing I can totally work with it.

@baconpaul
Copy link
Collaborator

TL/DR: This is the correct behavior. The wavetable oscillator is assuming that one cycle is 1024 samples, even for one shots. The approach to make this better is too big a change for 1.6.2.

More detail.

OK so here's what's happening.

The one-shot player is assuming that a "single cycle" is 1024 samples. So if you play it at C (midi note 60) it will play across a 1024 sample block in one wavelength.

This is exactly what you want for a wavetable synthesizer.

But it has an odd effect in one-shot land. So lets look for a second.

WaveTables are imported at 44.1khz so we can use that as a sample rate here.

1024 samples at 44.1khz is 23.21 ms and that wavelength is 43.06 hz.

43.06 Hz is close enough to note 31 in our tuning (the F) that the pitch shift gets explained.

So basically right now a one shot, if you want true tuning with a one-shot, needs to have a cycle-per-1024-samples or be pitch adjusted.

To test this I made a .wav file with a 1024 (with this script) and it was exactly in tune with the square wave oscillator and what not.

OK so what to do about this? Clearly this is not a 'mistake' per se but it is more a 'fundmental feature of cramming one shots into a wavetable oscillator'. There is a workaround I can imagine, though, but I don't want to do it for 1.6.2.

The workaround is: with my .wav tagging thing I introduced the ability to add a surge chunk. I also added a version number. So I could make a surge chunk which indicated "this is a one-shot tuned to this frequency". Then what we would do is store that on the wavetable and when we calculate the playback frequency, make sure that we take the base frequency into account.

That calculation is a little tricky due to our variable tuning; and is a little far reaching since it adds new information to the wavetable structure and requires changes to the WT and Window oscillator as well as the wave and wt i/o and dafa format.

So for now the best thing is: This behavior is correct and compensate accordingly.

If you sampled at C you can figure out the difference to tune a patch of course. Or you could generate all your samples stretched to 43.06 hz and then they should also work! (or some octave multiple of 43.06 hz of course).

@baconpaul baconpaul modified the milestones: 1.6.n, 1.6.3 Sep 6, 2019
@baconpaul baconpaul added DSP Issues and feature requests related to sound generation in the synth Audio Formats labels Sep 6, 2019
@mortfell
Copy link
Author

mortfell commented Sep 6, 2019

yeah thats totally fine. Thanks for the detailed explanation.
Maybe a sampler can be added one day that is just a normal sampler and this can just be left as a wacky wavetable sampler mode.

I will redo my one-shots for VSCO, I want people to be able to load them and not be confused by the pitch being off.

@baconpaul
Copy link
Collaborator

Cool. Let me know when you have the replacement files! And thanks.

@baconpaul baconpaul changed the title Bug? pitched one-shot samples play back at a "modulated" pitch Allow one-shot tuning metadata Sep 7, 2019
@mkruselj mkruselj added the Feature Request New feature request label Feb 5, 2020
@mkruselj
Copy link
Collaborator

mkruselj commented Feb 5, 2020

Wouldn't this one be covered by #1069? As it is, it might be a duplicate?

@baconpaul
Copy link
Collaborator

It’s related but not exactly a duplicate. If I ever manage to add a sampler we need to figure out what to do with the oneshots. It is probably more related to the issue about adding a wav import screen for I tagged wavs tbh

@mkruselj
Copy link
Collaborator

mkruselj commented Feb 5, 2020

Sure but when you add SFZ import, SFZ itself can specify if it's a oneshot or not...

https://sfzformat.com/opcodes/loop_mode

@baconpaul
Copy link
Collaborator

oh yeah; the one shot playback on the wavetable oeprator is different than what an sfz will do is all i'm saying.

@mkruselj
Copy link
Collaborator

mkruselj commented Feb 5, 2020

Ah, this is WT osc related! All good, then :)

@mkruselj
Copy link
Collaborator

mkruselj commented Apr 10, 2022

This one could probably be linked to #3436?

@baconpaul
Copy link
Collaborator

yes

@mkruselj
Copy link
Collaborator

Aight we can close this one then since the issue has been referenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Audio Formats DSP Issues and feature requests related to sound generation in the synth Feature Request New feature request
Projects
None yet
Development

No branches or pull requests

3 participants