pvsosc — PVS-based oscillator simulator.
Generates periodic signal spectra in AMP-FREQ format, with the option of four wave types:
Complex waveforms (ie. all types except cosine) contain all harmonics up to the Nyquist. This makes pvsosc an option for generation of band-limited periodic waves. In addition, types can be changed using a k-rate variable.
fsig -- output pv stream set to zero.
isize -- size of analysis frame and window.
ioverlap -- (Optional) size of overlap, defaults to isize/4.
iwinsize -- (Optional) window size, defaults to isize.
iwintype -- (Optional) window type, defaults to Hanning. The choices are currently:
0 = Hamming window
1 = von Hann window
iformat -- (Optional) data format, defaults to 0 which produces AMP:FREQ data. That is currently the only option.
kamp -- signal amplitude. Note that the actual signal amplitude can, depending on wave type and frequency, vary slightly above or below this value. Generally the amplitude will tend to exceed kamp on higher frequencies (> 1000 Hz) and be reduced on lower ones. Also due to the overlap-add process, when resynthesing with pvsynth, frequency glides will cause the output amplitude to fluctuate above and below kamp.
kfreq -- fundamental frequency in Hz.
ktype -- wave type: 1. sawtooh-like, 2.square-like, 3.pulse and any other value for cosine.
Here is an example of the pvsosc opcode. Play pvsosc.csd
Example 851. Example of the pvsosc 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 -odac -m0 ;;;realtime audio out ; For Non-realtime ouput leave only the line below: ; -o pvsosc.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 0dbfs = 1 nchnls = 2 ; example by Menno Knevel 2021 instr 1 ; a band-limited sawtooth-wave oscillator prints "\nsawtooth-wave\n" fsig pvsosc .5, 440, 1, 1024 ; generate wave spectral signal asig pvsynth fsig ; resynthesise it outs asig, asig endin instr 2 ; a band-limited square-wave oscillator prints "\nsquare-wave\n" fsig pvsosc .5, 440, 2, 1024 ; generate wave spectral signal asig pvsynth fsig ; resynthesise it outs asig, asig endin instr 3 ; a pulse oscillator prints "\npulse-wave\n" fsig pvsosc .5, 440, 3, 1024 ; generate wave spectral signal asig pvsynth fsig ; resynthesise it outs asig, asig endin instr 4 ; a cosine-wave oscillator prints "\ncosine-wave\n\n" fsig pvsosc .5, 440, 4, 1024 ; generate wave spectral signal asig pvsynth fsig ; resynthesise it outs asig, asig endin instr 5 ;cycle ktyp randh 2, 10 fsig pvsosc .5, 440, int(ktyp+3), 1024 ; make it to go from 1-4 printks2 "\ncycle through all waves...: %d\n", int(ktyp+3) asig pvsynth fsig outs asig, asig endin </CsInstruments> <CsScore> i 1 0 1 i 2 2 1 i 3 4 1 i 4 6 1 i 5 10 4 e </CsScore> </CsoundSynthesizer>