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

user waveform in wavetable synth #13

Open
Reaper10 opened this issue Aug 31, 2020 · 1 comment
Open

user waveform in wavetable synth #13

Reaper10 opened this issue Aug 31, 2020 · 1 comment

Comments

@Reaper10
Copy link

Can you add a sampler to the wavetable synth? So a user can use their own waves as a wavetable. Like you can in Live 10's: Wavetable.
https://www.youtube.com/watch?v=c5Sn0Kibu2w

@grz0zrg
Copy link
Owner

grz0zrg commented Sep 1, 2020

Do you load the samples through the interface ?

The audio server wavetable implementation can do that already as it recursively load raw single cycle waveforms from directories so to add any samples you just split the sample into small chunks with some kind of windowing applied to remove crackles, guess it can be done quickly with some software.

Made a quick example : https://vocaroo.com/jG2ppKnGZBh

The sample was exported with this small Python script (which require pydub; pip3 install pydub) :

from pydub import AudioSegment

def triangular_window (i, N):
    return 1 - abs(2 * (i - 0.5 * (N - 1)) / N)

audio = AudioSegment.from_wav("female_french_numbers_1_10.wav")
audio_samples = audio.get_array_of_samples()

audio_len = len(audio_samples)
chunk_len = 1348 # 44100 / C1_frequency
chunk_count = round(audio_len / chunk_len)

for i in range(0, chunk_count):
    start_index = i * chunk_len
    stop_index = start_index + chunk_len
    audio_chunk = audio._spawn(audio_samples[start_index:stop_index])

    # apply triangular window
    chunk_samples = audio_chunk.get_array_of_samples()
    chunk_len = len(chunk_samples)
    for k in range(0, chunk_len):
        chunk_samples[k] = int(chunk_samples[k] * triangular_window(k, chunk_len))
    audio_chunk = audio._spawn(chunk_samples)

    audio_chunk.export('out/' + str(i).rjust(8, '0') + '.wav', format="wav")

Could be used for any samples or even a whole directory with some minor adaptation.

The split may eventually be implemented into the audio server (and so on the interface you could have direct drag & drop) but this is low priority as it can be done already and rather quickly with that script.

This is more an issue for the audio server https://github.com/grz0zrg/fas/ as the client don't play sound on its own anymore.

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