gaWaveFrequency(int,float)

Syntax

gaWaveFrequency(int,float)

Example

dim = BUFFER_SIZE*AUDIO_OUTPUT_CHANNELS
outputBuffer = memarray('float', dim)
stretch = OUTPUT_W/(dim-1)
zeroOffset = OUTPUT_H/4

randFreq = {}
randVol = {}
function setup()
 for i=0, 10 do
 gaWave(GA_SAW,4*i)
 randVol[i] = ofRandom(0.6,1.0)
 randFreq[i] = ofRandom(0.1,70.0)
 end 
 
 // init the buffer
 for i = 0, dim - 1 do
 outputBuffer[i] = 0.0 
 end
end

function update()
 for i=0, 10 do
 gaWaveVolume(i,randVol[i])
 gaWaveFrequency(i,randFreq[i]*gaMouseX())
 end
 
 for i = 0, dim - 1 do
 outputBuffer[i] = gaGetOutputBuffer(i) 
 end
end

function draw()
 gaBackground(0.0,1.0)
 
 ofTranslate(0,OUTPUT_H/2,0)
 // draw Audio Scope
 ofSetColor(255)
 ofNoFill()
 ofBeginShape()
 for i = 0, dim - 1 do
 ofVertex(i* stretch, outputBuffer[i] * zeroOffset)
 end
 ofEndShape(false)
end

Description

Set the frequency for the specified, previously created, wave oscillator. Frequency is represented in Hz (20 - 20000) range. When an oscillator is created it's automatically indexed with a number id, starting from 0; so if you have created 100 oscillator, the first one will have an id of 0 and the last one an id of 99.

Parameters

int,float