Is the second argument in connect() indefinite or limited to 0-5 - web-audio-api

If you want to use channel splitters and/or channel mergers you need to use the second and third arguments in the connect(node,0,0) method.
I want to know if these numbers are limited to 5 channels or if these arguments are indefinite numbers.
splitter.connect(node,0) // is this number limited to 0-5 ?
It seems like the spec should be indefinite to handle odd multi channel file types but it seems that it is relegated to 6 channels and less.

A splitter node can have as many channels as you want (up to some limit). You have to specify how many when you create the splitter. The default is 6. See http://webaudio.github.io/web-audio-api/#widl-BaseAudioContext-createChannelSplitter-ChannelSplitterNode-unsigned-long-numberOfOutputs

Related

Why is 8086 control bus 4 bits?

I was wondering why 8086 control bus consists of 4 lines I/O read/write and Mem read/write.
These are clearly 4 different functions that can be determined using only 2 lines. In this geeksforgeeks link we can clearly see that RD is the not operation of WR
It is common in hardware to use 1-hot control signals here one line for read & one line for write, instead of one encoded line for both (i.e. one line where read=0, write=1).
When signals are packed/encoded as you suggest, i.e. 2 bits represents 4 values, they generally have to be decoded into 1-hot before they can activate the intended hardware circuitry.
So, here apparently, instead of encoding and decoding, they simply expose the 4 different 1-hot lines.
Most importantly, however, two lines (one for read and one for write) allows for saying read, write, or no operation on a given bus cycle.  So, there's really three different values (or six for both I/O and memory), and these cannot even be encoded in 1 (or 2) bits (but could be in 2 (or 3 bits)).
(Yes, it also allows for dual operation read=1 and write=1, but this is understood to be bad and no one will do it.)

Structuring an experiment with psychtoolbox

I have a design for an experiment that I would like to code in psychtoolbox using MATLAB. I understand the basics of how to use this toolbox however it would be extremely helpful if someone has designed a similar experiment before and could provide me with some code that could help me to carry out the following:
The experimental procedure will be composed of 80 trials divided into 5 blocks with 16 trials in each block. The experiment consists of the participant selecting a number from the screen. There is a desirable number (target number) and an associated less desirable number (lure number). I won't go into further detail about the reasoning behind this experiment as it is not relevant to my question.
I have attached an image that shows 1 block of trials (16 trials). The other 4 blocks are the same as this block.
Target and lure numbers will be presented on the screen to choose from (an example can be seen in image below).
In some of the trials as can be seen from the trials table only one target number and one lure number are presented for the participant to choose from (instead of two targets and two lures).
The lure(s) that appears with each target(s) should not always be the same. I want the lure that is shown with the target to be randomly selected in each trial (as can be seen in the trials image there is more than one possible lure). In the trials image I have attached the trial numbers are presented just for clarity, in each block the presentation of the targets needs to be randomized.
You can use the BalanceTrials function that comes with psychtoolbox. You use all the possible lures and targets as inputs and it returns a random order of all possible combinations. You can also specify a minimum length of the list it returns, but if there are more combinations it will make the list longer to make it balanced. Here is an example:
numberOfTrials = 80;
targetNumbers = {'3','4','5','6','7','4 5','4 6','4 7'};
lureNumbers = {'3','4','5','6','7','4 7'};
[targets, lures] = BalanceTrials(numberOfTrials, 1, targetNumbers, lureNumbers);
You can split this up into 5 blocks or you do it each time for each block.

How can I mix multiple stereo signals to one with WebAudio?

I'm writing a web app which needs to combine a number of stereo sounds into one stereo output, so I want an equivalent of gstreamer's audiomixer element, but there doesn't seem to be one in WebAudio. ChannelMerger doesn't do quite the same thing - it combines multiple mono signals into one multi-channel signal.
The documentation for AudioNode.connect says that you can connect an output to multiple inputs of other nodes and that attempts to connect the same output to the same input more than once are ignored. But it doesn't say what will happen if you try to connect multiple different outputs to the same input. Would that act as a simple mixer like I want? I suspect not, because what splitting/merging functionality WebAudio does provide (see ChannelMerger above) seems to mostly be based on converting between multiple mono signals and one multi-channel signal with a one channel to one mono signal mapping.
I could take an arbitrary node (I guess a GainNode would work, and I could take advantage of its gain functionality) and set its channelInterpretation mode to "speakers" to actually mix channels, but it only works for 1, 2, 4 or 6 inputs. I'm unlikely to need more than 6, but I will definitely need to be able to handle 3, and possibly 5. That could be done by using more than one mixer (eg for three channels mix inputs 1 and 2 in one mixer, then mix its output with input 3 in a second mixer), but I think I would have to add more GainNodes to balance the mix correctly. A mixer presumably has to attenuate each input to prevent coincident peaks from clipping out of range, so with chained mixers without compensation I'd end up with 1/4,1/4,1/2 instead of 1/3,1/3,1/3?
You almost got it right. Use a single GainNode and connect each source to the single input to the GainNode. This will sum up all of the different connections and produce a single output. If you know all of the individual sources are stereo, you don't need to change anything about the channelInterpretation, channelCountMode, or channelCount to get what you want.
You will probably have to adjust the gain value of the GainNode to reduce the output volume so that you don't overdrive the output device.
Other than, this should all work.

How does feature bits work in vowpal wabbit

I am relatively new to vowpal wabbit and would like to find out about the -b parameter (feature bits in feature table).
My training data are something like this. There are a total of about 1 million words.
1 | a = "word" b ="word131232" c="word1233" d = "word123124" e = "word23145"
However, each row would only have 5 features. how many bits should i use? I tried to run it and it seems with an increasing number of examples, the number of features set seem to increase. I do not seem to understand why is this so.
If you use -b 18 (which is the default), the features will be hashed into a table with 2^18 items, so if the number of unique features in your dataset is close to 2^18 (or even higher), you should increase the parameter -b, so there are not so many hash collisions. There is no easy way how to detect the number of collisions, but the common practice is to tune the parameter -b for a best progressive validation loss (or holdout loss if you use more passes). Of course, it also depends on the available memory on your machine.
1 | a = "word" b ="word131232" c="word1233" d = "word123124" e = "word23145"
Note that this example is wrong (not what you intended) because of the spaces around =. The equal sign has no special meaning (unlike colon which is used for separating the feature value). Features cannot contain space in their name. There is no need to enclose feature names in quotes. So the example should look like
1 | word word131232 word1233 word123124 word23145
If the prefix a, b, c, d, e has some special meaning (i.e. a=word42 should be a different feature than b=word42) you can use:
1 | a=word b=word131232 c=word1233 d=word123124 e=word23145
If all your words are already mapped to integers (within the range 0-2^b), you can use them directly as feature names and no hashing will be done (unless you specify --hash=all):
1 | 0 131232 1233 123124 23145
See the wiki page about input format.
the number of features set seem to increase
In the progress report (by default each 2^x th example), in the last column you can see current features, which is the number of features for the current example (including the constant feature and quadratic/cubic/... features if you use them) and it should not be increasing (unless you have such strange data).
In the final report, vw prints total feature number, which is the average number of features per example times the number of examples times the number of passes (so it is not the number of unique features in the dataset).

Calculate significance for DNA binding motifs found vs. expected in MATLAB

I have a set of say, 100, genomic features for which I've created a fasta file with a 500 bp window around each. I've searched these windows for a DNA sequence and found an average of 1.5 sequences per individual 500 bp window in the feature set. By chance, I expect the sequence to be present once every 1024 bp, or on average ~0.49 of my sequence per 500 bp window.
My question is how can I determine whether the 1.5 binding sites per individual feature I've uncovered is significant or not, and obtain a p-value?
And as a follow up, if I use the same set of 100 windows and search for a different sequence with the same probability (1/1024) and determine that there are now an average of 0.9 sequences per individual window, how can I determine whether this is significantly different than the 1.5 for the sequence for which I searched above?
As a second follow up, if I search for the same two sequences above (both found on average 1/1024 base pairs) in a different set of 500 bp windows for a different feature type (say, n=50), how can I determine if the results of this search are significantly different than the results above (particularly if the difference between sequence A and sequence B in feature set 1 and feature set 2 is significant)?
Thank you in advance.
I ended up using simulations to answer all of the above questions. Generate windows of desired size, 500 bp in this case, of random genomic sequence. Search for motifs in X windows (where X = number of individuals in a feature set) and compare with results obtained searching for motifs in the features of interest. To Repeat with sample size equal to that of the second feature set being analyzed. To compare features with one another, do the analogous simulation and compare results.