Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

'T("undefined") is not defined' console error message #22

Closed
ghost opened this issue Jun 9, 2014 · 4 comments
Closed

'T("undefined") is not defined' console error message #22

ghost opened this issue Jun 9, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 9, 2014

While trying to set the freq of a simple synth within a NoUiSlider function, timbre is printing a 'T("undefined") is not defined' error printed to the console.

When setting the freq explicitly as the below commented out line, there is no issue.

             var value = 0;
                    $(function(){
                        $('.slider').noUiSlider({
                            start: 40,
                            range: {
                                'min': 0,
                                'max': 500
                            }
                        });
                    });
                    $('.slider').on({
                        slide: function(){
                            value = $('#slider').val(); 
                                synth1.set({freq:value});
                                        // synth1.set({freq:500});
                        }
                    });

This may or may not be an issue with timbre.js. Please accept my apologies if not.
Thank you for a wonderful library thus far.

http://refreshless.com/nouislider/

@mohayonao
Copy link
Owner

please tell me this output.

$('.slider').on({
  slide: function() {
    value = $('#slider').val();
    console.log(value); // <-- what is this value?
  }
});

and try this selector.

value = $('.slider').val();

@ghost
Copy link
Author

ghost commented Jun 9, 2014

Ah yes - I'm not sure how I missed that selector setting! Thank you for that, it resolved the undefined message.

Looking at the console I now see what the problem was, running the value through a parseInt made the required conversion [value = parseInt(value);]. It appears that T("sin", {freq:100, mul:0.5}).play(); didn't like to receiving floating points. Can synths be declared so that they can?

@mohayonao
Copy link
Owner

Doesn't parseInt return an Integer?

// convert to a Number from a String
value = Number(value);
// or
value = +value;

@ghost
Copy link
Author

ghost commented Jun 10, 2014

Yes it does. I just wasn't sure if you could .set objects via floating point numbers.

The main problems I'm having at the moment are web audio API integration on mobile, and the loading of audio files on mobile (Android), however I feel that's for another discussion.

The original issue was resolved, so will close.

Thanks!

@ghost ghost closed this as completed Jun 10, 2014
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant