Thursday 15 April 2010

javascript - Web Audio API, setting treble and bass -


I'm trying to learn how to use and how to fix our audio AP and I'm running into some confusion. / P>

In my project, I click on the link to see an old 1 9 82 of'm trying to replicate the functionality (Photo) < / P>

In this receiver there are separate dials for treble and bass control. I am going to deal with treble in this question. I'm sure I can understand the bass equivalent after being pointed in the right direction.

In an initialization function I make reference and filter nodes.

  Window.AudioContext = window.AudioContext || Window.webkitAudioContext; Context = new audiocontent (); Source = context.createMediaElementSource (document.getElementById ('audio')); GainNode = context.createGain (); // filter nodes bassTurnoverFilter = context.createBiquadFilter (); TrebleTurnoverFilter = context.createBiquadFilter (); LoudnessTrebFilter = context.createBiquadFilter (); LoudnessBassFilter = context.createBiquadFilter (); TrebleLevelFilter = context.createBiquadFilter (); Basel Filters = Reference.CreatebiquidFilters ();  

I am currently using to control the dial. Dial work and when the dial starts from 0% to 100% I can get a limit for the "treble" variable between 0 and 1.

Dial is currently MouseMove function I'm using to treble:

  .on ( "MouseMove", function (event) {var Double = (event. target.rotation + 140) / 280, if (trebleLevelFilter undefined ==) {trebleLevelFilter !. disconnect ();} source.connect (trebleLevelFilter); trebleLevelFilter.type = "highshelf"; trebleLevelFilter.frequency.value = 200; trebleLevelFilter. Gain.value = treble; trebleLevelFilter.connect (context.destination);});  

My question is, or multi-part question ... 6 Which of the 6 types should I use? ( "lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "allpass" "growing", "Mark",) I It is estimated that it is highpass or higher.

What frequency should I set?

What movement should be on when the dial is turned on? What is the price?

Am I going completely in the wrong direction?

I have the benefit. The value is set on the triple variable value, and it seems that this volume is increasing 100% ... but I do not think this is the right functionality which I am trying to accomplish.

I'm not sure why you are making six different filters - you only have two, treble For one more bass is a must.

I Think that H.K. Seeing there is no midrange control - which is a bit awkward, but okay. The possibility of bass filter is less shelf, and the treble is a high shelf; Remember what the cutoff frequency is for each button control, the shelling filter is flat response on zero profit - you can play with the filter to see how they will look. Select a low shelf, freq = ~ 200, and then play with the edge. Of

So, for example, you close with a triple filter, "treble" and "bass" gain values ​​shouldn except 'to T [0,1] - it [-makson + Maksgen] Should go between. "MaxGen" is probably 2-3? You have to play with it and choose a good category - I do not know that in the HK manual () It is also quite important to connect the filter in series, not parallel (otherwise you will have phase problems).

  // If the treble = 0 and bass = 0 you will have a flat response basfilter = reference. Cracketbiquidfilter (); Basfilter. Type = "loose"; Basfilter.fuquency.value = 200; // UI bassfilter switches gene from 400. Value = bass; // You will also need to hook the UI to trebleFilter = context.createBiquadFilter (); TrebleFilter.type = "highshelf"; TrebleFilter.frequency.value = 2000; // up to 6000 switches filter gear in UI Treble Value = treble; // You should also hook it to the UI. Connect (basfilter); BassFilter.connect (trebleFilter); TrebleFilter.connect (context.destination); In addition, there is no reason to disconnect the filter and reconnect it - you can make live changes in gain.value when adding it. 


No comments:

Post a Comment