Comments (13)
Hey Elliott. Yeah, I forgot about this on moving over. Probably the solution for the moment is a new node which subclasses PassThroughNode and fills a fixed length buffer in its tick method. Then you should be able to use it in the same way as before, just grabbing data from the buffer and visualising it.
I can have a look at some point in the next week or so, but if you fancy having a shot at fixing it then feel free to ask any questions here, and chuck in a pull request.
Thanks for the report,
Joe
from audiolet.
That makes sense. However, I'd like to be able to show a visualization for any arbitrary node. Short of adding a fixed length buffer back into every node purely for visualization, is there a sensible way to accomplish this? It may be that this is outside the general scope of the library, in which case I suppose I'll have to do it in a fork.
Thanks for the quick reply and any other info you can offer,
Elliott
from audiolet.
Other than adding a fixed length buffer to each node I can't really think of how you could do this. It's a bit of an unfortunate consequence of shifting to single sample ticking (although visualising the variable length buffers wasn't ideal when working with blocks).
You can probably monkey-patch the behaviour into the base AudioletNode fairly simply though. So something like this would probably do what you want:
AudioletNode.prototype.tick = function() {
// First three lines are the standard AudioletNode tick method
this.createInputSamples();
this.createOutputSamples();
this.generate();
// This is where we make sure each node stores a visualisation buffer
if (!this.buffer) {
// Create this.buffer to store the samples here
}
// Push a sample from an output into this.buffer here
};
Hope this helps,
Joe
from audiolet.
Okay, thanks. I'll give that a shot. I'd like to switch to single-sample so
that I can use the FFT stuff when that's all wrapped up, I just can't lose
the visualizations!
If you think it'll be useful for others, I can put up a pull request if I
get it ironed out. If not, then I'll just keep a fork around.
Thanks again,
Elliott
On Fri, May 25, 2012 at 1:21 AM, Joe Turner <
[email protected]
wrote:
Other than adding a fixed length buffer to each node I can't really think
of how you could do this. It's a bit of an unfortunate consequence of
shifting to single sample ticking (although visualising the variable length
buffers wasn't ideal when working with blocks).You can probably monkey-patch the behaviour into the base AudioletNode
fairly simply though. So something like this would probably do what you
want:AudioletNode.prototype.tick = function() { // First three lines are the standard AudioletNode tick method this.createInputSamples(); this.createOutputSamples(); this.generate(); // This is where we make sure each node stores a visualisation buffer if (!this.buffer) { // Create this.buffer to store the samples here } // Push a sample from an output into this.buffer here };Hope this helps,
Joe
Reply to this email directly or view it on GitHub:
#33 (comment)
from audiolet.
I think this is a fairly specific case (being able to simultaneously visualise all nodes), so it's probably best in a fork given that there is some processing and memory overhead associated. I do think there should probably be a separate node used for visualisation so we're not losing functionality, so I'll keep the bug open until that's in place.
Cheers,
Joe
from audiolet.
hey, I'm trying to add a visualizer to an audiolet test, and I've reduced the code down to a simple sinewave. I cannot get this to visualize no matter what I try. I have looked at the example but it's not working, tried the suggestions here, and also tried using webaudio's real time analyser like this
analyzer = audiolet.output.device.sink._node.context.createAnalyser()
data = new Uint8Array(analyzer.frequencyBinCount)
analyzer.getByteFrequencyData(data)
// data is [0,0,0 ...]
what would be the best way to visualize audiolet?
from audiolet.
I forked and added a buffer for visualization to each node. You can look at the specifics here: https://github.com/ewdicus/Audiolet. Then I'm plotting it using Canvas and Javascript.
from audiolet.
great man! I'll use that. thanks!
from audiolet.
I should clarify, I haven't updated the examples there. I've just made the changes to the code. If you need help figuring it out, let me know.
from audiolet.
I have collected the vizData successfully with your branch, but my visualizer needs a lot of work, lolz
thanks!
from audiolet.
Just a quick note that this probably falls under the Audiolet 2 remit now, where you will be able to use the RealTimeAnalyserNode.
from audiolet.
@oampo, ok, I'll give this a test run tomorrow...
@ewdicus so, I found a slight bug with your code...
(coffeescript syntax - contrived example)
sine_l = new Sine @audiolet, 440
sine_r = new Sine @audiolet, 440
pan_l = new Pan @audiolet, 0
pan_r = new Pan @audiolet, 1
sine_l.connect pan_l
sine_r.connect pan_r
vol_l = new Gain @audiolet, 0.1
vol_r = new Gain @audiolet, 0.1
pan_l.connect vol_l
pan_r.connect vol_r
vol_l.connect @audiolet.output
vol_r.connect @audiolet.output
vol_r.visBuffer.channels[0]
will be correct, however vol_l.visBuffer.channels[0]
will be filled with basically zeros (very small floats)
I'm not sure what the problem could be, and I may not even be using audiolet correctly, connecting stuff, but either way, I think it's time for me to call it a night... look at it tomorrow... gg guys!
from audiolet.
@heavyk The code to make it work in the version-2 branch isn't quite ready yet. I'll ping you when you can try it.
Joe
from audiolet.
Related Issues (20)
- Retrieving Output Buffer from a Node HOT 5
- ADSREnvelope doesn't allow attack, etc. to be changed at runtime HOT 1
- Optimise createInputSamples and createOutputSamples
- chrome 21 problems getting sinks HOT 12
- amd compatibility HOT 2
- Uncaught No audio sink available. again? HOT 12
- build and dist creating bad files HOT 1
- add "midi" sequencing support
- not require audiolet instance passed to all new objects HOT 8
- Audio Channel routing HOT 4
- Emit parameter change events for dynamic parameters.
- More node events HOT 2
- Missing audiofile.js HOT 1
- Sample player and FFT HOT 2
- Visualization fails in chrome
- [enhancement] Add missing bower.json.
- Example code pops/skips and bufferFill runs forever. HOT 1
- Audiolet stop working on blink browser (Chrome & Opera) HOT 3
- commonjs support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audiolet.