mpulse

mpulse — Generates a set of impulses.

Description

Generates a set of impulses of amplitude kamp separated by kintvl seconds (or samples if kintvl is negative). The first impulse is generated after a delay of ioffset seconds.

Syntax

ares mpulse kamp, kintvl [, ioffset]

Initialization

ioffset (optional, default=0) -- the delay before the first impulse. If it is negative, the value is taken as the number of samples, otherwise it is in seconds. Default is zero.

Performance

kamp -- amplitude of the impulses generated

kintvl -- Interval of time in seconds (or samples if kintvl is negative) to the next pulse.

After the initial delay, an impulse of kamp amplitude is generated as a single sample. Immediately after generating the impulse, the time of the next one is determined from the value of kintvl at that precise moment. This means that any changes in kintvl between impulses are discarded. If kintvl is zero, there is an infinite wait to the next impulse. If kintvl is negative, the interval is counted in number of samples rather than seconds.

Examples

Here is an example of the mpulse opcode. It uses the file mpulse.csd.

Example 514. Example of the mpulse opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o mpulse.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

gkfreq init 0.1

instr 1
  kamp = 10000

  a1 mpulse kamp, gkfreq
  out a1
endin

instr 2
; Assign the value of p4 to gkfreq
gkfreq init p4
endin
</CsInstruments>
<CsScore>

; Play Instrument #1 for one second.
i 1 0 11
i 2 2 1    0.05
i 2 4 1    0.01
i 2 6 1    0.005
; only last notes are audible
i 2 8 1    0.003
i 2 10 1    0.002


e


</CsScore>
</CsoundSynthesizer>


See Also

Another example of how to use mpulse can be found here: mode

Credits

Written by John ffitch.

New in version 4.08