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

Same output for all TALNoisemaker presets #122

Open
turian opened this issue Sep 11, 2022 · 3 comments
Open

Same output for all TALNoisemaker presets #122

turian opened this issue Sep 11, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@turian
Copy link

turian commented Sep 11, 2022

Are there any synths (not effects) that work under Linux. I have gotten Surge working under Linux but only using their Python API.

You can try yourself in this colab

Basically, it picks a random preset, plays it with fixed f0, note on, note off, and duration.

It does that again.

But both sounds are the same, as indicated by their summary statistics:

presets/BS Dark Bass TAL.vstpreset
synth num inputs:  2
synth num outputs:  2
mean 0.10211249
max 0.27722654
min -0.2509556
std 0.13524659

presets/LD Analog Down Glider TAL.vstpreset
synth num inputs:  2
synth num outputs:  2
mean 0.10211249
max 0.27722654
min -0.2509556
std 0.13524659

Why? Is this because .so plugings aren't working on Unix?

Potentially related to #86 and #120

@turian
Copy link
Author

turian commented Sep 11, 2022

Here is the code in case the colab goes down:

# !wget -c https://tal-software.com/downloads/plugins/TAL-NoiseMaker_64_linux.zip && unzip -o TAL-NoiseMaker_64_linux.zip && rm TAL-NoiseMaker_64_linux.zip
# !mkdir presets && cd presets && wget 'https://tal-software.com//downloads/presets/TAL-NoiseMaker%20vst3.zip' && unzip -q -o "TAL-NoiseMaker vst3.zip"

# !pip3 install dawdreamer
# #!pip3 install git+https://github.com/csteinmetz1/auraloss.git@librosa

import glob

import dawdreamer as daw

# %matplotlib inline
import IPython.display as ipd
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile

SAMPLE_RATE = 44100
BUFFER_SIZE = 128  # Parameters will undergo automation at this buffer/block size.
PPQN = 960  # Pulses per quarter note.

SYNTH_PLUGIN = "libTAL-NoiseMaker.so"

# Shuffle the order of the presets

import random

random.seed(0)

presets = list(glob.glob("presets/*.vstpreset"))
random.shuffle(presets)


def generate_sound(preset):
    # TODO: Don't know why I have to do this over and over again
    engine = daw.RenderEngine(SAMPLE_RATE, BUFFER_SIZE)
    # Make a processor and give it the unique name "my_synth", which we use later.
    synth = engine.make_plugin_processor("my_synth", SYNTH_PLUGIN)
    assert synth.get_name() == "my_synth"

    synth.load_state(preset)

    # We can also add one note at a time, specifying a start time and duration, both in seconds
    #  synth.add_midi_note(60, 127, 0.0, 3.0)  # (MIDI note, velocity, start, duration)
    synth.add_midi_note(60, 60, 0.0, 3.0)  # (MIDI note, velocity, start, duration)

    # For any processor type, we can get the number of inputs and outputs
    print("synth num inputs: ", synth.get_num_input_channels())
    print("synth num outputs: ", synth.get_num_output_channels())

    # don't do reverb
    graph = [
        (synth, []),  # synth takes no inputs, so we give an empty list.
    ]

    engine.load_graph(graph)
    engine.render(4)

    output = engine.get_audio()
    # wavfile.write("foo.wav", SAMPLE_RATE, output.transpose())

    print("mean", np.mean(np.abs(output)))
    print("max", np.max(output))
    print("min", np.min(output))
    print("std", np.std(output))
    # Can't get this to work


#  ipd.Audio(np.mean(output, axis=0), rate=int(SAMPLE_RATE))
#  plt.show()

preset = random.choice(presets)
print(preset)
generate_sound(preset)

preset = random.choice(presets)
print(preset)
generate_sound(preset)

@DBraun DBraun self-assigned this Sep 13, 2022
@DBraun DBraun added the bug Something isn't working label Sep 14, 2022
@DBraun
Copy link
Owner

DBraun commented Sep 14, 2022

load_state is the counterpart to save_state, so you should be using load_vst3_preset since these are .vstpreset files. However, I tried it in the colab now and see the same result.

@turian
Copy link
Author

turian commented Sep 17, 2022

Okay. Curious what you can determine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants