DBraun / DX7-JAX

Yamaha DX7 synthesizer with JAX
GNU General Public License v3.0
13 stars 1 forks source link

Could you show how to use customdx7.lib from DawDreamer WITHOUT JAX? #1

Open turian opened 3 weeks ago

turian commented 3 weeks ago

The improved dx7.lib is great!

But even with a GPU, JAX rendering is I think slower/more expensive per output than multicore CPU.

I've tried to get CPP rendering to work with sndfile architecture, but that isn't working :(

I've tried stripping JAX from dx7_render.py and not transforming the values, but I end up with empty audio files (or just direct sine-tones always at a high pitch).

Any help would be greatly appreciated!

DBraun commented 3 weeks ago

Thanks. I think it's an improvement over the one from Faust Libraries, but still not as good as Dexed etc.

In my experience, once you can get to a batch size of 512, the GPU parallelism outweighs the slower clock rate.

For just DawDreamer, it would be like this

import dawdreamer as daw
from scipy.io import wavfile
SAMPLE_RATE = 44100
engine = daw.RenderEngine(SAMPLE_RATE, 512)  # 512 block size
faust_processor = engine.make_faust_processor("faust")
faust_processor.num_voices = 1
code = open("custom_dx7.lib", "r").read()
i = 1  # between 1 and 32
code += f"\nprocess = dx7_algorithm({i});"
faust_processor.set_dsp_string(code)
print(faust_processor.get_parameters_description())
engine.load_graph([(faust_processor, [])])
faust_processor.add_midi_note(60, 100, 0, 3)
engine.set_bpm(120.)
engine.render(4.)  # render 4 seconds
audio = engine.get_audio()  # shaped (C, N samples)
wavfile.write('faust_dx7_demo.wav', SAMPLE_RATE, audio.transpose())
print('All done!')

Note that the parameters are not typical [0-1] VST parameters.

It should be possible to adapt this to the multiprocessing example: https://github.com/DBraun/DawDreamer/tree/main/examples/multiprocessing_plugins

update: made the faust code mono.