Which frequency to choose to generate good sounding samples?

Started by MakeNoize, December 11, 2015, 14:45:18

Previous topic - Next topic

MakeNoize

Hello,

I just started to test some samples generation algorithms.
I use instruments in openMPT with the " use external samples" setting and I overwrite the .wav with my code (currently just adding some sine waves but this is meant to test other generating techniques). It a good way to test the instrument in a "musical" context.
I'm interested in generative musc, so the next step will be later to generate the patterns, too. But one step at a time.   ;D

Regarding the sample generation:
What would be the best number of samples of the wav file to achieve the optimum quality?
I started with a sampling frequency of 44100 and use "A441" so I have a perfect cycle for note "A" with 100 samples.
Using the autotuning, my sample is looped with a freq of 44100 and E-7 transposed. Is this the correct setting? How is this calculated?
Would there be some benefit of generating 200 samples/cycle? Or should I go the multisampling way (using sample map)?

Thank you for any info regarding this.



Saga Musix

QuoteUsing the autotuning, my sample is looped with a freq of 44100 and E-7 transposed. Is this the correct setting? How is this calculated?
Autotuning uses autocorrelation to find the fundamental frequency of the sample. It's not perfect but "close enough" most of the time. It can be off sometimes but with a pure looped sine wave it's hard to go wrong. :)
I'd say the base frequency of your generated samples doesn't matter as long as you generate perfect loops (like you appear to do). In the end, you are most likely going to play more than one single note anyway, so it won't give you a big advantage if this one note is sampled at 44100 or 48000 Hz. ;) I'd rather use A440 tuning (and thus a sampling frequency of 44000 Hz) even if the difference is probably inaudible.
QuoteWould there be some benefit of generating 200 samples/cycle? Or should I go the multisampling way (using sample map)?
Both will probably not give you any advantages in your scenario. A multisampled single-cycle sample would be quite some overkill. :) Multisampling is more useful for samples that are hard to resample or are intended to sound different over time or that have a different timbre depending on the note, like piano samples.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

MakeNoize

Thank you for the response.
When I spoke of multisampling what I had in my mind is more related to "avoiding the interpolation". So pre-calculating the A440, A220, A110, A55, ... might perhaps lead to a better quality and less CPU usage? Just guessing as I don't know the internal working of openMPT.

My question about the calculation was referring to the way the frequency is used.
From the manual the Frequency field defines the playback frequency of C-5 (C5 is 523.251Hz ?).
If I import a single cycle wavfile (sf=44100) of 100 samples, the correlation algorithm (force to A with a=441)  calculate a frequency of 44100 (and the transpose setting is put at G-7).
If I import a songle cycle wavfile (sf=44100) of 200 samples, the correlation algorithm calculate a the same frequency 44100.
So I guess I'm not using correctly the function or I didn't understood the meaning of the freq setting.



Saga Musix

QuoteSo pre-calculating the A440, A220, A110, A55, ... might perhaps lead to a better quality and less CPU usage? Just guessing as I don't know the internal working of openMPT.
It very much depends on the sample. Use multisampling if the result sounds bad afterwards, otherwise don't think about it. And don't  think about CPU usage when this kind of sample playback was already possible in realtime 20 years ago. For one voice, you may save a fraction of a percent of CPU time if you don't interpolate.

QuoteIf I import a songle cycle wavfile (sf=44100) of 200 samples, the correlation algorithm calculate a the same frequency 44100.
So I guess I'm not using correctly the function or I didn't understood the meaning of the freq setting.
As the dialog states, it finds the closest note to tune to. It does not tune to an exact note like C5, but rather to any C. The reference you defined (A440) is really only a reference for pitch, not octave.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

MakeNoize