Git Product home page Git Product logo

Comments (3)

stuartmemo avatar stuartmemo commented on July 29, 2024

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.

DavidSabine avatar DavidSabine commented on July 29, 2024

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.

stuartmemo avatar stuartmemo commented on July 29, 2024

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)

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.