About This Guide
This Application Note explains the use of the Rand Sequencer module in the Audio Weaver Application.
The Rand Sequencer Module
The Rand Sequencer module can be found in the Sound Design/Control folder or by using the search window in the module browser. It is called “Rand Sequencer”.
...
Figure 1. Location in Module Browser
...
Figure 2. Layout view
How it works
Upon reset, A vector of random integers is generated and divided into two halves. Individual increment inputs step through each half independently and the selected values are output on pins A and B.
...
Internal variables IndexA and IndexB are incremented by the incA and incB inputs, respectively. The individual indices are used to read the entry from the corresponding sequence and present it at the corresponding output. When either index is incremented from (seqLength/2 - 1), IndexA and IndexB are both reset to 0 and the random vector is regenerated.
incA and incB
The incX inputs expect an integer source. The index is incremented every time the corresponding incX pin’s value increases by 1. To increment the index once per cycle, use an input signal that varies between 0 and 1. The index will increment on the 0 to 1 transition. You can also use an integer counter such as the Counter module, which will insert a pause (index not incremented) when the counter wraps around to zero.
Module arguments
seqLength | Length of the randomized sequence |
Module variables
reset | Resets the random sequence on a 0 – 1 transition. |
Sample Layout – Dual Random Wave File Sequencer
View file | ||
---|---|---|
|
...
View file | ||
---|---|---|
|
Overall Design
The sample layout includes two One Shot Wave Players, trigger generation logic, and the Rand Sequencer. The included set of wave files are the words “one”, “two”, “three” and so on, so what you will hear from the left and right channels corresponds to the values of outputs A and B respectively.
...
Let’s look at this one section at a time.
Dual Random Sequencer
...
Figure 5. Dual Random Sequencer and Clock
...
This is described in more detail in the WaveOneShotPlayerFlash1 application note.
Trigger Generator
...
Figure 11. Trigger Generator
...
Figure 14. DC3 Arguments - sampleRate
Wave File Selector
...
Figure 15. Setting the WAV file name
...
Figure 16. Arrayset1 Properties
Delayed Trigger to Wave Player
When the fileName of the WaveOneShotPlayerFlash1 module is updated by the ArraySet1 module, a delay is required before you can reliably trigger the new WAV file. The amount of delay depends on:
...
Figure 18. Timing Diagram
The WavePlayerOneShotFlash module
...
Figure 19. WavePlayerOneShotFlash module
...
Figure 20. isPlaying signal
View outputs A & B
Another optional Sink Display is added so that you can watch the Rand Sequencer's A and B outputs while listening to the audio output.
...