Comments (3)
Oh, let me look into it. Maybe the documentation isn't right. It currently works as in the tests:
https://github.com/stuartmemo/theresas-sound-world/blob/master/tests/tests.js
Starts line 352.
Saying that, would love your feedback on what syntax you prefer on loading files. I'm not 100% on what I've done.
from theresas-sound-world.
Hi Stuart,
I did see your tests.js file -- it appears that you're testing the tsw.load function with only two arguments:
describe('Load files', function () {
var my_success;
it('Load some mp3s', function (done) {
tsw.load({
files: {
sampleOne: 'samples/tsw1.mp3',
sampleTwo: 'samples/tsw2.mp3',
sampleThree: 'samples/tsw3.mp3',
}
}, function (success) {
my_success = success;
done();
});
});
Though the documentation http://theresassoundworld.com/#load allows for three args (the second being "path"):
tsw.load(
{
talking: 'talking-sample.mp3',
singing: 'my-lovely-singing.mp3'
},
{
path: '/path/to/files/'
},
function (response, status, xhr) {
if (status === 'success') {
// Files have loaded successfully
tsw.play(response.talking);
} else {
// There's been an error
console.log('We have a technical: ' + xhr.statusText);
}
}
);
Being able to define a path may be helpful, though not essential.
As far as syntax is concerned, I like what you've designed but I'm currently unclear how I can access the buffers after they're loaded -- that is, I'm not currently understanding how I can pass buffers to tsw.play() when I'm not inside the successCallback function. I think I should want access to an array of buffers that are available in the current audioContext -- maybe you've already implemented something this and I simply need to study more. I have something like this in mind (totally over-simplified, please forgive me):
// on DOMContentLoaded I'd like to load some buffers like:
var tsw.buffers = new Array();
tsw.buffers = tsw.load(anArrayOfUrls);
// at any time, I'd like to be able to add new buffers, maybe like:
tsw.buffers.push(tsw.load(aStringOfUrl));
// at any time, I'd like to be able to control all or individual buffers - somewhat like audio objects (gain, etc.), and somewhat like an array (push, splice, pop, etc), maybe like:
tsw.buffers.play(aTime,booleanLoop);
tsw.buffers.pan(0);
tsw.buffers[0].pan(-1);
tsw.buffers.gain(0.3);
tsw.buffers.remove(tsw.buffers[0]);
PLEASE don't heed my input too much though. I have more trust in your JavaScript knowledge than my own.
from theresas-sound-world.
Ooh, that's a really good idea regarding the buffers. Currently you have to create a buffer using var my_buffer = tsw.buffer();
then assign the loaded buffer into my_buffer.
But like you say if buffers was a special array that converted a file into a playable buffer automatically then that'd be pretty nice!
from theresas-sound-world.
Related Issues (18)
- No support for noteOn(0)
- tsw.phaser() doesn't work HOT 1
- tsw.panner() doesn't work. HOT 1
- Should be able to specify audio parameter transition type HOT 1
- Should be a way of recording and exporting audio made using tsw.
- FadeIn / FadeOut not working in Firefox HOT 4
- Add http://theresassoundworld.com as the URL on GitHub HOT 1
- Should be able to pan panner node in real-time HOT 1
- Can't schedule panning HOT 1
- Should be able to pass note name to oscillator
- isBrowserSupported should be a function HOT 1
- envelopes? HOT 2
- tsw.midiNote doesn't return midi note number HOT 1
- tsw.noise() doesn't work HOT 1
- Implement tsw.note get musical note from frequency
- Error - tsw.js:42 Uncaught TypeError: Cannot create property 'value' on number '0' HOT 1
- missing effects wav files HOT 3
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 theresas-sound-world.