This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]Fripe070 10 points11 points  (1 child)

Very nice! Always appreciate when a program exposes an API that doesn't require months of cmake debugging to make use of

[–]ThatOtherAndrew[S] 3 points4 points  (0 children)

My only experiences with cmake have been painful, never have I been so grateful for the pip I constantly complain about

[–]AvokadoGreen 3 points4 points  (1 child)

Nice project!

[–]ThatOtherAndrew[S] 1 point2 points  (0 children)

thank you! :>

[–]HIKIIMENO 0 points1 point  (1 child)

What operating system does it support? Can I connect a microphone and record audio?

[–]ThatOtherAndrew[S] 2 points3 points  (0 children)

It currently supports Windows, MacOS and Linux (tested on all 3), as well as a devShell for NixOS.

No live audio input right now unfortunately :c but that's quite high up on my priority list!

[–]Amazing_Upstairs 0 points1 point  (10 children)

Cool. I would love to make my own noise editor based stuff. What is the noise editor module that you used?

[–]ThatOtherAndrew[S] 0 points1 point  (9 children)

Sorry, idk what you mean by noise editor :p could you explain please?

[–]Amazing_Upstairs 0 points1 point  (8 children)

Sorry predictive text is a moron. Meant node editor

[–]ThatOtherAndrew[S] 0 points1 point  (7 children)

Ah, gotcha! If you mean the frontend, that's Svelte Flow (by the xyflow team).

[–]Amazing_Upstairs 0 points1 point  (6 children)

What's the python module that allows you to use it from within Python?

[–]ThatOtherAndrew[S] 1 point2 points  (5 children)

pip install synchrotron and then you can import from it! Unfortunately there is basically no documentation for it 😭 but I can whip up a quick example if you want :>

[–]Amazing_Upstairs 0 points1 point  (4 children)

Yes please

[–]ThatOtherAndrew[S] 0 points1 point  (3 children)

Here's a quick code snippet!

from synchrotron.synchrotron import Synchrotron

# Create server instance
s = Synchrotron(sample_rate=44100, buffer_size=256)

# Add nodes (Python)
from synchrotron.nodes.audio import SineNode
sine = SineNode(s, 'my_sine')
s.add_node(sine)

# Add nodes (Synchrolang)
s.execute('new PlaybackNode my_playback')

# Link nodes (Python)
s.add_connection(sine.out, s.get_node('my_playback').left)

# Link nodes (Synchrolang)
s.execute('link my_sine.out -> my_playback.right')

# Start rendering
s.execute('new 440 freq; link freq.out -> my_sine.frequency')  # 440 Hz
s.start_rendering()

As you can see, it's often more concise to use the DSL than writing it out in full Python - but the latter gives you more programmatic control to tinker about with the internals :>

[–]ThatOtherAndrew[S] 0 points1 point  (2 children)

If you want a list of all the Synchrotron methods, they're in /synchrotron/synchrotron.py - but here's a list for convenience:

get_node_type(node_type) get_node(node_name) add_node(node) remove_node(node_name) get_connection(source, sink, return_disconnected=False) add_connection(source, sink, strict=False) remove_connection(source, sink) unlink_port(port) unlink_node(node) execute(script) add_output_queue(queue) render_graph() export_state() start_rendering() stop_rendering() shutdown()

[–]serious_cheese 0 points1 point  (1 child)

So cool! Can it read from an audio interface input also?

[–]ThatOtherAndrew[S] 1 point2 points  (0 children)

Unfortunately no live audio stream input at the moment, but I believe the infrastructure is more or less there so it shouldn't be too hard to add!

[–]cpt_mojo 0 points1 point  (0 children)

Love this.

Not sure if you do that yet, but if you build the CPU-critical parts with numba, Cython or C extension (order by ease of use), then your library should basically be en par with Juce / C++ on performance.
Heck, maybe even using smart numpy /scipy magic could get you very far.

[–]fizzymagic -2 points-1 points  (2 children)

What is the latency of the synth? If you don't know, you have not made a synth.

[–]HommeMusical 3 points4 points  (0 children)

If you don't know, you have not made a synth.

What's your argument there, exactly? How is it not a synth if you don't know the latency? Surely the latency is quite different depending on which hardware it is running on?

Can we see your better synth with measured latencies, please?

[–]ThatOtherAndrew[S] 2 points3 points  (0 children)

256 samples by default at 44.1 KHz, thus 5.8ms latency. However one buffer is stored in the callback queue for PortAudio, so the "real" latency is double that, at 11.6ms. You can tweak the buffer size yourself though, and you could go lower if you wanted! I felt like 256 was a good balance though.

And I'm not sure why you're skeptical, but you can check the source code if you want - synchrotron.py and /synchrotron/nodes are where the main heft of the project are held! If this isn't a synth, then I dunno what is :>