Code Monkey home page Code Monkey logo

Comments (2)

ssfrr avatar ssfrr commented on June 23, 2024

In general, yes, play(node::AudioNode) adds the node to the render chain, and other methods of play typically wrap the thing inside an AudioNode and then call play on that node.

Also, correct that returning a short buffer in a render call is an indication that the node has no more content and it's done.

I agree the way the input is handled in the render tree is not obvious, but you can think about it in a functional context, where you're calling the render function with the input as one of the arguments. Most AudioNodes ignore the root input, but the InputRenderer just returns it, sort of looping it around.

Maybe I'm being dense but I'm not sure what issue you're describing. Do you have a more complete example that shows the issue? ArrayRenderer shouldn't be feeding input into an InputRenderer, and the assertion you're referring to is making sure that the block from the hardware input is the same
size as the hardware block size, which it should be.

from audioio.jl.

goretkin avatar goretkin commented on June 23, 2024

In general, yes, play(node::AudioNode) adds the node to the render chain, and other methods of play typically wrap the thing inside an AudioNode and then call play on that node.

My specific confusion regarding that point is that InputNode really just passes through the audio signal. so play(AudioInput()) plays back the audio input only because the hardware input is passed through InputNode. I found the name play misleading, because if what you do is, for example play(a_node_that_stores_all_its_input), then you're actually recording an audio stream. I don't think the name necessarily has to change, though.

It just seems like nodes that take in audio and produce audio should be able to be composed together, and so there should be some specification, maybe, for what a node needs to be in order to be composed together. For example, maybe I test an FM modulator, say SinOsc(40*AudioInput()+400) by attaching its input to the output of ArrayRenderer (using something like https://github.com/goretkin/AudioIO.jl/blob/master/src/nodes.jl#L508). You can argue that instead of using ArrayRenderer you should have something like an ArrayStream.

Similarly, something else that confused me initially, but I think I've come around, is that device_input really does mean device_input. Nodes should be able to have multiple inputs, and so control inputs, like to control the frequency of SinOsc probably are better off, as currently is, as nodes that are passed to nodes, and the higher node is responsible for calling render on the lower node, passing device_input.

(Along the lines of "contract" it might be worthwhile to state that if nodes need long-term access to values in device_input, or any output of render, then they should make a copy. Also, something should be written about how signals are "pulled" through instead of "pushed" through (or something like that).)

I think the package is really great! I've had a lot of fun.

from audioio.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.