\n"],"path":[0,"p5.AudioIn/connect"]}],"disconnect":[0,{"description":[0,"
Disconnect the AudioIn from all audio units. For example, if\nconnect() had been called, disconnect() will stop sending\nsignal to your speakers.
Read the Amplitude (volume level) of an AudioIn. The AudioIn\nclass contains its own instance of the Amplitude class to help\nmake it easy to get a microphone's volume level. Accepts an\noptional smoothing value (0.0 < 1.0). NOTE: AudioIn must\n.start() before using .getLevel().
Returns a list of available input sources. This is a wrapper\nfor \nMediaDevices.enumerateDevices() - Web APIs | MDN\nand it returns a Promise.
\n"],"path":[0,"p5.AudioIn/getSources"]}],"setSource":[0,{"description":[0,"Set the input source. Accepts a number representing a\nposition in the array returned by getSources().\nThis is only available in browsers that support\n \n navigator.mediaDevices.enumerateDevices()
\n"],"path":[0,"p5.AudioIn/setSource"]}]}],"properties":[0,{"input":[0,{"description":[0,""],"path":[0,"p5.AudioIn/input"]}],"output":[0,{"description":[0,""],"path":[0,"p5.AudioIn/output"]}],"stream":[0,{"description":[0,""],"path":[0,"p5.AudioIn/stream"]}],"mediaStream":[0,{"description":[0,""],"path":[0,"p5.AudioIn/mediaStream"]}],"currentSource":[0,{"description":[0,""],"path":[0,"p5.AudioIn/currentSource"]}],"enabled":[0,{"description":[0,"Client must allow browser to access their microphone / audioin source.\nDefault: false. Will become true when the client enables access.
\n"],"path":[0,"p5.AudioIn/enabled"]}],"amplitude":[0,{"description":[0,"Input amplitude, connect to it by default but not to master out
\n"],"path":[0,"p5.AudioIn/amplitude"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.AudioIn"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.AudioIn/amp.mdx"],"slug":[0,"en/p5audioin/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/AudioIn.js"],"description":[0,"Set amplitude (volume) of a mic input between 0 and 1.0."],"line":[0,81],"params":[1,[[0,{"name":[0,"amplitudeAmount"],"description":[0,"An amplitude value between 0 and 1."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.AudioIn"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.AudioIn/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioIn/amplitude.mdx"],"slug":[0,"en/p5audioin/amplitude"],"body":[0,"\n\n# amplitude\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amplitude"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Input amplitude, connect to it by default but not to master out
\n"],"line":[0,6098],"itemtype":[0,"property"],"class":[0,"p5.AudioIn"],"isConstructor":[0,false],"path":[0,"p5.AudioIn/amplitude"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioIn/connect.mdx"],"slug":[0,"en/p5audioin/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect to an audio unit. If no parameter is provided, will\nconnect to the main output (i.e. your speakers).
An object that accepts audio input,\n such as an FFT
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.AudioIn"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.AudioIn/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioIn/currentSource.mdx"],"slug":[0,"en/p5audioin/currentsource"],"body":[0,"\n\n# currentSource\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"currentSource"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,""],"line":[0,6085],"itemtype":[0,"property"],"class":[0,"p5.AudioIn"],"isConstructor":[0,false],"path":[0,"p5.AudioIn/currentSource"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioIn/disconnect.mdx"],"slug":[0,"en/p5audioin/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect the AudioIn from all audio units. For example, if\nconnect() had been called, disconnect() will stop sending\nsignal to your speakers.
Client must allow browser to access their microphone / audioin source.\nDefault: false. Will become true when the client enables access.
\n"],"line":[0,6090],"itemtype":[0,"property"],"class":[0,"p5.AudioIn"],"isConstructor":[0,false],"path":[0,"p5.AudioIn/enabled"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioIn/getLevel.mdx"],"slug":[0,"en/p5audioin/getlevel"],"body":[0,"\n\n# getLevel\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getLevel()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Read the Amplitude (volume level) of an AudioIn. The AudioIn\nclass contains its own instance of the Amplitude class to help\nmake it easy to get a microphone's volume level. Accepts an\noptional smoothing value (0.0 < 1.0). NOTE: AudioIn must\n.start() before using .getLevel().
Smoothing is 0.0 by default.\n Smooths values based on previous values.
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.AudioIn"],"chainable":[0,false],"return":[0,{"description":[0,"Volume level (between 0.0 and 1.0)"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.AudioIn/getLevel"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioIn/getSources.mdx"],"slug":[0,"en/p5audioin/getsources"],"body":[0,"\n\n# getSources\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getSources()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns a list of available input sources. This is a wrapper\nfor \nMediaDevices.enumerateDevices() - Web APIs | MDN\nand it returns a Promise.
\n"],"line":[0,6280],"params":[1,[[0,{"name":[0,"successCallback"],"description":[0,"This callback function handles the sources when they\n have been enumerated. The callback function\n receives the deviceList array as its only argument
\n"],"type":[0,"Function"],"optional":[0,true]}],[0,{"name":[0,"errorCallback"],"description":[0,"This optional callback receives the error\n message as its argument.
\n"],"type":[0,"Function"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.AudioIn"],"chainable":[0,false],"return":[0,{"description":[0,"Returns a Promise that can be used in place of the callbacks, similar\n to the enumerateDevices() method"],"type":[0,"Promise"]}],"example":[1,[[0,"\n\n let audioIn;\n\n function setup(){\n text('getting sources...', 0, 20);\n audioIn = new p5.AudioIn();\n audioIn.getSources(gotSources);\n }\n\n function gotSources(deviceList) {\n if (deviceList.length > 0) {\n //set the source to the first item in the deviceList array\n audioIn.setSource(0);\n let currentSource = deviceList[audioIn.currentSource];\n text('set source to: ' + currentSource.deviceId, 5, 20, width);\n }\n }\n
Set the input source. Accepts a number representing a\nposition in the array returned by getSources().\nThis is only available in browsers that support\n \n navigator.mediaDevices.enumerateDevices()
\n"],"line":[0,6340],"params":[1,[[0,{"name":[0,"num"],"description":[0,"position of input source in the array
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.AudioIn"],"chainable":[0,false],"example":[1,[[0,"\n\nlet audioIn;\n\nfunction setup(){\n text('getting sources...', 0, 20);\n audioIn = new p5.AudioIn();\n audioIn.getSources(gotSources);\n}\n\nfunction gotSources(deviceList) {\n if (deviceList.length > 0) {\n //set the source to the first item in the deviceList array\n audioIn.setSource(0);\n let currentSource = deviceList[audioIn.currentSource];\n text('set source to: ' + currentSource.deviceId, 5, 20, width);\n }\n}\n
Base class for monophonic synthesizers. Any extensions of this class\nshould follow the API and implement the methods below in order to\nremain compatible with p5.PolySynth();
\n"],"line":[0,11149],"chainable":[0,false],"methods":[0,{"connect":[0,{"description":[0,"Connect to p5 objects or Web Audio Nodes
\n"],"path":[0,"p5.AudioVoice/connect"]}],"disconnect":[0,{"description":[0,"Disconnect from soundOut
\n"],"path":[0,"p5.AudioVoice/disconnect"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.AudioVoice"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.AudioVoice/connect.mdx"],"slug":[0,"en/p5audiovoice/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect to p5 objects or Web Audio Nodes
\n"],"line":[0,11181],"params":[1,[[0,{"name":[0,"unit"],"description":[0,""],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.AudioVoice"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.AudioVoice/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.AudioVoice/disconnect.mdx"],"slug":[0,"en/p5audiovoice/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect from soundOut
\n"],"line":[0,11194],"itemtype":[0,"method"],"class":[0,"p5.AudioVoice"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.AudioVoice/disconnect"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.BandPass"],"entry":[0,{"id":[0,"en/p5.sound/p5.BandPass.mdx"],"slug":[0,"en/p5sound/p5bandpass"],"body":[0,"\n\n# p5.BandPass\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.BandPass"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Biquad.js"],"description":[0,"Creates a Bandpass Biquad filter."],"line":[0,164],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the cutoff frequency of the filter"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.BandPass"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.Biquad"],"entry":[0,{"id":[0,"en/p5.sound/p5.Biquad.mdx"],"slug":[0,"en/p5sound/p5biquad"],"body":[0,"\n\n# p5.Biquad\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Biquad"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Biquad.js"],"description":[0,"Filter the frequency range of a sound."],"line":[0,11],"params":[1,[[0,{"name":[0,"cutoff"],"description":[0,"cutoff frequency of the filter, a value between 0 and 24000."],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"type"],"description":[0,"filter type. Options: \"lowpass\", \n \"highpass\", \"bandpass\", \"lowshelf\",\n \"highshelf\", \"notch\", \"allpass\", \n \"peaking\""],"type":[0,"String"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n///kind of Karplus-Strong string synthesis using p5.sound.js\n\nlet noise, lowPass, hiPass, delay, env, gain;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(220);\n textAlign(CENTER);\n textSize(9);\n text('click and drag mouse', width/2, height/2);\n \n noise = new p5.Noise('white');\n env = new p5.Envelope(0);\n lowPass = new p5.Biquad(1200, 'lowpass');\n hiPass = new p5.Biquad(55, 'highpass');\n delay = new p5.Delay(0.0005, 0.97);\n gain = new p5.Gain(0.5);\n noise.disconnect();\n noise.connect(hiPass);\n hiPass.disconnect();\n hiPass.connect(env);\n env.disconnect();\n env.connect(lowPass);\n lowPass.disconnect();\n lowPass.connect(delay);\n\n cnv.mousePressed(pluckStart);\n cnv.mouseReleased(pluckStop);\n cnv.mouseOut(pluckStop);\n describe('A sketch that synthesizes string sounds.');\n}\n\nfunction pluckStart() {\n background(0, 255, 255);\n text('release to trigger decay', width/2, height/2);\n let dtime = map(mouseX, 0, width, 0.009, 0.001);\n delay.delayTime(dtime, 0);\n noise.start();\n env.triggerAttack();\n}\n\nfunction pluckStop() {\n background(220);\n text('click to pluck', width/2, height/2);\n env.triggerRelease();\n}\n
\nCompressor is an audio effect class that performs dynamics compression\non an audio input source. This is a very commonly used technique in music\nand sound production. Compression creates an overall louder, richer,\nand fuller sound by lowering the volume of louds and raising that of softs.\nCompression can be used to avoid clipping (sound distortion due to\npeaks in volume) and is especially useful when many sounds are played\nat once. Compression can be used on indivudal sound sources in addition\nto the main output.
\nThis class extends p5.Effect.\nMethods amp(), chain(),\ndrywet(), connect(), and\ndisconnect() are available.
\n"],"line":[0,10036],"chainable":[0,false],"methods":[0,{"process":[0,{"description":[0,"Performs the same function as .connect, but also accepts\noptional parameters to set compressor's audioParams
\n"],"path":[0,"p5.Compressor/process"]}],"set":[0,{"description":[0,"Set the paramters of a compressor.
\n"],"path":[0,"p5.Compressor/set"]}],"attack":[0,{"description":[0,"Get current attack or set value w/ time ramp
\n"],"path":[0,"p5.Compressor/attack"]}],"knee":[0,{"description":[0,"Get current knee or set value w/ time ramp
\n"],"path":[0,"p5.Compressor/knee"]}],"ratio":[0,{"description":[0,"Get current ratio or set value w/ time ramp
\n"],"path":[0,"p5.Compressor/ratio"]}],"threshold":[0,{"description":[0,"Get current threshold or set value w/ time ramp
\n"],"path":[0,"p5.Compressor/threshold"]}],"release":[0,{"description":[0,"Get current release or set value w/ time ramp
\n"],"path":[0,"p5.Compressor/release"]}],"reduction":[0,{"description":[0,"Return the current reduction value
\n"],"path":[0,"p5.Compressor/reduction"]}]}],"properties":[0,{"compressor":[0,{"description":[0,"The p5.Compressor is built with a Web Audio Dynamics Compressor Node\n
\n"],"path":[0,"p5.Compressor/compressor"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Compressor"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Compressor/attack.mdx"],"slug":[0,"en/p5compressor/attack"],"body":[0,"\n\n# attack\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"attack()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get current attack or set value w/ time ramp
\n"],"line":[0,10152],"params":[1,[[0,{"name":[0,"attack"],"description":[0,"Attack is the amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"time"],"description":[0,"Assign time value to schedule the change in value
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/attack"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/compressor.mdx"],"slug":[0,"en/p5compressor/compressor"],"body":[0,"\n\n# compressor\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"compressor"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The p5.Compressor is built with a Web Audio Dynamics Compressor Node\n
\n"],"line":[0,10068],"itemtype":[0,"property"],"class":[0,"p5.Compressor"],"isConstructor":[0,false],"path":[0,"p5.Compressor/compressor"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/knee.mdx"],"slug":[0,"en/p5compressor/knee"],"body":[0,"\n\n# knee\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"knee()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get current knee or set value w/ time ramp
\n"],"line":[0,10178],"params":[1,[[0,{"name":[0,"knee"],"description":[0,"A decibel value representing the range above the\n threshold where the curve smoothly transitions to the \"ratio\" portion.\n default = 30, range 0 - 40
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"time"],"description":[0,"Assign time value to schedule the change in value
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/knee"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/process.mdx"],"slug":[0,"en/p5compressor/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Performs the same function as .connect, but also accepts\noptional parameters to set compressor's audioParams
\n"],"line":[0,10084],"params":[1,[[0,{"name":[0,"src"],"description":[0,"Sound source to be connected
\n"],"type":[0,"Object"]}],[0,{"name":[0,"attack"],"description":[0,"The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"knee"],"description":[0,"A decibel value representing the range above the\n threshold where the curve smoothly transitions to the \"ratio\" portion.\n default = 30, range 0 - 40
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"ratio"],"description":[0,"The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"threshold"],"description":[0,"The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"release"],"description":[0,"The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/process"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/ratio.mdx"],"slug":[0,"en/p5compressor/ratio"],"body":[0,"\n\n# ratio\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"ratio()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get current ratio or set value w/ time ramp
\n"],"line":[0,10204],"params":[1,[[0,{"name":[0,"ratio"],"description":[0,"The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"time"],"description":[0,"Assign time value to schedule the change in value
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/ratio"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/reduction.mdx"],"slug":[0,"en/p5compressor/reduction"],"body":[0,"\n\n# reduction\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"reduction()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Return the current reduction value
\n"],"line":[0,10277],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"return":[0,{"description":[0,"Value of the amount of gain reduction that is applied to the signal"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Compressor/reduction"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/release.mdx"],"slug":[0,"en/p5compressor/release"],"body":[0,"\n\n# release\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"release()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get current release or set value w/ time ramp
\n"],"line":[0,10252],"params":[1,[[0,{"name":[0,"release"],"description":[0,"The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1
\n"],"type":[0,"Number"]}],[0,{"name":[0,"time"],"description":[0,"Assign time value to schedule the change in value
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/release"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/set.mdx"],"slug":[0,"en/p5compressor/set"],"body":[0,"\n\n# set\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"set()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the paramters of a compressor.
\n"],"line":[0,10112],"params":[1,[[0,{"name":[0,"attack"],"description":[0,"The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1
\n"],"type":[0,"Number"]}],[0,{"name":[0,"knee"],"description":[0,"A decibel value representing the range above the\n threshold where the curve smoothly transitions to the \"ratio\" portion.\n default = 30, range 0 - 40
\n"],"type":[0,"Number"]}],[0,{"name":[0,"ratio"],"description":[0,"The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20
\n"],"type":[0,"Number"]}],[0,{"name":[0,"threshold"],"description":[0,"The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0
\n"],"type":[0,"Number"]}],[0,{"name":[0,"release"],"description":[0,"The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/set"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Compressor/threshold.mdx"],"slug":[0,"en/p5compressor/threshold"],"body":[0,"\n\n# threshold\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"threshold()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get current threshold or set value w/ time ramp
\n"],"line":[0,10228],"params":[1,[[0,{"name":[0,"threshold"],"description":[0,"The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0
\n"],"type":[0,"Number"]}],[0,{"name":[0,"time"],"description":[0,"Assign time value to schedule the change in value
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Compressor"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Compressor/threshold"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Convolver"],"entry":[0,{"id":[0,"en/p5.sound/p5.Convolver.mdx"],"slug":[0,"en/p5sound/p5convolver"],"body":[0,"\n\n# p5.Convolver\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Convolver"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"p5.Convolver extends p5.Reverb. It can emulate the sound of real\nphysical spaces through a process called \nconvolution.
\n\nConvolution multiplies any audio input by an \"impulse response\"\nto simulate the dispersion of sound over time. The impulse response is\ngenerated from an audio file that you provide. One way to\ngenerate an impulse response is to pop a balloon in a reverberant space\nand record the echo. Convolution can also be used to experiment with\nsound.
\n\nUse the method createConvolution(path)
to instantiate a\np5.Convolver with a path to your impulse response audio file.
path to a sound file
\n"],"type":[0,"String"]}],[0,{"name":[0,"callback"],"description":[0,"function to call when loading succeeds
\n"],"type":[0,"Function"],"optional":[0,true]}],[0,{"name":[0,"errorCallback"],"description":[0,"function to call if loading fails.\n This function will receive an error or\n XMLHttpRequest object with information\n about what went wrong.
\n"],"type":[0,"Function"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet cVerb, sound;\nfunction preload() {\n // We have both MP3 and OGG versions of all sound assets\n soundFormats('ogg', 'mp3');\n\n // Try replacing 'bx-spring' with other soundfiles like\n // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'\n cVerb = createConvolver('/assets/bx-spring.mp3');\n\n // Try replacing 'Damscray_DancingTiger' with\n // 'beat', 'doorbell', lucky_dragons_-_power_melody'\n sound = loadSound('/assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n background(220);\n text('tap to play', 20, 20);\n\n // disconnect from main output...\n sound.disconnect();\n\n // ...and process with cVerb\n // so that we only hear the convolution\n cVerb.process(sound);\n}\n\nfunction playSound() {\n sound.play();\n}\n
Connect a source to the convolver.
\n"],"path":[0,"p5.Convolver/process"]}],"addImpulse":[0,{"description":[0,"Load and assign a new Impulse Response to the p5.Convolver.\nThe impulse is added to the .impulses
array. Previous\nimpulses can be accessed with the .toggleImpulse(id)
\nmethod.
Similar to .addImpulse, except that the .impulses
\nArray is reset to save memory. A new .impulses
\narray is created with this impulse as the only item.
If you have used .addImpulse()
to add multiple impulses\nto a p5.Convolver, then you can use this method to toggle between\nthe items in the .impulses
Array. Accepts a parameter\nto identify which impulse you wish to use, identified either by its\noriginal filename (String) or by its position in the .impulses\n
Array (Number).
\nYou can access the objects in the .impulses Array directly. Each\nObject has two attributes: an .audioBuffer
(type:\nWeb Audio \nAudioBuffer) and a .name
, a String that corresponds\nwith the original filename.
Internally, the p5.Convolver uses the a\n\nWeb Audio Convolver Node.
\n"],"path":[0,"p5.Convolver/convolverNode"]}],"impulses":[0,{"description":[0,"If you load multiple impulse files using the .addImpulse method,\nthey will be stored as Objects in this Array. Toggle between them\nwith the toggleImpulse(id)
method.
Load and assign a new Impulse Response to the p5.Convolver.\nThe impulse is added to the .impulses
array. Previous\nimpulses can be accessed with the .toggleImpulse(id)
\nmethod.
path to a sound file
\n"],"type":[0,"String"]}],[0,{"name":[0,"callback"],"description":[0,"function (optional)
\n"],"type":[0,"Function"]}],[0,{"name":[0,"errorCallback"],"description":[0,"function (optional)
\n"],"type":[0,"Function"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Convolver"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Convolver/addImpulse"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Convolver/convolverNode.mdx"],"slug":[0,"en/p5convolver/convolvernode"],"body":[0,"\n\n# convolverNode\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"convolverNode"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Internally, the p5.Convolver uses the a\n\nWeb Audio Convolver Node.
\n"],"line":[0,8621],"itemtype":[0,"property"],"class":[0,"p5.Convolver"],"isConstructor":[0,false],"path":[0,"p5.Convolver/convolverNode"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Convolver/impulses.mdx"],"slug":[0,"en/p5convolver/impulses"],"body":[0,"\n\n# impulses\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"impulses"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"If you load multiple impulse files using the .addImpulse method,\nthey will be stored as Objects in this Array. Toggle between them\nwith the toggleImpulse(id)
method.
Connect a source to the convolver.
\n"],"line":[0,8737],"params":[1,[[0,{"name":[0,"src"],"description":[0,"p5.sound / Web Audio object with a sound\n output.
\n"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Convolver"],"chainable":[0,false],"example":[1,[[0,"\n\nlet cVerb, sound;\nfunction preload() {\n // We have both MP3 and OGG versions of all sound assets\n soundFormats('ogg', 'mp3');\n\n // Try replacing 'bx-spring' with other soundfiles like\n // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'\n cVerb = createConvolver('/assets/bx-spring.mp3');\n\n // Try replacing 'Damscray_DancingTiger' with\n // 'beat', 'doorbell', lucky_dragons_-_power_melody'\n sound = loadSound('/assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n background(220);\n text('tap to play', 20, 20);\n\n // disconnect from main output...\n sound.disconnect();\n\n // ...and process with cVerb\n // so that we only hear the convolution\n cVerb.process(sound);\n}\n\nfunction playSound() {\n sound.play();\n}\n\n
Similar to .addImpulse, except that the .impulses
\nArray is reset to save memory. A new .impulses
\narray is created with this impulse as the only item.
path to a sound file
\n"],"type":[0,"String"]}],[0,{"name":[0,"callback"],"description":[0,"function (optional)
\n"],"type":[0,"Function"]}],[0,{"name":[0,"errorCallback"],"description":[0,"function (optional)
\n"],"type":[0,"Function"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Convolver"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Convolver/resetImpulse"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Convolver/toggleImpulse.mdx"],"slug":[0,"en/p5convolver/toggleimpulse"],"body":[0,"\n\n# toggleImpulse\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"toggleImpulse()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"If you have used .addImpulse()
to add multiple impulses\nto a p5.Convolver, then you can use this method to toggle between\nthe items in the .impulses
Array. Accepts a parameter\nto identify which impulse you wish to use, identified either by its\noriginal filename (String) or by its position in the .impulses\n
Array (Number).
\nYou can access the objects in the .impulses Array directly. Each\nObject has two attributes: an .audioBuffer
(type:\nWeb Audio \nAudioBuffer) and a .name
, a String that corresponds\nwith the original filename.
Identify the impulse by its original filename\n (String), or by its position in the\n .impulses
Array (Number).
\nlet osc;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(220);\n textAlign(CENTER);\n text('tap to play', width/2, height/2);\n\n osc = new p5.Oscillator('square');\n osc.amp(0.5);\n delay = new p5.Delay(0.12, 0.7);\n \n osc.disconnect();\n osc.connect(delay);\n\n cnv.mousePressed(oscStart);\n describe('Tap to play a square wave with delay effect.');\n}\n\nfunction oscStart() {\n osc.start();\n}\n\n
\nSet a lowpass filter frequency for the delay. A lowpass filter\nwill cut off any frequencies higher than the filter frequency.
\n"],"path":[0,"p5.Delay/filter"]}],"setType":[0,{"description":[0,"Choose a preset type of delay. 'pingPong' bounces the signal\nfrom the left to the right channel to produce a stereo effect.\nAny other parameter will revert to the default delay setting.
\n"],"path":[0,"p5.Delay/setType"]}],"amp":[0,{"description":[0,"Adjust the amplitude of the delay effect."],"path":[0,"p5.Delay/amp"]}],"connect":[0,{"description":[0,"Send output to a p5.sound or web audio object
\n"],"path":[0,"p5.Delay/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all output.
\n"],"path":[0,"p5.Delay/disconnect"]}]}],"properties":[0,{"leftDelay":[0,{"description":[0,"The p5.Delay is built with two\n\nWeb Audio Delay Nodes, one for each stereo channel.
\n"],"path":[0,"p5.Delay/leftDelay"]}],"rightDelay":[0,{"description":[0,"The p5.Delay is built with two\n\nWeb Audio Delay Nodes, one for each stereo channel.
\n"],"path":[0,"p5.Delay/rightDelay"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Delay"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Delay/amp.mdx"],"slug":[0,"en/p5delay/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Delay.js"],"description":[0,"Adjust the amplitude of the delay effect."],"line":[0,146],"params":[1,[[0,{"name":[0,"amplitudeAmount"],"description":[0,"An amplitude value between 0 and 1."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/connect.mdx"],"slug":[0,"en/p5delay/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Send output to a p5.sound or web audio object
\n"],"line":[0,8234],"params":[1,[[0,{"name":[0,"unit"],"description":[0,""],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/delayTime.mdx"],"slug":[0,"en/p5delay/delaytime"],"body":[0,"\n\n# delayTime\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"delayTime()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Delay.js"],"description":[0,"Set the delay time in seconds."],"line":[0,57],"params":[1,[[0,{"name":[0,"delayTime"],"description":[0,"The delay time in seconds."],"type":[0,"Number"]}],[0,{"name":[0,"rampTime"],"description":[0,"The time in seconds it takes to ramp to the new delay time. \n By default it is 0.1 seconds. Setting it to 0 will change \n the delay time immediately and demonstrate legacy behavior."],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"example":[1,[[0,"\n\nlet osc, delay, env;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(220);\n textAlign(CENTER);\n textSize(9);\n text('click and drag mouse', width/2, height/2);\n\n osc = new p5.Oscillator('sawtooth');\n osc.amp(0.74);\n env = new p5.Envelope(0.01);\n delay = new p5.Delay(0.12, 0.7);\n \n osc.disconnect();\n osc.connect(env);\n env.disconnect();\n env.connect(delay);\n\n cnv.mousePressed(oscStart);\n cnv.mouseReleased(oscStop);\n cnv.mouseOut(oscStop);\n describe('Tap to play a square wave with delay effect.');\n}\n\nfunction oscStart() {\n background(0, 255, 255);\n text('release to hear delay', width/2, height/2);\n osc.start();\n env.triggerAttack();\n}\n\nfunction oscStop() {\n background(220);\n text('click and drag mouse', width/2, height/2);\n env.triggerRelease();\n} \n \nfunction draw() {\n \n let dtime = map(mouseX, 0, width, 0.1, 0.5);\n delay.delayTime(dtime);\n}"]]],"isConstructor":[0,false],"path":[0,"p5.Delay/delayTime"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/disconnect.mdx"],"slug":[0,"en/p5delay/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all output.
\n"],"line":[0,8242],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/feedback.mdx"],"slug":[0,"en/p5delay/feedback"],"body":[0,"\n\n# feedback\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"feedback()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Delay.js"],"description":[0,"The amount of feedback in the delay line."],"line":[0,122],"params":[1,[[0,{"name":[0,"feedbackAmount"],"description":[0,"A number between 0 and 0.99."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/feedback"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/filter.mdx"],"slug":[0,"en/p5delay/filter"],"body":[0,"\n\n# filter\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"filter()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set a lowpass filter frequency for the delay. A lowpass filter\nwill cut off any frequencies higher than the filter frequency.
\n"],"line":[0,8148],"params":[1,[[0,{"name":[0,"cutoffFreq"],"description":[0,"A lowpass filter will cut off any\n frequencies higher than the filter frequency.
\n"],"type":[0,"Number|Object"]}],[0,{"name":[0,"res"],"description":[0,"Resonance of the filter frequency\n cutoff, or an object (i.e. a p5.Oscillator)\n that can be used to modulate this parameter.\n High numbers (i.e. 15) will produce a resonance,\n low numbers (i.e. .2) will produce a slope.
\n"],"type":[0,"Number|Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/filter"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/leftDelay.mdx"],"slug":[0,"en/p5delay/leftdelay"],"body":[0,"\n\n# leftDelay\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"leftDelay"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The p5.Delay is built with two\n\nWeb Audio Delay Nodes, one for each stereo channel.
\n"],"line":[0,7989],"itemtype":[0,"property"],"class":[0,"p5.Delay"],"isConstructor":[0,false],"path":[0,"p5.Delay/leftDelay"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/process.mdx"],"slug":[0,"en/p5delay/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Delay.js"],"description":[0,"Process an input signal with a delay effect."],"line":[0,132],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"A p5.sound source such as an Oscillator, Soundfile, or AudioIn object."],"type":[0,"Object"]}],[0,{"name":[0,"delayTime"],"description":[0,"The amount of delay in seconds. A number between 0 and 1."],"type":[0,"Number"]}],[0,{"name":[0,"feedback"],"description":[0,"The amount of feedback. A number between 0 and 1."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/process"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/rightDelay.mdx"],"slug":[0,"en/p5delay/rightdelay"],"body":[0,"\n\n# rightDelay\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"rightDelay"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The p5.Delay is built with two\n\nWeb Audio Delay Nodes, one for each stereo channel.
\n"],"line":[0,7999],"itemtype":[0,"property"],"class":[0,"p5.Delay"],"isConstructor":[0,false],"path":[0,"p5.Delay/rightDelay"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Delay/setType.mdx"],"slug":[0,"en/p5delay/settype"],"body":[0,"\n\n# setType\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setType()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Choose a preset type of delay. 'pingPong' bounces the signal\nfrom the left to the right channel to produce a stereo effect.\nAny other parameter will revert to the default delay setting.
\n"],"line":[0,8170],"params":[1,[[0,{"name":[0,"type"],"description":[0,"'pingPong' (1) or 'default' (0)
\n"],"type":[0,"String|Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Delay"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Delay/setType"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Distortion"],"entry":[0,{"id":[0,"en/p5.sound/p5.Distortion.mdx"],"slug":[0,"en/p5sound/p5distortion"],"body":[0,"\n\n# p5.Distortion\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Distortion"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A Distortion effect created with a Waveshaper Node,\nwith an approach adapted from\nKevin Ennis
\nThis class extends p5.Effect.\nMethods amp(), chain(),\ndrywet(), connect(), and\ndisconnect() are available.
\n"],"line":[0,10816],"params":[1,[[0,{"name":[0,"amount"],"description":[0,"Unbounded distortion amount.\n Normal values range from 0-1.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"oversample"],"description":[0,"'none', '2x', or '4x'.
\n"],"type":[0,"String"],"optional":[0,true]}]]],"chainable":[0,false],"methods":[0,{"process":[0,{"description":[0,"Process a sound source, optionally specify amount and oversample values.
\n"],"path":[0,"p5.Distortion/process"]}],"set":[0,{"description":[0,"Set the amount and oversample of the waveshaper distortion.
\n"],"path":[0,"p5.Distortion/set"]}],"getAmount":[0,{"description":[0,"Return the distortion amount, typically between 0-1.
\n"],"path":[0,"p5.Distortion/getAmount"]}],"getOversample":[0,{"description":[0,"Return the oversampling.
\n"],"path":[0,"p5.Distortion/getOversample"]}]}],"properties":[0,{"WaveShaperNode":[0,{"description":[0,"The p5.Distortion is built with a\n\nWeb Audio WaveShaper Node.
\n"],"path":[0,"p5.Distortion/WaveShaperNode"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Distortion"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Distortion/WaveShaperNode.mdx"],"slug":[0,"en/p5distortion/waveshapernode"],"body":[0,"\n\n# WaveShaperNode\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"WaveShaperNode"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The p5.Distortion is built with a\n\nWeb Audio WaveShaper Node.
\n"],"line":[0,10864],"itemtype":[0,"property"],"class":[0,"p5.Distortion"],"isConstructor":[0,false],"path":[0,"p5.Distortion/WaveShaperNode"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Distortion/getAmount.mdx"],"slug":[0,"en/p5distortion/getamount"],"body":[0,"\n\n# getAmount\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getAmount()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Return the distortion amount, typically between 0-1.
\n"],"line":[0,10923],"itemtype":[0,"method"],"class":[0,"p5.Distortion"],"chainable":[0,false],"return":[0,{"description":[0,"Unbounded distortion amount.\n Normal values range from 0-1."],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Distortion/getAmount"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Distortion/getOversample.mdx"],"slug":[0,"en/p5distortion/getoversample"],"body":[0,"\n\n# getOversample\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getOversample()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Return the oversampling.
\n"],"line":[0,10937],"itemtype":[0,"method"],"class":[0,"p5.Distortion"],"chainable":[0,false],"return":[0,{"description":[0,"Oversample can either be 'none', '2x', or '4x'."],"type":[0,"String"]}],"isConstructor":[0,false],"path":[0,"p5.Distortion/getOversample"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Distortion/process.mdx"],"slug":[0,"en/p5distortion/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Process a sound source, optionally specify amount and oversample values.
\n"],"line":[0,10883],"params":[1,[[0,{"name":[0,"amount"],"description":[0,"Unbounded distortion amount.\n Normal values range from 0-1.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"oversample"],"description":[0,"'none', '2x', or '4x'.
\n"],"type":[0,"String"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Distortion"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Distortion/process"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Distortion/set.mdx"],"slug":[0,"en/p5distortion/set"],"body":[0,"\n\n# set\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"set()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the amount and oversample of the waveshaper distortion.
\n"],"line":[0,10900],"params":[1,[[0,{"name":[0,"amount"],"description":[0,"Unbounded distortion amount.\n Normal values range from 0-1.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"oversample"],"description":[0,"'none', '2x', or '4x'.
\n"],"type":[0,"String"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Distortion"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Distortion/set"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.EQ"],"entry":[0,{"id":[0,"en/p5.sound/p5.EQ.mdx"],"slug":[0,"en/p5sound/p5eq"],"body":[0,"\n\n# p5.EQ\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.EQ"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"p5.EQ is an audio effect that performs the function of a multiband\naudio equalizer. Equalization is used to adjust the balance of\nfrequency compoenents of an audio signal. This process is commonly used\nin sound production and recording to change the waveform before it reaches\na sound output device. EQ can also be used as an audio effect to create\ninteresting distortions by filtering out parts of the spectrum. p5.EQ is\nbuilt using a chain of Web Audio Biquad Filter Nodes and can be\ninstantiated with 3 or 8 bands. Bands can be added or removed from\nthe EQ by directly modifying p5.EQ.bands (the array that stores filters).
\nThis class extends p5.Effect.\nMethods amp(), chain(),\ndrywet(), connect(), and\ndisconnect() are available.
\n"],"line":[0,7105],"params":[1,[[0,{"name":[0,"_eqsize"],"description":[0,"Constructor will accept 3 or 8, defaults to 3
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet eq, soundFile\nlet eqBandIndex = 0;\nlet eqBandNames = ['lows', 'mids', 'highs'];\n\nfunction preload() {\n soundFormats('mp3', 'ogg');\n soundFile = loadSound('/assets/beat');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(toggleSound);\n\n eq = new p5.EQ(eqBandNames.length);\n soundFile.disconnect();\n eq.process(soundFile);\n}\n\nfunction draw() {\n background(30);\n noStroke();\n fill(255);\n textAlign(CENTER);\n text('filtering ', 50, 25);\n\n fill(255, 40, 255);\n textSize(26);\n text(eqBandNames[eqBandIndex], 50, 55);\n\n fill(255);\n textSize(9);\n\n if (!soundFile.isPlaying()) {\n text('tap to play', 50, 80);\n } else {\n text('tap to filter next band', 50, 80)\n }\n}\n\nfunction toggleSound() {\n if (!soundFile.isPlaying()) {\n soundFile.play();\n } else {\n eqBandIndex = (eqBandIndex + 1) % eq.bands.length;\n }\n\n for (let i = 0; i < eq.bands.length; i++) {\n eq.bands[i].gain(0);\n }\n // filter the band we want to filter\n eq.bands[eqBandIndex].gain(-40);\n}\n
"]]],"methods":[0,{"process":[0,{"description":[0,"Process an input by connecting it to the EQ
\n"],"path":[0,"p5.EQ/process"]}]}],"properties":[0,{"bands":[0,{"description":[0,"The p5.EQ is built with abstracted p5.Filter objects.\nTo modify any bands, use methods of the \np5.Filter API, especially gain
and freq
.\nBands are stored in an array, with indices 0 - 3, or 0 - 7
\n"],"path":[0,"p5.EQ/bands"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.EQ"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.EQ/bands.mdx"],"slug":[0,"en/p5eq/bands"],"body":[0,"\n\n# bands\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"bands"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The p5.EQ is built with abstracted p5.Filter objects.\nTo modify any bands, use methods of the \np5.Filter API, especially gain
and freq
.\nBands are stored in an array, with indices 0 - 3, or 0 - 7
\n"],"line":[0,7198],"itemtype":[0,"property"],"class":[0,"p5.EQ"],"isConstructor":[0,false],"path":[0,"p5.EQ/bands"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.EQ/process.mdx"],"slug":[0,"en/p5eq/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Process an input by connecting it to the EQ
\n"],"line":[0,7239],"params":[1,[[0,{"name":[0,"src"],"description":[0,"Audio source
\n"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.EQ"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.EQ/process"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Effect"],"entry":[0,{"id":[0,"en/p5.sound/p5.Effect.mdx"],"slug":[0,"en/p5sound/p5effect"],"body":[0,"\n\n# p5.Effect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Effect"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Effect is a base class for audio effects in p5.
\nThis module handles the nodes and methods that are\ncommon and useful for current and future effects.
\nThis class is extended by p5.Distortion,\np5.Compressor,\np5.Delay,\np5.Filter,\np5.Reverb.
\n"],"line":[0,6423],"params":[1,[[0,{"name":[0,"ac"],"description":[0,"Reference to the audio context of the p5 object
\n"],"type":[0,"Object"],"optional":[0,true]}],[0,{"name":[0,"input"],"description":[0,"Gain Node effect wrapper
\n"],"type":[0,"AudioNode"],"optional":[0,true]}],[0,{"name":[0,"output"],"description":[0,"Gain Node effect wrapper
\n"],"type":[0,"AudioNode"],"optional":[0,true]}],[0,{"name":[0,"_drywet"],"description":[0,"Tone.JS CrossFade node (defaults to value: 1)
\n"],"type":[0,"Object"],"optional":[0,true]}],[0,{"name":[0,"wet"],"description":[0,"Effects that extend this class should connect\n to the wet signal to this gain node, so that dry and wet\n signals are mixed properly.
\n"],"type":[0,"AudioNode"],"optional":[0,true]}]]],"chainable":[0,false],"methods":[0,{"amp":[0,{"description":[0,"Set the output volume of the filter.
\n"],"path":[0,"p5.Effect/amp"]}],"chain":[0,{"description":[0,"Link effects together in a chain\nExample usage: filter.chain(reverb, delay, panner);\nMay be used with an open-ended number of arguments
\n"],"path":[0,"p5.Effect/chain"]}],"drywet":[0,{"description":[0,"Adjust the dry/wet value.
\n"],"path":[0,"p5.Effect/drywet"]}],"connect":[0,{"description":[0,"Send output to a p5.js-sound, Web Audio Node, or use signal to\ncontrol an AudioParam
\n"],"path":[0,"p5.Effect/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all output.
\n"],"path":[0,"p5.Effect/disconnect"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Effect"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Effect/amp.mdx"],"slug":[0,"en/p5effect/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the output volume of the filter.
\n"],"line":[0,6478],"params":[1,[[0,{"name":[0,"vol"],"description":[0,"amplitude between 0 and 1.0
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"rampTime"],"description":[0,"create a fade that lasts until rampTime
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"tFromNow"],"description":[0,"schedule this event to happen in tFromNow seconds
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Effect"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Effect/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Effect/chain.mdx"],"slug":[0,"en/p5effect/chain"],"body":[0,"\n\n# chain\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"chain()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Link effects together in a chain\nExample usage: filter.chain(reverb, delay, panner);\nMay be used with an open-ended number of arguments
\n"],"line":[0,6502],"params":[1,[[0,{"name":[0,"arguments"],"description":[0,"Chain together multiple sound objects
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Effect"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Effect/chain"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Effect/connect.mdx"],"slug":[0,"en/p5effect/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Send output to a p5.js-sound, Web Audio Node, or use signal to\ncontrol an AudioParam
\n"],"line":[0,6542],"params":[1,[[0,{"name":[0,"unit"],"description":[0,""],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Effect"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Effect/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Effect/disconnect.mdx"],"slug":[0,"en/p5effect/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all output.
\n"],"line":[0,6557],"itemtype":[0,"method"],"class":[0,"p5.Effect"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Effect/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Effect/drywet.mdx"],"slug":[0,"en/p5effect/drywet"],"body":[0,"\n\n# drywet\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"drywet()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Adjust the dry/wet value.
\n"],"line":[0,6525],"params":[1,[[0,{"name":[0,"fade"],"description":[0,"The desired drywet value (0 - 1.0)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Effect"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Effect/drywet"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Envelope"],"entry":[0,{"id":[0,"en/p5.sound/p5.Envelope.mdx"],"slug":[0,"en/p5sound/p5envelope"],"body":[0,"\n\n# p5.Envelope\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Envelope"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Generate an amplitude envelope."],"line":[0,10],"params":[1,[[0,{"name":[0,"attack"],"description":[0,"how quickly the envelope reaches the maximum level"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"decay"],"description":[0,"how quickly the envelope reaches the sustain level"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"sustain"],"description":[0,"how long the envelope stays at the decay level"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"release"],"description":[0,"how quickly the envelope fades out after the sustain level"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n\nconsoe.log('do an example here');\n
\n"]]],"methods":[0,{"set":[0,{"description":[0,"Reset the envelope with a series of time/value pairs.
\n"],"path":[0,"p5.Envelope/set"]}],"setADSR":[0,{"description":[0,"Sets the attack, decay, sustain, and release times of the envelope."],"path":[0,"p5.Envelope/setADSR"]}],"setRange":[0,{"description":[0,"Set max (attackLevel) and min (releaseLevel) of envelope.
\n"],"path":[0,"p5.Envelope/setRange"]}],"setInput":[0,{"description":[0,""],"path":[0,"p5.Envelope/setInput"]}],"setExp":[0,{"description":[0,"Set whether the envelope ramp is linear (default) or exponential.\nExponential ramps can be useful because we perceive amplitude\nand frequency logarithmically.
\n"],"path":[0,"p5.Envelope/setExp"]}],"play":[0,{"description":[0,"Trigger the envelope and release it after the sustain time."],"path":[0,"p5.Envelope/play"]}],"triggerAttack":[0,{"description":[0,"Trigger the Attack, and Decay portion of the Envelope. Similar to holding\ndown a key on a piano, but it will hold the sustain level until you let go."],"path":[0,"p5.Envelope/triggerAttack"]}],"triggerRelease":[0,{"description":[0,"Trigger the Release of the envelope. Similar to releasing the key on \na piano and letting the sound fade according to the release level and \nrelease time."],"path":[0,"p5.Envelope/triggerRelease"]}],"ramp":[0,{"description":[0,"Exponentially ramp to a value using the first two\nvalues from setADSR(attackTime, decayTime)
\nas \ntime constants for simple exponential ramps.\nIf the value is higher than current value, it uses attackTime,\nwhile a decrease uses decayTime.
\n"],"path":[0,"p5.Envelope/ramp"]}],"add":[0,{"description":[0,"Add a value to the p5.Oscillator's output amplitude,\nand return the oscillator. Calling this method\nagain will override the initial add() with new values.
\n"],"path":[0,"p5.Envelope/add"]}],"mult":[0,{"description":[0,"Multiply the p5.Envelope's output amplitude\nby a fixed value. Calling this method\nagain will override the initial mult() with new values.
\n"],"path":[0,"p5.Envelope/mult"]}],"scale":[0,{"description":[0,"Scale this envelope's amplitude values to a given\nrange, and return the envelope. Calling this method\nagain will override the initial scale() with new values.
\n"],"path":[0,"p5.Envelope/scale"]}],"releaseTime":[0,{"description":[0,"Sets the release time of the envelope."],"path":[0,"p5.Envelope/releaseTime"]}],"attackTime":[0,{"description":[0,"Sets the attack time of the envelope."],"path":[0,"p5.Envelope/attackTime"]}]}],"properties":[0,{"attackTime":[0,{"description":[0,"Time until envelope reaches attackLevel
\n"],"path":[0,"p5.Envelope/attackTime"]}],"attackLevel":[0,{"description":[0,"Level once attack is complete.
\n"],"path":[0,"p5.Envelope/attackLevel"]}],"decayTime":[0,{"description":[0,"Time until envelope reaches decayLevel.
\n"],"path":[0,"p5.Envelope/decayTime"]}],"decayLevel":[0,{"description":[0,"Level after decay. The envelope will sustain here until it is released.
\n"],"path":[0,"p5.Envelope/decayLevel"]}],"releaseTime":[0,{"description":[0,"Duration of the release portion of the envelope.
\n"],"path":[0,"p5.Envelope/releaseTime"]}],"releaseLevel":[0,{"description":[0,"Level at the end of the release.
\n"],"path":[0,"p5.Envelope/releaseLevel"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Envelope"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Envelope/add.mdx"],"slug":[0,"en/p5envelope/add"],"body":[0,"\n\n# add\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"add()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Add a value to the p5.Oscillator's output amplitude,\nand return the oscillator. Calling this method\nagain will override the initial add() with new values.
\n"],"line":[0,5460],"params":[1,[[0,{"name":[0,"number"],"description":[0,"Constant number to add
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"return":[0,{"description":[0,"Envelope Returns this envelope\n with scaled output"],"type":[0,"p5.Envelope"]}],"isConstructor":[0,false],"path":[0,"p5.Envelope/add"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/attackLevel.mdx"],"slug":[0,"en/p5envelope/attacklevel"],"body":[0,"\n\n# attackLevel\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"attackLevel"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Level once attack is complete.
\n"],"line":[0,4772],"itemtype":[0,"property"],"class":[0,"p5.Envelope"],"isConstructor":[0,false],"path":[0,"p5.Envelope/attackLevel"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/attackTime.mdx"],"slug":[0,"en/p5envelope/attacktime"],"body":[0,"\n\n# attackTime\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"attackTime()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Sets the attack time of the envelope."],"line":[0,178],"params":[1,[[0,{"name":[0,"attackTime"],"description":[0,"the attack time in seconds"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Envelope/attackTime"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/decayLevel.mdx"],"slug":[0,"en/p5envelope/decaylevel"],"body":[0,"\n\n# decayLevel\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"decayLevel"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Level after decay. The envelope will sustain here until it is released.
\n"],"line":[0,4784],"itemtype":[0,"property"],"class":[0,"p5.Envelope"],"isConstructor":[0,false],"path":[0,"p5.Envelope/decayLevel"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/decayTime.mdx"],"slug":[0,"en/p5envelope/decaytime"],"body":[0,"\n\n# decayTime\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"decayTime"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Time until envelope reaches decayLevel.
\n"],"line":[0,4778],"itemtype":[0,"property"],"class":[0,"p5.Envelope"],"isConstructor":[0,false],"path":[0,"p5.Envelope/decayTime"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/mult.mdx"],"slug":[0,"en/p5envelope/mult"],"body":[0,"\n\n# mult\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"mult()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Multiply the p5.Envelope's output amplitude\nby a fixed value. Calling this method\nagain will override the initial mult() with new values.
\n"],"line":[0,5479],"params":[1,[[0,{"name":[0,"number"],"description":[0,"Constant number to multiply
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"return":[0,{"description":[0,"Envelope Returns this envelope\n with scaled output"],"type":[0,"p5.Envelope"]}],"isConstructor":[0,false],"path":[0,"p5.Envelope/mult"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/play.mdx"],"slug":[0,"en/p5envelope/play"],"body":[0,"\n\n# play\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"play()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Trigger the envelope and release it after the sustain time."],"line":[0,41],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Envelope/play"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/ramp.mdx"],"slug":[0,"en/p5envelope/ramp"],"body":[0,"\n\n# ramp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"ramp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Exponentially ramp to a value using the first two\nvalues from setADSR(attackTime, decayTime)
\nas \ntime constants for simple exponential ramps.\nIf the value is higher than current value, it uses attackTime,\nwhile a decrease uses decayTime.
\n"],"line":[0,5350],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"p5.sound Object or Web Audio Param
\n"],"type":[0,"Object"]}],[0,{"name":[0,"secondsFromNow"],"description":[0,"When to trigger the ramp
\n"],"type":[0,"Number"]}],[0,{"name":[0,"v"],"description":[0,"Target value
\n"],"type":[0,"Number"]}],[0,{"name":[0,"v2"],"description":[0,"Second target value
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"example":[1,[[0,"\n\nlet env, osc, amp;\n\nlet attackTime = 0.001;\nlet decayTime = 0.2;\nlet attackLevel = 1;\nlet decayLevel = 0;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n fill(0,255,0);\n noStroke();\n\n env = new p5.Envelope();\n env.setADSR(attackTime, decayTime);\n osc = new p5.Oscillator();\n osc.amp(env);\n amp = new p5.Amplitude();\n\n cnv.mousePressed(triggerRamp);\n}\n\nfunction triggerRamp() {\n // ensures audio is enabled. See also: `userStartAudio`\n osc.start();\n\n env.ramp(osc, 0, attackLevel, decayLevel);\n}\n\nfunction draw() {\n background(20);\n text('tap to play', 10, 20);\n let h = map(amp.getLevel(), 0, 0.4, 0, height);;\n rect(0, height, width, -h);\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.Envelope/ramp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/releaseLevel.mdx"],"slug":[0,"en/p5envelope/releaselevel"],"body":[0,"\n\n# releaseLevel\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"releaseLevel"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Level at the end of the release.
\n"],"line":[0,4796],"itemtype":[0,"property"],"class":[0,"p5.Envelope"],"isConstructor":[0,false],"path":[0,"p5.Envelope/releaseLevel"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/releaseTime.mdx"],"slug":[0,"en/p5envelope/releasetime"],"body":[0,"\n\n# releaseTime\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"releaseTime()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Sets the release time of the envelope."],"line":[0,168],"params":[1,[[0,{"name":[0,"releaseTime"],"description":[0,"the release time in seconds"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Envelope/releaseTime"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/scale.mdx"],"slug":[0,"en/p5envelope/scale"],"body":[0,"\n\n# scale\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"scale()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Scale this envelope's amplitude values to a given\nrange, and return the envelope. Calling this method\nagain will override the initial scale() with new values.
\n"],"line":[0,5498],"params":[1,[[0,{"name":[0,"inMin"],"description":[0,"input range minumum
\n"],"type":[0,"Number"]}],[0,{"name":[0,"inMax"],"description":[0,"input range maximum
\n"],"type":[0,"Number"]}],[0,{"name":[0,"outMin"],"description":[0,"input range minumum
\n"],"type":[0,"Number"]}],[0,{"name":[0,"outMax"],"description":[0,"input range maximum
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"return":[0,{"description":[0,"Envelope Returns this envelope\n with scaled output"],"type":[0,"p5.Envelope"]}],"isConstructor":[0,false],"path":[0,"p5.Envelope/scale"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/set.mdx"],"slug":[0,"en/p5envelope/set"],"body":[0,"\n\n# set\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"set()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Reset the envelope with a series of time/value pairs.
\n"],"line":[0,4833],"params":[1,[[0,{"name":[0,"attackTime"],"description":[0,"Time (in seconds) before level\n reaches attackLevel
\n"],"type":[0,"Number"]}],[0,{"name":[0,"attackLevel"],"description":[0,"Typically an amplitude between\n 0.0 and 1.0
\n"],"type":[0,"Number"]}],[0,{"name":[0,"decayTime"],"description":[0,"Time
\n"],"type":[0,"Number"]}],[0,{"name":[0,"decayLevel"],"description":[0,"Amplitude (In a standard ADSR envelope,\n decayLevel = sustainLevel)
\n"],"type":[0,"Number"]}],[0,{"name":[0,"releaseTime"],"description":[0,"Release Time (in seconds)
\n"],"type":[0,"Number"]}],[0,{"name":[0,"releaseLevel"],"description":[0,"Amplitude
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"example":[1,[[0,"\n\nlet attackTime;\nlet l1 = 0.7; // attack level 0.0 to 1.0\nlet t2 = 0.3; // decay time in seconds\nlet l2 = 0.1; // decay level 0.0 to 1.0\nlet l3 = 0.2; // release time in seconds\n\nlet env, triOsc;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n\n env = new p5.Envelope();\n triOsc = new p5.Oscillator('triangle');\n}\n\nfunction draw() {\n background(220);\n text('tap here to play', 5, 20);\n\n attackTime = map(mouseX, 0, width, 0.0, 1.0);\n text('attack time: ' + attackTime, 5, height - 20);\n}\n\n// mouseClick triggers envelope if over canvas\nfunction playSound() {\n env.set(attackTime, l1, t2, l2, l3);\n\n triOsc.start();\n env.play(triOsc);\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.Envelope/set"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/setADSR.mdx"],"slug":[0,"en/p5envelope/setadsr"],"body":[0,"\n\n# setADSR\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setADSR()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Sets the attack, decay, sustain, and release times of the envelope."],"line":[0,152],"params":[1,[[0,{"name":[0,"attack"],"description":[0,"how quickly the envelope reaches the maximum level"],"type":[0,"Number"]}],[0,{"name":[0,"decay"],"description":[0,"how quickly the envelope reaches the sustain level"],"type":[0,"Number"]}],[0,{"name":[0,"sustain"],"description":[0,"how long the envelope stays at the decay level"],"type":[0,"Number"]}],[0,{"name":[0,"release"],"description":[0,"how quickly the envelope fades out after the sustain level"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Envelope/setADSR"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/setExp.mdx"],"slug":[0,"en/p5envelope/setexp"],"body":[0,"\n\n# setExp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setExp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set whether the envelope ramp is linear (default) or exponential.\nExponential ramps can be useful because we perceive amplitude\nand frequency logarithmically.
\n"],"line":[0,5055],"params":[1,[[0,{"name":[0,"isExp"],"description":[0,"true is exponential, false is linear
\n"],"type":[0,"Boolean"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Envelope/setExp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/setInput.mdx"],"slug":[0,"en/p5envelope/setinput"],"body":[0,"\n\n# setInput\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setInput()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,""],"line":[0,143],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"A p5.sound Object"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Envelope/setInput"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/setRange.mdx"],"slug":[0,"en/p5envelope/setrange"],"body":[0,"\n\n# setRange\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setRange()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set max (attackLevel) and min (releaseLevel) of envelope.
\n"],"line":[0,4964],"params":[1,[[0,{"name":[0,"aLevel"],"description":[0,"attack level (defaults to 1)
\n"],"type":[0,"Number"]}],[0,{"name":[0,"rLevel"],"description":[0,"release level (defaults to 0)
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"example":[1,[[0,"\n\nlet attackLevel = 1.0;\nlet releaseLevel = 0;\n\nlet attackTime = 0.001;\nlet decayTime = 0.2;\nlet susPercent = 0.2;\nlet releaseTime = 0.5;\n\nlet env, triOsc;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playEnv);\n\n env = new p5.Envelope();\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.freq(220);\n}\n\nfunction draw() {\n background(220);\n text('tap here to play', 5, 20);\n attackLevel = map(mouseY, height, 0, 0, 1.0);\n text('attack level: ' + attackLevel, 5, height - 20);\n}\n\nfunction playEnv() {\n triOsc.start();\n env.setRange(attackLevel, releaseLevel);\n env.play();\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.Envelope/setRange"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/triggerAttack.mdx"],"slug":[0,"en/p5envelope/triggerattack"],"body":[0,"\n\n# triggerAttack\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"triggerAttack()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Trigger the Attack, and Decay portion of the Envelope. Similar to holding\ndown a key on a piano, but it will hold the sustain level until you let go."],"line":[0,50],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet osc, env;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(220);\n cnv.mousePressed(playSound);\n cnv.mouseReleased(stopSound);\n textAlign(CENTER);\n textSize(10);\n text('tap to triggerAttack', width/2, height/2);\n\n osc = new p5.Oscillator();\n osc.disconnect();\n env = new p5.Envelope();\n osc.connect(env);\n}\n\nfunction playSound() {\n background(0, 255, 255);\n text('release to release', width/2, height/2);\n osc.start();\n env.attackTime(random(0.00, 0.25));\n env.triggerAttack(0.5);\n}\n\nfunction stopSound() {\n background(220);\n text('tap to triggerAttack', width/2, height/2);\n env.releaseTime(random(0.1, 0.3));\n env.triggerRelease();\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.Envelope/triggerAttack"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Envelope/triggerRelease.mdx"],"slug":[0,"en/p5envelope/triggerrelease"],"body":[0,"\n\n# triggerRelease\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"triggerRelease()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Envelope.js"],"description":[0,"Trigger the Release of the envelope. Similar to releasing the key on \na piano and letting the sound fade according to the release level and \nrelease time."],"line":[0,96],"itemtype":[0,"method"],"class":[0,"p5.Envelope"],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet osc, env;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(220);\n cnv.mousePressed(playSound);\n cnv.mouseReleased(stopSound);\n textAlign(CENTER);\n textSize(10);\n text('tap to triggerAttack', width/2, height/2);\n\n osc = new p5.Oscillator();\n osc.disconnect();\n env = new p5.Envelope();\n osc.connect(env);\n}\n\nfunction playSound() {\n background(0, 255, 255);\n text('release to release', width/2, height/2);\n osc.start();\n env.attackTime(random(0.00, 0.25));\n env.triggerAttack(0.5);\n}\n\nfunction stopSound() {\n background(220);\n text('tap to triggerAttack', width/2, height/2);\n env.releaseTime(random(0.1, 0.3));\n env.triggerRelease();\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.Envelope/triggerRelease"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.FFT"],"entry":[0,{"id":[0,"en/p5.sound/p5.FFT.mdx"],"slug":[0,"en/p5sound/p5fft"],"body":[0,"\n\n# p5.FFT\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.FFT"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/FFT.js"],"description":[0,"Analyze the frequency spectrum and waveform of sounds."],"line":[0,11],"params":[1,[[0,{"name":[0,"fftSize"],"description":[0,"FFT anaylsis size. Must be a power of two between 16 and 1024. Defaults to 32."],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet osc;\n\nfunction setup(){\n let cnv = createCanvas(100,100);\n cnv.mouseClicked(togglePlay);\n fft = new p5.FFT(32);\n osc = new p5.TriOsc(440);\n osc.connect(fft);\n}\n\nfunction draw(){\n background(220);\n let spectrum = fft.analyze();\n noStroke();\n fill(255, 0, 0);\n\n for (let i = 0; i < spectrum.length; i++) {\n let x = map(i, 0, spectrum.length, 0, width); \n let h = -height + map(spectrum[i], 0, 0.1, height, 0);\n rect(x, height, width / spectrum.length, h )\n }\n\n let waveform = fft.waveform();\n noFill();\n beginShape();\n stroke(20);\n \n for (let i = 0; i < waveform.length; i++){\n let x = map(i, 0, waveform.length, 0, width);\n let y = map( waveform[i], -1, 1, 0, height);\n vertex(x,y);\n }\n endShape();\n \n textAlign(CENTER);\n text('tap to play', width/2, 20);\n osc.freq(map(mouseX, 0, width, 100, 2000));\n describe('The sketch displays the frequency spectrum and waveform of the sound that plays.');\n}\n\nfunction togglePlay() {\n osc.start();\n}\n
\n"]]],"methods":[0,{"setInput":[0,{"description":[0,"Set the input source for the FFT analysis. If no source is\nprovided, FFT will analyze all sound in the sketch.
\n"],"path":[0,"p5.FFT/setInput"]}],"waveform":[0,{"description":[0,"Returns an array of sample values from the input audio."],"path":[0,"p5.FFT/waveform"]}],"analyze":[0,{"description":[0,"Returns the frequency spectrum of the input signal."],"path":[0,"p5.FFT/analyze"]}],"getEnergy":[0,{"description":[0,"Returns the amount of energy (volume) at a specific\n\nfrequency, or the average amount of energy between two\nfrequencies. Accepts Number(s) corresponding\nto frequency (in Hz), or a \"string\" corresponding to predefined\nfrequency ranges (\"bass\", \"lowMid\", \"mid\", \"highMid\", \"treble\").\nReturns a range between 0 (no energy/volume at that frequency) and\n255 (maximum energy).\nNOTE: analyze() must be called prior to getEnergy(). analyze()\ntells the FFT to analyze frequency data, and getEnergy() uses\nthe results to determine the value at a specific frequency or\nrange of frequencies.
\n"],"path":[0,"p5.FFT/getEnergy"]}],"getCentroid":[0,{"description":[0,"Returns the\n\nspectral centroid of the input signal.\nNOTE: analyze() must be called prior to getCentroid(). Analyze()\ntells the FFT to analyze frequency data, and getCentroid() uses\nthe results determine the spectral centroid.
\n"],"path":[0,"p5.FFT/getCentroid"]}],"smooth":[0,{"description":[0,"Smooth FFT analysis by averaging with the last analysis frame.
\n"],"path":[0,"p5.FFT/smooth"]}],"linAverages":[0,{"description":[0,"Returns an array of average amplitude values for a given number\nof frequency bands split equally. N defaults to 16.\nNOTE: analyze() must be called prior to linAverages(). Analyze()\ntells the FFT to analyze frequency data, and linAverages() uses\nthe results to group them into a smaller set of averages.
\n"],"path":[0,"p5.FFT/linAverages"]}],"logAverages":[0,{"description":[0,"Returns an array of average amplitude values of the spectrum, for a given\nset of \nOctave Bands\nNOTE: analyze() must be called prior to logAverages(). Analyze()\ntells the FFT to analyze frequency data, and logAverages() uses\nthe results to group them into a smaller set of averages.
\n"],"path":[0,"p5.FFT/logAverages"]}],"getOctaveBands":[0,{"description":[0,"Calculates and Returns the 1/N\nOctave Bands\nN defaults to 3 and minimum central frequency to 15.625Hz.\n(1/3 Octave Bands ~= 31 Frequency Bands)\nSetting fCtr0 to a central value of a higher octave will ignore the lower bands\nand produce less frequency groups.
\n"],"path":[0,"p5.FFT/getOctaveBands"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.FFT"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.FFT/analyze.mdx"],"slug":[0,"en/p5fft/analyze"],"body":[0,"\n\n# analyze\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"analyze()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/FFT.js"],"description":[0,"Returns the frequency spectrum of the input signal."],"line":[0,84],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"Array of amplitude values from 0 to 1."],"type":[0,"Array"]}],"isConstructor":[0,false],"path":[0,"p5.FFT/analyze"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/getCentroid.mdx"],"slug":[0,"en/p5fft/getcentroid"],"body":[0,"\n\n# getCentroid\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getCentroid()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the\n\nspectral centroid of the input signal.\nNOTE: analyze() must be called prior to getCentroid(). Analyze()\ntells the FFT to analyze frequency data, and getCentroid() uses\nthe results determine the spectral centroid.
\n"],"line":[0,3739],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"Spectral Centroid Frequency of the spectral centroid in Hz."],"type":[0,"Number"]}],"example":[1,[[0,"\n\n function setup(){\ncnv = createCanvas(100,100);\ncnv.mousePressed(userStartAudio);\nsound = new p5.AudioIn();\nsound.start();\nfft = new p5.FFT();\nsound.connect(fft);\n}\n\nfunction draw() {\nif (getAudioContext().state !== 'running') {\n background(220);\n text('tap here and enable mic to begin', 10, 20, width - 20);\n return;\n}\nlet centroidplot = 0.0;\nlet spectralCentroid = 0;\n\nbackground(0);\nstroke(0,255,0);\nlet spectrum = fft.analyze();\nfill(0,255,0); // spectrum is green\n\n//draw the spectrum\nfor (let i = 0; i < spectrum.length; i++){\n let x = map(log(i), 0, log(spectrum.length), 0, width);\n let h = map(spectrum[i], 0, 255, 0, height);\n let rectangle_width = (log(i+1)-log(i))*(width/log(spectrum.length));\n rect(x, height, rectangle_width, -h )\n}\nlet nyquist = 22050;\n\n// get the centroid\nspectralCentroid = fft.getCentroid();\n\n// the mean_freq_index calculation is for the display.\nlet mean_freq_index = spectralCentroid/(nyquist/spectrum.length);\n\ncentroidplot = map(log(mean_freq_index), 0, log(spectrum.length), 0, width);\n\nstroke(255,0,0); // the line showing where the centroid is will be red\n\nrect(centroidplot, 0, width / spectrum.length, height)\nnoStroke();\nfill(255,255,255); // text is white\ntext('centroid: ', 10, 20);\ntext(round(spectralCentroid)+' Hz', 10, 40);\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.FFT/getCentroid"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/getEnergy.mdx"],"slug":[0,"en/p5fft/getenergy"],"body":[0,"\n\n# getEnergy\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getEnergy()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the amount of energy (volume) at a specific\n\nfrequency, or the average amount of energy between two\nfrequencies. Accepts Number(s) corresponding\nto frequency (in Hz), or a \"string\" corresponding to predefined\nfrequency ranges (\"bass\", \"lowMid\", \"mid\", \"highMid\", \"treble\").\nReturns a range between 0 (no energy/volume at that frequency) and\n255 (maximum energy).\nNOTE: analyze() must be called prior to getEnergy(). analyze()\ntells the FFT to analyze frequency data, and getEnergy() uses\nthe results to determine the value at a specific frequency or\nrange of frequencies.
\n"],"line":[0,3650],"params":[1,[[0,{"name":[0,"frequency1"],"description":[0,"Will return a value representing\n energy at this frequency. Alternately,\n the strings \"bass\", \"lowMid\" \"mid\",\n \"highMid\", and \"treble\" will return\n predefined frequency ranges.
\n"],"type":[0,"Number|String"]}],[0,{"name":[0,"frequency2"],"description":[0,"If a second frequency is given,\n will return average amount of\n energy that exists between the\n two frequencies.
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"Energy Energy (volume/amplitude) from\n 0 and 255."],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.FFT/getEnergy"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/getOctaveBands.mdx"],"slug":[0,"en/p5fft/getoctavebands"],"body":[0,"\n\n# getOctaveBands\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getOctaveBands()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Calculates and Returns the 1/N\nOctave Bands\nN defaults to 3 and minimum central frequency to 15.625Hz.\n(1/3 Octave Bands ~= 31 Frequency Bands)\nSetting fCtr0 to a central value of a higher octave will ignore the lower bands\nand produce less frequency groups.
\n"],"line":[0,3925],"params":[1,[[0,{"name":[0,"N"],"description":[0,"Specifies the 1/N type of generated octave bands
\n"],"type":[0,"Number"]}],[0,{"name":[0,"fCtr0"],"description":[0,"Minimum central frequency for the lowest band
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"octaveBands Array of octave band objects with their bounds"],"type":[0,"Array"]}],"isConstructor":[0,false],"path":[0,"p5.FFT/getOctaveBands"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/linAverages.mdx"],"slug":[0,"en/p5fft/linaverages"],"body":[0,"\n\n# linAverages\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"linAverages()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns an array of average amplitude values for a given number\nof frequency bands split equally. N defaults to 16.\nNOTE: analyze() must be called prior to linAverages(). Analyze()\ntells the FFT to analyze frequency data, and linAverages() uses\nthe results to group them into a smaller set of averages.
\n"],"line":[0,3854],"params":[1,[[0,{"name":[0,"N"],"description":[0,"Number of returned frequency groups
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"linearAverages Array of average amplitude values for each group"],"type":[0,"Array"]}],"isConstructor":[0,false],"path":[0,"p5.FFT/linAverages"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/logAverages.mdx"],"slug":[0,"en/p5fft/logaverages"],"body":[0,"\n\n# logAverages\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"logAverages()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns an array of average amplitude values of the spectrum, for a given\nset of \nOctave Bands\nNOTE: analyze() must be called prior to logAverages(). Analyze()\ntells the FFT to analyze frequency data, and logAverages() uses\nthe results to group them into a smaller set of averages.
\n"],"line":[0,3889],"params":[1,[[0,{"name":[0,"octaveBands"],"description":[0,"Array of Octave Bands objects for grouping
\n"],"type":[0,"Array"]}]]],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"logAverages Array of average amplitude values for each group"],"type":[0,"Array"]}],"isConstructor":[0,false],"path":[0,"p5.FFT/logAverages"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/setInput.mdx"],"slug":[0,"en/p5fft/setinput"],"body":[0,"\n\n# setInput\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setInput()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the input source for the FFT analysis. If no source is\nprovided, FFT will analyze all sound in the sketch.
\n"],"line":[0,3476],"params":[1,[[0,{"name":[0,"source"],"description":[0,"p5.sound object (or web audio API source node)
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.FFT/setInput"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/smooth.mdx"],"slug":[0,"en/p5fft/smooth"],"body":[0,"\n\n# smooth\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"smooth()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Smooth FFT analysis by averaging with the last analysis frame.
\n"],"line":[0,3826],"params":[1,[[0,{"name":[0,"smoothing"],"description":[0,"0.0 < smoothing < 1.0.\n Defaults to 0.8.
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.FFT/smooth"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.FFT/waveform.mdx"],"slug":[0,"en/p5fft/waveform"],"body":[0,"\n\n# waveform\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"waveform()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/FFT.js"],"description":[0,"Returns an array of sample values from the input audio."],"line":[0,94],"itemtype":[0,"method"],"class":[0,"p5.FFT"],"chainable":[0,false],"return":[0,{"description":[0,"Array of sample values from -1 to -1."],"type":[0,"Array"]}],"isConstructor":[0,false],"path":[0,"p5.FFT/waveform"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Filter"],"entry":[0,{"id":[0,"en/p5.sound/p5.Filter.mdx"],"slug":[0,"en/p5sound/p5filter"],"body":[0,"\n\n# p5.Filter\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Filter"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A p5.Filter uses a Web Audio Biquad Filter to filter\nthe frequency response of an input source. Subclasses\ninclude:
\np5.LowPass
:\nAllows frequencies below the cutoff frequency to pass through,\nand attenuates frequencies above the cutoff.
\np5.HighPass
:\nThe opposite of a lowpass filter.
\np5.BandPass
:\nAllows a range of frequencies to pass through and attenuates\nthe frequencies below and above this frequency range.
\n\nThe .res()
method controls either width of the\nbandpass, or resonance of the low/highpass cutoff frequency.
\nThis class extends p5.Effect.\nMethods amp(), chain(),\ndrywet(), connect(), and\ndisconnect() are available.
\n"],"line":[0,6628],"params":[1,[[0,{"name":[0,"type"],"description":[0,"'lowpass' (default), 'highpass', 'bandpass'
\n"],"type":[0,"String"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet fft, noise, filter;\n\nfunction setup() {\n let cnv = createCanvas(100,100);\n cnv.mousePressed(makeNoise);\n fill(255, 0, 255);\n\n filter = new p5.BandPass();\n noise = new p5.Noise();\n noise.disconnect();\n noise.connect(filter);\n\n fft = new p5.FFT();\n}\n\nfunction draw() {\n background(220);\n\n // set the BandPass frequency based on mouseX\n let freq = map(mouseX, 0, width, 20, 10000);\n freq = constrain(freq, 0, 22050);\n filter.freq(freq);\n // give the filter a narrow band (lower res = wider bandpass)\n filter.res(50);\n\n // draw filtered spectrum\n let spectrum = fft.analyze();\n noStroke();\n for (let i = 0; i < spectrum.length; i++) {\n let x = map(i, 0, spectrum.length, 0, width);\n let h = -height + map(spectrum[i], 0, 255, height, 0);\n rect(x, height, width/spectrum.length, h);\n }\n if (!noise.started) {\n text('tap here and drag to change frequency', 10, 20, width - 20);\n } else {\n text('Frequency: ' + round(freq)+'Hz', 20, 20, width - 20);\n }\n}\n\nfunction makeNoise() {\n // see also: `userStartAudio()`\n noise.start();\n noise.amp(0.5, 0.2);\n}\n\nfunction mouseReleased() {\n noise.amp(0, 0.2);\n}\n\n
"]]],"methods":[0,{"process":[0,{"description":[0,"Filter an audio signal according to a set\nof filter parameters.
\n"],"path":[0,"p5.Filter/process"]}],"set":[0,{"description":[0,"Set the frequency and the resonance of the filter.
\n"],"path":[0,"p5.Filter/set"]}],"freq":[0,{"description":[0,"Set the filter frequency, in Hz, from 10 to 22050 (the range of\nhuman hearing, although in reality most people hear in a narrower\nrange).
\n"],"path":[0,"p5.Filter/freq"]}],"res":[0,{"description":[0,"Controls either width of a bandpass frequency,\nor the resonance of a low/highpass cutoff frequency.
\n"],"path":[0,"p5.Filter/res"]}],"gain":[0,{"description":[0,"Controls the gain attribute of a Biquad Filter.\nThis is distinctly different from .amp() which is inherited from p5.Effect\n.amp() controls the volume via the output gain node\np5.Filter.gain() controls the gain parameter of a Biquad Filter node.
\n"],"path":[0,"p5.Filter/gain"]}],"toggle":[0,{"description":[0,"Toggle function. Switches between the specified type and allpass
\n"],"path":[0,"p5.Filter/toggle"]}],"setType":[0,{"description":[0,"Set the type of a p5.Filter. Possible types include:\n\"lowpass\" (default), \"highpass\", \"bandpass\",\n\"lowshelf\", \"highshelf\", \"peaking\", \"notch\",\n\"allpass\".
\n"],"path":[0,"p5.Filter/setType"]}]}],"properties":[0,{"biquadFilter":[0,{"description":[0,"The p5.Filter is built with a\n\nWeb Audio BiquadFilter Node.
\n"],"path":[0,"p5.Filter/biquadFilter"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Filter"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Filter/biquadFilter.mdx"],"slug":[0,"en/p5filter/biquadfilter"],"body":[0,"\n\n# biquadFilter\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"biquadFilter"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The p5.Filter is built with a\n\nWeb Audio BiquadFilter Node.
\n"],"line":[0,6719],"itemtype":[0,"property"],"class":[0,"p5.Filter"],"isConstructor":[0,false],"path":[0,"p5.Filter/biquadFilter"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/freq.mdx"],"slug":[0,"en/p5filter/freq"],"body":[0,"\n\n# freq\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"freq()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the filter frequency, in Hz, from 10 to 22050 (the range of\nhuman hearing, although in reality most people hear in a narrower\nrange).
\n"],"line":[0,6781],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Filter Frequency
\n"],"type":[0,"Number"]}],[0,{"name":[0,"timeFromNow"],"description":[0,"schedule this event to happen\n seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"return":[0,{"description":[0,"value Returns the current frequency value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Filter/freq"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/gain.mdx"],"slug":[0,"en/p5filter/gain"],"body":[0,"\n\n# gain\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"gain()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Controls the gain attribute of a Biquad Filter.\nThis is distinctly different from .amp() which is inherited from p5.Effect\n.amp() controls the volume via the output gain node\np5.Filter.gain() controls the gain parameter of a Biquad Filter node.
\n"],"line":[0,6838],"params":[1,[[0,{"name":[0,"gain"],"description":[0,""],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"return":[0,{"description":[0,"Returns the current or updated gain value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Filter/gain"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/process.mdx"],"slug":[0,"en/p5filter/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Filter an audio signal according to a set\nof filter parameters.
\n"],"line":[0,6742],"params":[1,[[0,{"name":[0,"Signal"],"description":[0,"An object that outputs audio
\n"],"type":[0,"Object"]}],[0,{"name":[0,"freq"],"description":[0,"Frequency in Hz, from 10 to 22050
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"res"],"description":[0,"Resonance/Width of the filter frequency\n from 0.001 to 1000
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Filter/process"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/res.mdx"],"slug":[0,"en/p5filter/res"],"body":[0,"\n\n# res\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"res()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Controls either width of a bandpass frequency,\nor the resonance of a low/highpass cutoff frequency.
\n"],"line":[0,6811],"params":[1,[[0,{"name":[0,"res"],"description":[0,"Resonance/Width of filter freq\n from 0.001 to 1000
\n"],"type":[0,"Number"]}],[0,{"name":[0,"timeFromNow"],"description":[0,"schedule this event to happen\n seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"return":[0,{"description":[0,"value Returns the current res value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Filter/res"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/set.mdx"],"slug":[0,"en/p5filter/set"],"body":[0,"\n\n# set\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"set()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the frequency and the resonance of the filter.
\n"],"line":[0,6760],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Frequency in Hz, from 10 to 22050
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"res"],"description":[0,"Resonance (Q) from 0.001 to 1000
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"timeFromNow"],"description":[0,"schedule this event to happen\n seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Filter/set"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/setType.mdx"],"slug":[0,"en/p5filter/settype"],"body":[0,"\n\n# setType\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setType()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the type of a p5.Filter. Possible types include:\n\"lowpass\" (default), \"highpass\", \"bandpass\",\n\"lowshelf\", \"highshelf\", \"peaking\", \"notch\",\n\"allpass\".
\n"],"line":[0,6884],"params":[1,[[0,{"name":[0,"t"],"description":[0,""],"type":[0,"String"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Filter/setType"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Filter/toggle.mdx"],"slug":[0,"en/p5filter/toggle"],"body":[0,"\n\n# toggle\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"toggle()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Toggle function. Switches between the specified type and allpass
\n"],"line":[0,6864],"itemtype":[0,"method"],"class":[0,"p5.Filter"],"chainable":[0,false],"return":[0,{"description":[0,"[Toggle value]"],"type":[0,"Boolean"]}],"isConstructor":[0,false],"path":[0,"p5.Filter/toggle"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Gain"],"entry":[0,{"id":[0,"en/p5.sound/p5.Gain.mdx"],"slug":[0,"en/p5sound/p5gain"],"body":[0,"\n\n# p5.Gain\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Gain"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Gain.js"],"description":[0,"Generate a gain node to use for mixing and main volume."],"line":[0,10],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet cnv, soundFile, osc, gain;\n\nfunction preload() {\n soundFile = loadSound('/assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n\n gain = new p5.Gain(0.74);\n osc = new p5.Oscillator();\n osc.amp(0.74);\n osc.disconnect();\n soundFile.loop();\n soundFile.disconnect();\n\n //connect both sound sources to gain node\n soundFile.connect(gain);\n osc.connect(gain);\n}\n\nfunction playSound() {\n soundFile.play();\n soundFile.play();\n}\n\nfunction draw() {\n background(220);\n let level = map(mouseX, 0, width, 0, 1);\n gain.amp(level);\n}\n
\n"]]],"methods":[0,{"setInput":[0,{"description":[0,"Connect a source to the gain node.
\n"],"path":[0,"p5.Gain/setInput"]}],"connect":[0,{"description":[0,"Send output to a p5.sound or web audio object
\n"],"path":[0,"p5.Gain/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all output.
\n"],"path":[0,"p5.Gain/disconnect"]}],"amp":[0,{"description":[0,"Adjust the amplitude of the soundfile."],"path":[0,"p5.Gain/amp"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Gain"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Gain/amp.mdx"],"slug":[0,"en/p5gain/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Gain.js"],"description":[0,"Adjust the amplitude of the soundfile."],"line":[0,57],"params":[1,[[0,{"name":[0,"amplitude"],"description":[0,"amplitude value between 0 and 1, or an audio rate signal such as an LFO."],"type":[0,"Number, Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Gain"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Gain/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Gain/connect.mdx"],"slug":[0,"en/p5gain/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Send output to a p5.sound or web audio object
\n"],"line":[0,11070],"params":[1,[[0,{"name":[0,"unit"],"description":[0,""],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Gain"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Gain/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Gain/disconnect.mdx"],"slug":[0,"en/p5gain/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all output.
\n"],"line":[0,11084],"itemtype":[0,"method"],"class":[0,"p5.Gain"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Gain/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Gain/setInput.mdx"],"slug":[0,"en/p5gain/setinput"],"body":[0,"\n\n# setInput\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setInput()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect a source to the gain node.
\n"],"line":[0,11055],"params":[1,[[0,{"name":[0,"src"],"description":[0,"p5.sound / Web Audio object with a sound\n output.
\n"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Gain"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Gain/setInput"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.HighPass"],"entry":[0,{"id":[0,"en/p5.sound/p5.HighPass.mdx"],"slug":[0,"en/p5sound/p5highpass"],"body":[0,"\n\n# p5.HighPass\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.HighPass"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Biquad.js"],"description":[0,"Creates a Highpass Biquad filter."],"line":[0,150],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the cutoff frequency of the filter"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.HighPass"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.LowPass"],"entry":[0,{"id":[0,"en/p5.sound/p5.LowPass.mdx"],"slug":[0,"en/p5sound/p5lowpass"],"body":[0,"\n\n# p5.LowPass\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.LowPass"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Biquad.js"],"description":[0,"Creates a Lowpass Biquad filter."],"line":[0,136],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the cutoff frequency of the filter"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.LowPass"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.MonoSynth"],"entry":[0,{"id":[0,"en/p5.sound/p5.MonoSynth.mdx"],"slug":[0,"en/p5sound/p5monosynth"],"body":[0,"\n\n# p5.MonoSynth\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.MonoSynth"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A MonoSynth is used as a single voice for sound synthesis.\nThis is a class to be used in conjunction with the PolySynth\nclass. Custom synthetisers should be built inheriting from\nthis class.
\n"],"line":[0,11247],"chainable":[0,false],"example":[1,[[0,"\n\nlet monoSynth;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSynth);\n background(220);\n textAlign(CENTER);\n text('tap to play', width/2, height/2);\n\n monoSynth = new p5.MonoSynth();\n}\n\nfunction playSynth() {\n userStartAudio();\n\n let note = random(['Fb4', 'G4']);\n // note velocity (volume, from 0 to 1)\n let velocity = random();\n // time from now (in seconds)\n let time = 0;\n // note duration (in seconds)\n let dur = 1/6;\n\n monoSynth.play(note, velocity, time, dur);\n}\n
"]]],"methods":[0,{"play":[0,{"description":[0,"Play tells the MonoSynth to start playing a note. This method schedules\nthe calling of .triggerAttack and .triggerRelease.
\n"],"path":[0,"p5.MonoSynth/play"]}],"triggerAttack":[0,{"description":[0,"Trigger the Attack, and Decay portion of the Envelope.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go.
\n"],"path":[0,"p5.MonoSynth/triggerAttack"]}],"triggerRelease":[0,{"description":[0,"Trigger the release of the Envelope. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.
\n"],"path":[0,"p5.MonoSynth/triggerRelease"]}],"setADSR":[0,{"description":[0,"Set values like a traditional\n\nADSR envelope\n.
\n"],"path":[0,"p5.MonoSynth/setADSR"]}],"amp":[0,{"description":[0,"MonoSynth amp
\n"],"path":[0,"p5.MonoSynth/amp"]}],"connect":[0,{"description":[0,"Connect to a p5.sound / Web Audio object.
\n"],"path":[0,"p5.MonoSynth/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all outputs
\n"],"path":[0,"p5.MonoSynth/disconnect"]}],"dispose":[0,{"description":[0,"Get rid of the MonoSynth and free up its resources / memory.
\n"],"path":[0,"p5.MonoSynth/dispose"]}]}],"properties":[0,{"attack":[0,{"description":[0,"Getters and Setters
\n"],"path":[0,"p5.MonoSynth/attack"]}],"decay":[0,{"description":[0,""],"path":[0,"p5.MonoSynth/decay"]}],"sustain":[0,{"description":[0,""],"path":[0,"p5.MonoSynth/sustain"]}],"release":[0,{"description":[0,""],"path":[0,"p5.MonoSynth/release"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.MonoSynth"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.MonoSynth/amp.mdx"],"slug":[0,"en/p5monosynth/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"MonoSynth amp
\n"],"line":[0,11544],"params":[1,[[0,{"name":[0,"vol"],"description":[0,"desired volume
\n"],"type":[0,"Number"]}],[0,{"name":[0,"rampTime"],"description":[0,"Time to reach new volume
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"return":[0,{"description":[0,"new volume value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/attack.mdx"],"slug":[0,"en/p5monosynth/attack"],"body":[0,"\n\n# attack\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"attack"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Getters and Setters
\n"],"line":[0,11322],"itemtype":[0,"property"],"class":[0,"p5.MonoSynth"],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/attack"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/connect.mdx"],"slug":[0,"en/p5monosynth/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect to a p5.sound / Web Audio object.
\n"],"line":[0,11564],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"A p5.sound or Web Audio object
\n"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/decay.mdx"],"slug":[0,"en/p5monosynth/decay"],"body":[0,"\n\n# decay\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"decay"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,""],"line":[0,11328],"itemtype":[0,"property"],"class":[0,"p5.MonoSynth"],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/decay"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/disconnect.mdx"],"slug":[0,"en/p5monosynth/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all outputs
\n"],"line":[0,11578],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/dispose.mdx"],"slug":[0,"en/p5monosynth/dispose"],"body":[0,"\n\n# dispose\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"dispose()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get rid of the MonoSynth and free up its resources / memory.
\n"],"line":[0,11592],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/dispose"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/play.mdx"],"slug":[0,"en/p5monosynth/play"],"body":[0,"\n\n# play\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"play()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Play tells the MonoSynth to start playing a note. This method schedules\nthe calling of .triggerAttack and .triggerRelease.
\n"],"line":[0,11379],"params":[1,[[0,{"name":[0,"note"],"description":[0,"the note you want to play, specified as a\n frequency in Hertz (Number) or as a midi\n value in Note/Octave format (\"C4\", \"Eb3\"...etc\")\n See \n Tone. Defaults to 440 hz.
\n"],"type":[0,"String | Number"]}],[0,{"name":[0,"velocity"],"description":[0,"velocity of the note to play (ranging from 0 to 1)
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"secondsFromNow"],"description":[0,"time from now (in seconds) at which to play
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"sustainTime"],"description":[0,"time to sustain before releasing the envelope. Defaults to 0.15 seconds.
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"example":[1,[[0,"\n\nlet monoSynth;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSynth);\n background(220);\n textAlign(CENTER);\n text('tap to play', width/2, height/2);\n\n monoSynth = new p5.MonoSynth();\n}\n\nfunction playSynth() {\n userStartAudio();\n\n let note = random(['Fb4', 'G4']);\n // note velocity (volume, from 0 to 1)\n let velocity = random();\n // time from now (in seconds)\n let time = 0;\n // note duration (in seconds)\n let dur = 1/6;\n\n monoSynth.play(note, velocity, time, dur);\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/play"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/release.mdx"],"slug":[0,"en/p5monosynth/release"],"body":[0,"\n\n# release\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"release"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,""],"line":[0,11338],"itemtype":[0,"property"],"class":[0,"p5.MonoSynth"],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/release"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/setADSR.mdx"],"slug":[0,"en/p5monosynth/setadsr"],"body":[0,"\n\n# setADSR\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setADSR()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set values like a traditional\n\nADSR envelope\n.
\n"],"line":[0,11516],"params":[1,[[0,{"name":[0,"attackTime"],"description":[0,"Time (in seconds before envelope\n reaches Attack Level
\n"],"type":[0,"Number"]}],[0,{"name":[0,"decayTime"],"description":[0,"Time (in seconds) before envelope\n reaches Decay/Sustain Level
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"susRatio"],"description":[0,"Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange
),\n then decayLevel would increase proportionally, to become 0.5.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"releaseTime"],"description":[0,"Time in seconds from now (defaults to 0)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/setADSR"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/sustain.mdx"],"slug":[0,"en/p5monosynth/sustain"],"body":[0,"\n\n# sustain\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"sustain"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,""],"line":[0,11333],"itemtype":[0,"property"],"class":[0,"p5.MonoSynth"],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/sustain"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/triggerAttack.mdx"],"slug":[0,"en/p5monosynth/triggerattack"],"body":[0,"\n\n# triggerAttack\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"triggerAttack()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Trigger the Attack, and Decay portion of the Envelope.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go.
\n"],"line":[0,11431],"params":[1,[[0,{"name":[0,"note"],"description":[0,"the note you want to play, specified as a\n frequency in Hertz (Number) or as a midi\n value in Note/Octave format (\"C4\", \"Eb3\"...etc\")\n See \n Tone. Defaults to 440 hz
\n"],"type":[0,"String | Number"]}],[0,{"name":[0,"velocity"],"description":[0,"velocity of the note to play (ranging from 0 to 1)
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"secondsFromNow"],"description":[0,"time from now (in seconds) at which to play
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"example":[1,[[0,"\n\nlet monoSynth;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(triggerAttack);\n background(220);\n text('tap here for attack, let go to release', 5, 20, width - 20);\n monoSynth = new p5.MonoSynth();\n}\n\nfunction triggerAttack() {\n userStartAudio();\n\n monoSynth.triggerAttack(\"E3\");\n}\n\nfunction mouseReleased() {\n monoSynth.triggerRelease();\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/triggerAttack"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.MonoSynth/triggerRelease.mdx"],"slug":[0,"en/p5monosynth/triggerrelease"],"body":[0,"\n\n# triggerRelease\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"triggerRelease()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Trigger the release of the Envelope. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.
\n"],"line":[0,11478],"params":[1,[[0,{"name":[0,"secondsFromNow"],"description":[0,"time to trigger the release
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.MonoSynth"],"chainable":[0,false],"example":[1,[[0,"\n\nlet monoSynth;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(triggerAttack);\n background(220);\n text('tap here for attack, let go to release', 5, 20, width - 20);\n monoSynth = new p5.MonoSynth();\n}\n\nfunction triggerAttack() {\n userStartAudio();\n\n monoSynth.triggerAttack(\"E3\");\n}\n\nfunction mouseReleased() {\n monoSynth.triggerRelease();\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.MonoSynth/triggerRelease"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Noise"],"entry":[0,{"id":[0,"en/p5.sound/p5.Noise.mdx"],"slug":[0,"en/p5sound/p5noise"],"body":[0,"\n\n# p5.Noise\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Noise"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Noise.js"],"description":[0,"Generate a buffer with random values."],"line":[0,11],"params":[1,[[0,{"name":[0,"type"],"description":[0,"- the type of noise (white, pink, brown)"],"type":[0,"String"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet noise, env, cnv;\nlet types = ['white', 'pink', 'brown'];\nlet noiseType = 'brown';\n\nfunction setup() {\n cnv = createCanvas(100, 100);\n textAlign(CENTER);\n cnv.mousePressed(start);\n noise = new p5.Noise(noiseType);\n env = new p5.Envelope(0.01, 0.1, 0.15, 0.5);\n noise.disconnect();\n noise.connect(env);\n noise.start();\n}\n\nfunction start() {\n noiseType = random(types);\n noise.type(noiseType);\n env.play();\n}\n\nfunction draw() {\n background(noiseType);\n text('tap to play', width/2, 20);\n let txt = 'type: ' + noiseType;\n text(txt, width/2, 40);\n}\n
\n"]]],"methods":[0,{"setType":[0,{"description":[0,"Set type of noise to 'white', 'pink' or 'brown'.\nWhite is the default.
\n"],"path":[0,"p5.Noise/setType"]}],"type":[0,{"description":[0,""],"path":[0,"p5.Noise/type"]}],"amp":[0,{"description":[0,"Adjust the amplitude of the noise source."],"path":[0,"p5.Noise/amp"]}],"start":[0,{"description":[0,"Starts the noise source."],"path":[0,"p5.Noise/start"]}],"stop":[0,{"description":[0,"Stops the noise source."],"path":[0,"p5.Noise/stop"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Noise"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Noise/amp.mdx"],"slug":[0,"en/p5noise/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Noise.js"],"description":[0,"Adjust the amplitude of the noise source."],"line":[0,66],"params":[1,[[0,{"name":[0,"amplitude"],"description":[0,"Set the amplitude between 0 and 1.0. Or, pass in an object such as an oscillator to modulate amplitude with an audio signal."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Noise"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Noise/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Noise/setType.mdx"],"slug":[0,"en/p5noise/settype"],"body":[0,"\n\n# setType\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setType()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set type of noise to 'white', 'pink' or 'brown'.\nWhite is the default.
\n"],"line":[0,5657],"params":[1,[[0,{"name":[0,"type"],"description":[0,"'white', 'pink' or 'brown'
\n"],"type":[0,"String"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Noise"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Noise/setType"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Noise/start.mdx"],"slug":[0,"en/p5noise/start"],"body":[0,"\n\n# start\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"start()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Noise.js"],"description":[0,"Starts the noise source."],"line":[0,81],"itemtype":[0,"method"],"class":[0,"p5.Noise"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Noise/start"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Noise/stop.mdx"],"slug":[0,"en/p5noise/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Noise.js"],"description":[0,"Stops the noise source."],"line":[0,90],"itemtype":[0,"method"],"class":[0,"p5.Noise"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Noise/stop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Noise/type.mdx"],"slug":[0,"en/p5noise/type"],"body":[0,"\n\n# type\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"type()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Noise.js"],"description":[0,""],"line":[0,57],"params":[1,[[0,{"name":[0,"type"],"description":[0,"- the type of noise (white, pink, brown)"],"type":[0,"String"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Noise"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Noise/type"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.OnsetDetect"],"entry":[0,{"id":[0,"en/p5.sound/p5.OnsetDetect.mdx"],"slug":[0,"en/p5sound/p5onsetdetect"],"body":[0,"\n\n# p5.OnsetDetect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.OnsetDetect"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Listen for onsets (a sharp increase in volume) within a given\nfrequency range.
\n"],"line":[0,11624],"params":[1,[[0,{"name":[0,"freqLow"],"description":[0,"Low frequency
\n"],"type":[0,"Number"]}],[0,{"name":[0,"freqHigh"],"description":[0,"High frequency
\n"],"type":[0,"Number"]}],[0,{"name":[0,"threshold"],"description":[0,"Amplitude threshold between 0 (no energy) and 1 (maximum)
\n"],"type":[0,"Number"]}],[0,{"name":[0,"callback"],"description":[0,"Function to call when an onset is detected
\n"],"type":[0,"Function"]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.OnsetDetect"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.Oscillator"],"entry":[0,{"id":[0,"en/p5.sound/p5.Oscillator.mdx"],"slug":[0,"en/p5sound/p5oscillator"],"body":[0,"\n\n# p5.Oscillator\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Oscillator"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Generate Sine, Triangle, Square and Sawtooth waveforms."],"line":[0,12],"params":[1,[[0,{"name":[0,"frequency"],"description":[0,"frequency defaults to 440Hz"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"type"],"description":[0,"type of oscillator. Options:\n 'sine' (default), 'triangle',\n 'sawtooth', 'square'"],"type":[0,"String"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet osc, playing, freq, amp;\n\nfunction setup() {\n describe(\"a sketch that demonstrates the frequency and amplitude parameters of an oscillator.\");\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playOscillator);\n osc = new p5.Oscillator();\n}\n\nfunction draw() {\n background(220)\n freq = constrain(map(mouseX, 0, width, 100, 500), 100, 500);\n //amp = constrain(map(mouseY, height, 0, 0, 1), 0, 1);\n text('tap to play', 20, 20);\n text('freq: ' + freq, 20, 40);\n //text('amp: ' + amp, 20, 60);\n\n if (playing) {\n // smooth the transitions by 0.1 seconds\n osc.freq(freq);\n //osc.amp(amp);\n }\n}\n\nfunction playOscillator() {\n // starting an oscillator on a user gesture will enable audio\n // in browsers that have a strict autoplay policy.\n osc.start();\n playing = true;\n}\n\nfunction mouseReleased() {\n // ramp amplitude to 0 over 0.5 seconds\n //osc.amp(0, 0.5);\n playing = false;\n}\n
\n"]]],"methods":[0,{"start":[0,{"description":[0,"Starts the oscillator. Usually from user gesture."],"path":[0,"p5.Oscillator/start"]}],"stop":[0,{"description":[0,"Stops the oscillator."],"path":[0,"p5.Oscillator/stop"]}],"amp":[0,{"description":[0,"Adjust the amplitude of the Oscillator."],"path":[0,"p5.Oscillator/amp"]}],"getAmp":[0,{"description":[0,"Returns the value of output gain
\n"],"path":[0,"p5.Oscillator/getAmp"]}],"freq":[0,{"description":[0,"Adjusts the frequency of the oscillator."],"path":[0,"p5.Oscillator/freq"]}],"getFreq":[0,{"description":[0,"Returns the value of frequency of oscillator
\n"],"path":[0,"p5.Oscillator/getFreq"]}],"setType":[0,{"description":[0,"Sets the type of the oscillator."],"path":[0,"p5.Oscillator/setType"]}],"getType":[0,{"description":[0,"Returns current type of oscillator eg. 'sine', 'triangle', 'sawtooth' or 'square'.
\n"],"path":[0,"p5.Oscillator/getType"]}],"connect":[0,{"description":[0,"Connect to a p5.sound / Web Audio object.
\n"],"path":[0,"p5.Oscillator/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all outputs
\n"],"path":[0,"p5.Oscillator/disconnect"]}],"pan":[0,{"description":[0,"Pan between Left (-1) and Right (1)
\n"],"path":[0,"p5.Oscillator/pan"]}],"getPan":[0,{"description":[0,"Returns the current value of panPosition , between Left (-1) and Right (1)
\n"],"path":[0,"p5.Oscillator/getPan"]}],"phase":[0,{"description":[0,"Adjusts the phase of the oscillator."],"path":[0,"p5.Oscillator/phase"]}],"add":[0,{"description":[0,"Add a value to the p5.Oscillator's output amplitude,\nand return the oscillator. Calling this method again\nwill override the initial add() with a new value.
\n"],"path":[0,"p5.Oscillator/add"]}],"mult":[0,{"description":[0,"Multiply the p5.Oscillator's output amplitude\nby a fixed value (i.e. turn it up!). Calling this method\nagain will override the initial mult() with a new value.
\n"],"path":[0,"p5.Oscillator/mult"]}],"scale":[0,{"description":[0,"Scale this oscillator's amplitude values to a given\nrange, and return the oscillator. Calling this method\nagain will override the initial scale() with new values.
\n"],"path":[0,"p5.Oscillator/scale"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Oscillator"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Oscillator/add.mdx"],"slug":[0,"en/p5oscillator/add"],"body":[0,"\n\n# add\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"add()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Add a value to the p5.Oscillator's output amplitude,\nand return the oscillator. Calling this method again\nwill override the initial add() with a new value.
\n"],"line":[0,4522],"params":[1,[[0,{"name":[0,"number"],"description":[0,"Constant number to add
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"Oscillator Returns this oscillator\n with scaled output"],"type":[0,"p5.Oscillator"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/add"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/amp.mdx"],"slug":[0,"en/p5oscillator/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Adjust the amplitude of the Oscillator."],"line":[0,117],"params":[1,[[0,{"name":[0,"amplitude"],"description":[0,"Set the amplitude between 0 and 1.0. Or, pass in an object such as an oscillator to modulate amplitude with an audio signal."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet osc, lfo;\nlet cnv;\n\nfunction setup() {\n describe(\"a sketch that demonstrates amplitude modulation with an LFO and sine tone\");\n cnv = createCanvas(100, 100);\n cnv.mousePressed(startSound);\n textAlign(CENTER);\n textWrap(WORD);\n textSize(10);\n \n osc = new p5.Oscillator('sine');\n lfo = new p5.Oscillator(1);\n lfo.disconnect();\n osc.amp(lfo);\n}\n\nfunction startSound() {\n lfo.start();\n osc.start();\n}\n\nfunction draw(){\n background(220);\n text('click to play sound', 0, height/2 - 20, 100);\n text('control lfo with mouseX position', 0, height/2, 100);\n\n let freq = map(mouseX, 0, width, 0, 10);\n lfo.freq(freq);\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.Oscillator/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/connect.mdx"],"slug":[0,"en/p5oscillator/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect to a p5.sound / Web Audio object.
\n"],"line":[0,4399],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"A p5.sound or Web Audio object
\n"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/disconnect.mdx"],"slug":[0,"en/p5oscillator/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all outputs
\n"],"line":[0,4420],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/freq.mdx"],"slug":[0,"en/p5oscillator/freq"],"body":[0,"\n\n# freq\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"freq()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Adjusts the frequency of the oscillator."],"line":[0,84],"params":[1,[[0,{"name":[0,"frequency"],"description":[0,"frequency of the oscillator in Hz (cycles per second)."],"type":[0,"Number"]}],[0,{"name":[0,"rampTime"],"description":[0,"the time in seconds it takes to ramp to the new frequency (defaults to 0)."],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/freq"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/getAmp.mdx"],"slug":[0,"en/p5oscillator/getamp"],"body":[0,"\n\n# getAmp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getAmp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the value of output gain
\n"],"line":[0,4271],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"Amplitude value between 0.0 and 1.0"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/getAmp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/getFreq.mdx"],"slug":[0,"en/p5oscillator/getfreq"],"body":[0,"\n\n# getFreq\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getFreq()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the value of frequency of oscillator
\n"],"line":[0,4360],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"Frequency of oscillator in Hertz"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/getFreq"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/getPan.mdx"],"slug":[0,"en/p5oscillator/getpan"],"body":[0,"\n\n# getPan\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getPan()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the current value of panPosition , between Left (-1) and Right (1)
\n"],"line":[0,4460],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"panPosition of oscillator , between Left (-1) and Right (1)"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/getPan"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/getType.mdx"],"slug":[0,"en/p5oscillator/gettype"],"body":[0,"\n\n# getType\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getType()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns current type of oscillator eg. 'sine', 'triangle', 'sawtooth' or 'square'.
\n"],"line":[0,4386],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"type of oscillator eg . 'sine', 'triangle', 'sawtooth' or 'square'."],"type":[0,"String"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/getType"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/mult.mdx"],"slug":[0,"en/p5oscillator/mult"],"body":[0,"\n\n# mult\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"mult()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Multiply the p5.Oscillator's output amplitude\nby a fixed value (i.e. turn it up!). Calling this method\nagain will override the initial mult() with a new value.
\n"],"line":[0,4543],"params":[1,[[0,{"name":[0,"number"],"description":[0,"Constant number to multiply
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"Oscillator Returns this oscillator\n with multiplied output"],"type":[0,"p5.Oscillator"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/mult"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/pan.mdx"],"slug":[0,"en/p5oscillator/pan"],"body":[0,"\n\n# pan\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pan()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Pan between Left (-1) and Right (1)
\n"],"line":[0,4444],"params":[1,[[0,{"name":[0,"panning"],"description":[0,"Number between -1 and 1
\n"],"type":[0,"Number"]}],[0,{"name":[0,"timeFromNow"],"description":[0,"schedule this event to happen\n seconds from now
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/pan"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/phase.mdx"],"slug":[0,"en/p5oscillator/phase"],"body":[0,"\n\n# phase\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"phase()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Adjusts the phase of the oscillator."],"line":[0,95],"params":[1,[[0,{"name":[0,"phase"],"description":[0,"phase of the oscillator in degrees (0-360)."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/phase"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/scale.mdx"],"slug":[0,"en/p5oscillator/scale"],"body":[0,"\n\n# scale\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"scale()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Scale this oscillator's amplitude values to a given\nrange, and return the oscillator. Calling this method\nagain will override the initial scale() with new values.
\n"],"line":[0,4563],"params":[1,[[0,{"name":[0,"inMin"],"description":[0,"input range minumum
\n"],"type":[0,"Number"]}],[0,{"name":[0,"inMax"],"description":[0,"input range maximum
\n"],"type":[0,"Number"]}],[0,{"name":[0,"outMin"],"description":[0,"input range minumum
\n"],"type":[0,"Number"]}],[0,{"name":[0,"outMax"],"description":[0,"input range maximum
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"return":[0,{"description":[0,"Oscillator Returns this oscillator\n with scaled output"],"type":[0,"p5.Oscillator"]}],"isConstructor":[0,false],"path":[0,"p5.Oscillator/scale"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/setType.mdx"],"slug":[0,"en/p5oscillator/settype"],"body":[0,"\n\n# setType\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setType()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Sets the type of the oscillator."],"line":[0,105],"params":[1,[[0,{"name":[0,"type"],"description":[0,"type of the oscillator. Options:\n 'sine' (default), 'triangle',\n 'sawtooth', 'square'"],"type":[0,"String"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/setType"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/start.mdx"],"slug":[0,"en/p5oscillator/start"],"body":[0,"\n\n# start\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"start()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Starts the oscillator. Usually from user gesture."],"line":[0,168],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet osc;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(startOscillator);\n osc = new p5.Oscillator();\n}\n\nfunction startOscillator() {\n osc.start();\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.Oscillator/start"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Oscillator/stop.mdx"],"slug":[0,"en/p5oscillator/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Stops the oscillator."],"line":[0,193],"itemtype":[0,"method"],"class":[0,"p5.Oscillator"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Oscillator/stop"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Panner"],"entry":[0,{"id":[0,"en/p5.sound/p5.Panner.mdx"],"slug":[0,"en/p5sound/p5panner"],"body":[0,"\n\n# p5.Panner\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Panner"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner.js"],"description":[0,"A panning effect."],"line":[0,11],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet panner, lfo, soundfile, cnv;\n\nfunction preload() {\n soundfile = loadSound('//assets/beat.mp3');\n}\n\nfunction setup() {\n cnv = createCanvas(100, 100);\n background(220);\n cnv.mousePressed(startSound);\n \n panner = new p5.Panner();\n lfo = new p5.Oscillator(1);\n //disconnect lfo from speakers because we don't want to hear it!\n lfo.disconnect();\n panner.pan(lfo);\n\n soundfile.loop();\n soundfile.disconnect();\n soundfile.connect(panner);\n \n}\n\nfunction startSound() {\n lfo.start();\n soundfile.start();\n}\n
\n"]]],"methods":[0,{"pan":[0,{"description":[0,"Pan a sound source left or right."],"path":[0,"p5.Panner/pan"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Panner"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Panner/pan.mdx"],"slug":[0,"en/p5panner/pan"],"body":[0,"\n\n# pan\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pan()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner.js"],"description":[0,"Pan a sound source left or right."],"line":[0,53],"params":[1,[[0,{"name":[0,"panAmount"],"description":[0,"Sets the pan position of the sound source. Can be a value between -1 and 1 or a an audio rate signal such as an LFO."],"type":[0,"Number, Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner/pan"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Panner3D"],"entry":[0,{"id":[0,"en/p5.sound/p5.Panner3D.mdx"],"slug":[0,"en/p5sound/p5panner3d"],"body":[0,"\n\n# p5.Panner3D\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Panner3D"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"A 3D sound spatializer."],"line":[0,10],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet radius = 10 ; \nlet soundSource, spatializer;\nlet font;\nlet cnv;\n\nlet x = 0;\nlet y = 0;\nlet z = 100;\n\nlet vX;\nlet vY;\nlet vZ;\n\nfunction preload() {\n soundSource = loadSound('//assets/beat.mp3');\n font = loadFont('//assets/SourceSansPro-Regular.otf');\n}\n\nfunction setup() {\n describe(\n 'A 3D shape with a sound source attached to it. The sound source is spatialized using the Panner3D class. Click to play the sound.'\n );\n cnv = createCanvas(100, 100, WEBGL);\n cnv.mousePressed(playSound);\n\n camera(0, 0, 0, 0, 0, 1);\n \n textFont(font);\n textAlign(CENTER,CENTER);\n \n angleMode(DEGREES);\n\n vX = random(-0.5, 0.5);\n vY = random(-0.5, 0.5);\n vZ = random(-0.5, 0.5) * 1.5;\n\n spatializer = new p5.Panner3D();\n spatializer.maxDist(100);\n soundSource.loop();\n soundSource.disconnect();\n soundSource.connect(spatializer);\n}\n\nfunction playSound() {\n soundSource.play();\n}\n\nfunction draw() {\n background(220);\n push();\n textSize(5);\n fill(0);\n translate(0,0,100);\n //text('click to play', 0, 0);\n pop();\n // Update Box and Sound Source Position\n push();\n moveSoundBox();\n box(5, 5, 5);\n pop();\n}\n\n// Rotate 1 degree per frame along all three axes\nfunction moveSoundBox() {\n x = x + vX;\n y = y + vY;\n z = z + vZ;\n\n if (x > radius || x < -radius) {\n vX = -vX;\n }\n if (y > radius || y < -radius) {\n vY = -vY;\n }\n if (z > 250 || z < 80) {\n vZ = -vZ;\n }\n //set the position of the 3D panner\n spatializer.set(x, y, z);\n //set the postion of the box\n translate(x, y, z);\n rotateX(45 + frameCount);\n rotateZ(45);\n}\n
\n"]]],"methods":[0,{"process":[0,{"description":[0,"Connects an input source to the 3D panner."],"path":[0,"p5.Panner3D/process"]}],"set":[0,{"description":[0,"Set the x, y, and z position of the 3D panner."],"path":[0,"p5.Panner3D/set"]}],"positionX":[0,{"description":[0,"Set the X position of the sound source."],"path":[0,"p5.Panner3D/positionX"]}],"positionY":[0,{"description":[0,"Set the Y position of the sound source."],"path":[0,"p5.Panner3D/positionY"]}],"positionZ":[0,{"description":[0,"Set the Z position of the sound source."],"path":[0,"p5.Panner3D/positionZ"]}],"orient":[0,{"description":[0,"Set the X,Y,Z position of the Panner
\n"],"path":[0,"p5.Panner3D/orient"]}],"orientX":[0,{"description":[0,"Getter and setter methods for orient coordinates
\n"],"path":[0,"p5.Panner3D/orientX"]}],"orientY":[0,{"description":[0,"Getter and setter methods for orient coordinates
\n"],"path":[0,"p5.Panner3D/orientY"]}],"orientZ":[0,{"description":[0,"Getter and setter methods for orient coordinates
\n"],"path":[0,"p5.Panner3D/orientZ"]}],"setFalloff":[0,{"description":[0,"The rolloff rate of the panner."],"path":[0,"p5.Panner3D/setFalloff"]}],"maxDist":[0,{"description":[0,"Set the maximum distance of the panner."],"path":[0,"p5.Panner3D/maxDist"]}],"rollof":[0,{"description":[0,"How quickly the volume is reduced as the source moves away from the listener
\n"],"path":[0,"p5.Panner3D/rollof"]}],"rolloff":[0,{"description":[0,"Set the rolloff rate of the panner."],"path":[0,"p5.Panner3D/rolloff"]}]}],"properties":[0,{"panner":[0,{"description":[0,"\nWeb Audio Spatial Panner Node
\nProperties include
\n Panning Model\n : \"equal power\" or \"HRTF\"
\n DistanceModel\n: \"linear\", \"inverse\", or \"exponential\"
\n"],"path":[0,"p5.Panner3D/panner"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Panner3D"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Panner3D/maxDist.mdx"],"slug":[0,"en/p5panner3d/maxdist"],"body":[0,"\n\n# maxDist\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"maxDist()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Set the maximum distance of the panner."],"line":[0,152],"params":[1,[[0,{"name":[0,"distance"],"description":[0,"the maximum distance that the sound source can be heard from."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/maxDist"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/orient.mdx"],"slug":[0,"en/p5panner3d/orient"],"body":[0,"\n\n# orient\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"orient()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the X,Y,Z position of the Panner
\n"],"line":[0,7753],"params":[1,[[0,{"name":[0,"xVal"],"description":[0,""],"type":[0,"Number"]}],[0,{"name":[0,"yVal"],"description":[0,""],"type":[0,"Number"]}],[0,{"name":[0,"zVal"],"description":[0,""],"type":[0,"Number"]}],[0,{"name":[0,"time"],"description":[0,""],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"return":[0,{"description":[0,"Updated x, y, z values as an array"],"type":[0,"Array"]}],"isConstructor":[0,false],"path":[0,"p5.Panner3D/orient"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/orientX.mdx"],"slug":[0,"en/p5panner3d/orientx"],"body":[0,"\n\n# orientX\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"orientX()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Getter and setter methods for orient coordinates
\n"],"line":[0,7772],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"return":[0,{"description":[0,"updated coordinate value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Panner3D/orientX"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/orientY.mdx"],"slug":[0,"en/p5panner3d/orienty"],"body":[0,"\n\n# orientY\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"orientY()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Getter and setter methods for orient coordinates
\n"],"line":[0,7779],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"return":[0,{"description":[0,"updated coordinate value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Panner3D/orientY"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/orientZ.mdx"],"slug":[0,"en/p5panner3d/orientz"],"body":[0,"\n\n# orientZ\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"orientZ()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Getter and setter methods for orient coordinates
\n"],"line":[0,7786],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"return":[0,{"description":[0,"updated coordinate value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Panner3D/orientZ"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/panner.mdx"],"slug":[0,"en/p5panner3d/panner"],"body":[0,"\n\n# panner\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"panner"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"\nWeb Audio Spatial Panner Node
\nProperties include
\n Panning Model\n : \"equal power\" or \"HRTF\"
\n DistanceModel\n: \"linear\", \"inverse\", or \"exponential\"
\n"],"line":[0,7629],"itemtype":[0,"property"],"class":[0,"p5.Panner3D"],"isConstructor":[0,false],"path":[0,"p5.Panner3D/panner"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/positionX.mdx"],"slug":[0,"en/p5panner3d/positionx"],"body":[0,"\n\n# positionX\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"positionX()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Set the X position of the sound source."],"line":[0,172],"params":[1,[[0,{"name":[0,"positionX"],"description":[0,"the x position of the sound source."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/positionX"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/positionY.mdx"],"slug":[0,"en/p5panner3d/positiony"],"body":[0,"\n\n# positionY\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"positionY()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Set the Y position of the sound source."],"line":[0,182],"params":[1,[[0,{"name":[0,"positionY"],"description":[0,"the y position of the sound source."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/positionY"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/positionZ.mdx"],"slug":[0,"en/p5panner3d/positionz"],"body":[0,"\n\n# positionZ\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"positionZ()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Set the Z position of the sound source."],"line":[0,192],"params":[1,[[0,{"name":[0,"positionZ"],"description":[0,"the z position of the sound source."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/positionZ"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/process.mdx"],"slug":[0,"en/p5panner3d/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Connects an input source to the 3D panner."],"line":[0,116],"params":[1,[[0,{"name":[0,"input"],"description":[0,"an input source to process with the 3D panner."],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/process"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/rollof.mdx"],"slug":[0,"en/p5panner3d/rollof"],"body":[0,"\n\n# rollof\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"rollof()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"How quickly the volume is reduced as the source moves away from the listener
\n"],"line":[0,7869],"params":[1,[[0,{"name":[0,"rolloffFactor"],"description":[0,""],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"return":[0,{"description":[0,"updated value"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Panner3D/rollof"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/rolloff.mdx"],"slug":[0,"en/p5panner3d/rolloff"],"body":[0,"\n\n# rolloff\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"rolloff()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Set the rolloff rate of the panner."],"line":[0,162],"params":[1,[[0,{"name":[0,"r"],"description":[0,"the rolloff rate of the panner."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/rolloff"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/set.mdx"],"slug":[0,"en/p5panner3d/set"],"body":[0,"\n\n# set\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"set()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"Set the x, y, and z position of the 3D panner."],"line":[0,126],"params":[1,[[0,{"name":[0,"xPosition"],"description":[0,"the x coordinate of the panner."],"type":[0,"Number"]}],[0,{"name":[0,"yPosition"],"description":[0,"the y coordinate of the panner."],"type":[0,"Number"]}],[0,{"name":[0,"zPosition"],"description":[0,"the z coordinate of the panner."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/set"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Panner3D/setFalloff.mdx"],"slug":[0,"en/p5panner3d/setfalloff"],"body":[0,"\n\n# setFalloff\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setFalloff()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Panner3D.js"],"description":[0,"The rolloff rate of the panner."],"line":[0,140],"params":[1,[[0,{"name":[0,"rolloffFactor"],"description":[0,""],"type":[0,"Number"]}],[0,{"name":[0,"maxDistance"],"description":[0,""],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Panner3D"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Panner3D/setFalloff"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Part"],"entry":[0,{"id":[0,"en/p5.sound/p5.Part.mdx"],"slug":[0,"en/p5sound/p5part"],"body":[0,"\n\n# p5.Part\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Part"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A p5.Part plays back one or more p5.Phrases. Instantiate a part\nwith steps and tatums. By default, each step represents a 1/16th note.
\n\nSee p5.Phrase for more about musical timing.
"],"line":[0,9185],"params":[1,[[0,{"name":[0,"steps"],"description":[0,"Steps in the part
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"tatums"],"description":[0,"Divisions of a beat, e.g. use 1/4, or 0.25 for a quater note (default is 1/16, a sixteenth note)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet box, drum, myPart;\nlet boxPat = [1,0,0,2,0,2,0,0];\nlet drumPat = [0,1,1,0,2,0,1,0];\n\nfunction preload() {\n box = loadSound('/assets/beatbox.mp3');\n drum = loadSound('/assets/drum.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playMyPart);\n background(220);\n textAlign(CENTER, CENTER);\n text('tap to play', width/2, height/2);\n\n let boxPhrase = new p5.Phrase('box', playBox, boxPat);\n let drumPhrase = new p5.Phrase('drum', playDrum, drumPat);\n myPart = new p5.Part();\n myPart.addPhrase(boxPhrase);\n myPart.addPhrase(drumPhrase);\n myPart.setBPM(60);\n}\n\nfunction playBox(time, playbackRate) {\n box.rate(playbackRate);\n box.play(time);\n}\n\nfunction playDrum(time, playbackRate) {\n drum.rate(playbackRate);\n drum.play(time);\n}\n\nfunction playMyPart() {\n userStartAudio();\n\n myPart.start();\n}\n
"]]],"methods":[0,{"setBPM":[0,{"description":[0,"Set the tempo of this part, in Beats Per Minute.
\n"],"path":[0,"p5.Part/setBPM"]}],"getBPM":[0,{"description":[0,"Returns the tempo, in Beats Per Minute, of this part.
\n"],"path":[0,"p5.Part/getBPM"]}],"start":[0,{"description":[0,"Start playback of this part. It will play\nthrough all of its phrases at a speed\ndetermined by setBPM.
\n"],"path":[0,"p5.Part/start"]}],"loop":[0,{"description":[0,"Loop playback of this part. It will begin\nlooping through all of its phrases at a speed\ndetermined by setBPM.
\n"],"path":[0,"p5.Part/loop"]}],"noLoop":[0,{"description":[0,"Tell the part to stop looping.
\n"],"path":[0,"p5.Part/noLoop"]}],"stop":[0,{"description":[0,"Stop the part and cue it to step 0. Playback will resume from the begining of the Part when it is played again.
\n"],"path":[0,"p5.Part/stop"]}],"pause":[0,{"description":[0,"Pause the part. Playback will resume\nfrom the current step.
\n"],"path":[0,"p5.Part/pause"]}],"addPhrase":[0,{"description":[0,"Add a p5.Phrase to this Part.
\n"],"path":[0,"p5.Part/addPhrase"]}],"removePhrase":[0,{"description":[0,"Remove a phrase from this part, based on the name it was\ngiven when it was created.
\n"],"path":[0,"p5.Part/removePhrase"]}],"getPhrase":[0,{"description":[0,"Get a phrase from this part, based on the name it was\ngiven when it was created. Now you can modify its array.
\n"],"path":[0,"p5.Part/getPhrase"]}],"replaceSequence":[0,{"description":[0,"Find all sequences with the specified name, and replace their patterns with the specified array.
\n"],"path":[0,"p5.Part/replaceSequence"]}],"onStep":[0,{"description":[0,"Set the function that will be called at every step. This will clear the previous function.
\n"],"path":[0,"p5.Part/onStep"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Part"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Part/addPhrase.mdx"],"slug":[0,"en/p5part/addphrase"],"body":[0,"\n\n# addPhrase\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"addPhrase()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Add a p5.Phrase to this Part.
\n"],"line":[0,9379],"params":[1,[[0,{"name":[0,"phrase"],"description":[0,"reference to a p5.Phrase
\n"],"type":[0,"p5.Phrase"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/addPhrase"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/getBPM.mdx"],"slug":[0,"en/p5part/getbpm"],"body":[0,"\n\n# getBPM\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getBPM()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the tempo, in Beats Per Minute, of this part.
\n"],"line":[0,9278],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"return":[0,{"description":[0,""],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.Part/getBPM"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/getPhrase.mdx"],"slug":[0,"en/p5part/getphrase"],"body":[0,"\n\n# getPhrase\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getPhrase()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get a phrase from this part, based on the name it was\ngiven when it was created. Now you can modify its array.
\n"],"line":[0,9424],"params":[1,[[0,{"name":[0,"phraseName"],"description":[0,""],"type":[0,"String"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/getPhrase"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/loop.mdx"],"slug":[0,"en/p5part/loop"],"body":[0,"\n\n# loop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"loop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Loop playback of this part. It will begin\nlooping through all of its phrases at a speed\ndetermined by setBPM.
\n"],"line":[0,9311],"params":[1,[[0,{"name":[0,"time"],"description":[0,"seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/loop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/noLoop.mdx"],"slug":[0,"en/p5part/noloop"],"body":[0,"\n\n# noLoop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"noLoop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Tell the part to stop looping.
\n"],"line":[0,9333],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/noLoop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/onStep.mdx"],"slug":[0,"en/p5part/onstep"],"body":[0,"\n\n# onStep\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"onStep()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the function that will be called at every step. This will clear the previous function.
\n"],"line":[0,9473],"params":[1,[[0,{"name":[0,"callback"],"description":[0,"The name of the callback\n you want to fire\n on every beat/tatum.
\n"],"type":[0,"Function"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/onStep"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/pause.mdx"],"slug":[0,"en/p5part/pause"],"body":[0,"\n\n# pause\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pause()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Pause the part. Playback will resume\nfrom the current step.
\n"],"line":[0,9363],"params":[1,[[0,{"name":[0,"time"],"description":[0,"seconds from now
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/pause"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/removePhrase.mdx"],"slug":[0,"en/p5part/removephrase"],"body":[0,"\n\n# removePhrase\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"removePhrase()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Remove a phrase from this part, based on the name it was\ngiven when it was created.
\n"],"line":[0,9406],"params":[1,[[0,{"name":[0,"phraseName"],"description":[0,""],"type":[0,"String"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/removePhrase"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/replaceSequence.mdx"],"slug":[0,"en/p5part/replacesequence"],"body":[0,"\n\n# replaceSequence\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"replaceSequence()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Find all sequences with the specified name, and replace their patterns with the specified array.
\n"],"line":[0,9442],"params":[1,[[0,{"name":[0,"phraseName"],"description":[0,""],"type":[0,"String"]}],[0,{"name":[0,"sequence"],"description":[0,"Array of values to pass into the callback\n at each step of the phrase.
\n"],"type":[0,"Array"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/replaceSequence"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/setBPM.mdx"],"slug":[0,"en/p5part/setbpm"],"body":[0,"\n\n# setBPM\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setBPM()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the tempo of this part, in Beats Per Minute.
\n"],"line":[0,9263],"params":[1,[[0,{"name":[0,"BPM"],"description":[0,"Beats Per Minute
\n"],"type":[0,"Number"]}],[0,{"name":[0,"rampTime"],"description":[0,"Seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/setBPM"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/start.mdx"],"slug":[0,"en/p5part/start"],"body":[0,"\n\n# start\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"start()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Start playback of this part. It will play\nthrough all of its phrases at a speed\ndetermined by setBPM.
\n"],"line":[0,9291],"params":[1,[[0,{"name":[0,"time"],"description":[0,"seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/start"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Part/stop.mdx"],"slug":[0,"en/p5part/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Stop the part and cue it to step 0. Playback will resume from the begining of the Part when it is played again.
\n"],"line":[0,9349],"params":[1,[[0,{"name":[0,"time"],"description":[0,"seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Part"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Part/stop"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.PeakDetect"],"entry":[0,{"id":[0,"en/p5.sound/p5.PeakDetect.mdx"],"slug":[0,"en/p5sound/p5peakdetect"],"body":[0,"\n\n# p5.PeakDetect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.PeakDetect"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"PeakDetect works in conjunction with p5.FFT to\nlook for onsets in some or all of the frequency spectrum.\n
\n\nTo use p5.PeakDetect, call update
in the draw loop\nand pass in a p5.FFT object.\n
\n\nYou can listen for a specific part of the frequency spectrum by\nsetting the range between freq1
and freq2
.\n
\n\nthreshold
is the threshold for detecting a peak,\nscaled between 0 and 1. It is logarithmic, so 0.1 is half as loud\nas 1.0.
\n\n\nThe update method is meant to be run in the draw loop, and\nframes determines how many loops must pass before\nanother peak can be detected.\nFor example, if the frameRate() = 60, you could detect the beat of a\n120 beat-per-minute song with this equation:\n framesPerPeak = 60 / (estimatedBPM / 60 );
\n
\n\n\nBased on example contribtued by @b2renger, and a simple beat detection\nexplanation by Felix Turner.\n
"],"line":[0,10312],"params":[1,[[0,{"name":[0,"freq1"],"description":[0,"lowFrequency - defaults to 20Hz
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"freq2"],"description":[0,"highFrequency - defaults to 20000 Hz
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"threshold"],"description":[0,"Threshold for detecting a beat between 0 and 1\n scaled logarithmically where 0.1 is 1/2 the loudness\n of 1.0. Defaults to 0.35.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"framesPerPeak"],"description":[0,"Defaults to 20.
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n\nvar cnv, soundFile, fft, peakDetect;\nvar ellipseWidth = 10;\n\nfunction preload() {\n soundFile = loadSound('/assets/beat.mp3');\n}\n\nfunction setup() {\n background(0);\n noStroke();\n fill(255);\n textAlign(CENTER);\n\n // p5.PeakDetect requires a p5.FFT\n fft = new p5.FFT();\n peakDetect = new p5.PeakDetect();\n}\n\nfunction draw() {\n background(0);\n text('click to play/pause', width/2, height/2);\n\n // peakDetect accepts an fft post-analysis\n fft.analyze();\n peakDetect.update(fft);\n\n if ( peakDetect.isDetected ) {\n ellipseWidth = 50;\n } else {\n ellipseWidth *= 0.95;\n }\n\n ellipse(width/2, height/2, ellipseWidth, ellipseWidth);\n}\n\n// toggle play/stop when canvas is clicked\nfunction mouseClicked() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n if (soundFile.isPlaying() ) {\n soundFile.stop();\n } else {\n soundFile.play();\n }\n }\n}\n
"]]],"methods":[0,{"update":[0,{"description":[0,"The update method is run in the draw loop.
\nAccepts an FFT object. You must call .analyze()\non the FFT object prior to updating the peakDetect\nbecause it relies on a completed FFT analysis.
\n"],"path":[0,"p5.PeakDetect/update"]}],"onPeak":[0,{"description":[0,"onPeak accepts two arguments: a function to call when\na peak is detected. The value of the peak,\nbetween 0.0 and 1.0, is passed to the callback.
\n"],"path":[0,"p5.PeakDetect/onPeak"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.PeakDetect"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.PeakDetect/onPeak.mdx"],"slug":[0,"en/p5peakdetect/onpeak"],"body":[0,"\n\n# onPeak\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"onPeak()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"onPeak accepts two arguments: a function to call when\na peak is detected. The value of the peak,\nbetween 0.0 and 1.0, is passed to the callback.
\n"],"line":[0,10470],"params":[1,[[0,{"name":[0,"callback"],"description":[0,"Name of a function that will\n be called when a peak is\n detected.
\n"],"type":[0,"Function"]}],[0,{"name":[0,"val"],"description":[0,"Optional value to pass\n into the function when\n a peak is detected.
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.PeakDetect"],"chainable":[0,false],"example":[1,[[0,"\n\nvar cnv, soundFile, fft, peakDetect;\nvar ellipseWidth = 0;\n\nfunction preload() {\n soundFile = loadSound('/assets/beat.mp3');\n}\n\nfunction setup() {\n cnv = createCanvas(100,100);\n textAlign(CENTER);\n\n fft = new p5.FFT();\n peakDetect = new p5.PeakDetect();\n\n setupSound();\n\n // when a beat is detected, call triggerBeat()\n peakDetect.onPeak(triggerBeat);\n}\n\nfunction draw() {\n background(0);\n fill(255);\n text('click to play', width/2, height/2);\n\n fft.analyze();\n peakDetect.update(fft);\n\n ellipseWidth *= 0.95;\n ellipse(width/2, height/2, ellipseWidth, ellipseWidth);\n}\n\n// this function is called by peakDetect.onPeak\nfunction triggerBeat() {\n ellipseWidth = 50;\n}\n\n// mouseclick starts/stops sound\nfunction setupSound() {\n cnv.mouseClicked( function() {\n if (soundFile.isPlaying() ) {\n soundFile.stop();\n } else {\n soundFile.play();\n }\n });\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.PeakDetect/onPeak"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PeakDetect/update.mdx"],"slug":[0,"en/p5peakdetect/update"],"body":[0,"\n\n# update\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"update()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"The update method is run in the draw loop.
\nAccepts an FFT object. You must call .analyze()\non the FFT object prior to updating the peakDetect\nbecause it relies on a completed FFT analysis.
\n"],"line":[0,10432],"params":[1,[[0,{"name":[0,"fftObject"],"description":[0,"A p5.FFT object
\n"],"type":[0,"p5.FFT"]}]]],"itemtype":[0,"method"],"class":[0,"p5.PeakDetect"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PeakDetect/update"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Phrase"],"entry":[0,{"id":[0,"en/p5.sound/p5.Phrase.mdx"],"slug":[0,"en/p5sound/p5phrase"],"body":[0,"\n\n# p5.Phrase\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Phrase"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A phrase is a pattern of musical events over time, i.e.\na series of notes and rests.
\n\nPhrases must be added to a p5.Part for playback, and\neach part can play multiple phrases at the same time.\nFor example, one Phrase might be a kick drum, another\ncould be a snare, and another could be the bassline.
\n\nThe first parameter is a name so that the phrase can be\nmodified or deleted later. The callback is a a function that\nthis phrase will call at every step—for example it might be\ncalled playNote(value){}
. The array determines\nwhich value is passed into the callback at each step of the\nphrase. It can be numbers, an object with multiple numbers,\nor a zero (0) indicates a rest so the callback won't be called).
"],"line":[0,9103],"params":[1,[[0,{"name":[0,"name"],"description":[0,"Name so that you can access the Phrase.
\n"],"type":[0,"String"]}],[0,{"name":[0,"callback"],"description":[0,"The name of a function that this phrase\n will call. Typically it will play a sound,\n and accept two parameters: a time at which\n to play the sound (in seconds from now),\n and a value from the sequence array. The\n time should be passed into the play() or\n start() method to ensure precision.
\n"],"type":[0,"Function"]}],[0,{"name":[0,"sequence"],"description":[0,"Array of values to pass into the callback\n at each step of the phrase.
\n"],"type":[0,"Array"]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet mySound, myPhrase, myPart;\nlet pattern = [1,0,0,2,0,2,0,0];\n\nfunction preload() {\n mySound = loadSound('/assets/beatbox.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playMyPart);\n background(220);\n text('tap to play', width/2, height/2);\n textAlign(CENTER, CENTER);\n\n myPhrase = new p5.Phrase('bbox', onEachStep, pattern);\n myPart = new p5.Part();\n myPart.addPhrase(myPhrase);\n myPart.setBPM(60);\n}\n\nfunction onEachStep(time, playbackRate) {\n mySound.rate(playbackRate);\n mySound.play(time);\n}\n\nfunction playMyPart() {\n userStartAudio();\n myPart.start();\n}\n
"]]],"properties":[0,{"sequence":[0,{"description":[0,"Array of values to pass into the callback\nat each step of the phrase. Depending on the callback\nfunction's requirements, these values may be numbers,\nstrings, or an object with multiple parameters.\nZero (0) indicates a rest.
\n"],"path":[0,"p5.Phrase/sequence"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Phrase"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Phrase/sequence.mdx"],"slug":[0,"en/p5phrase/sequence"],"body":[0,"\n\n# sequence\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"sequence"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Array of values to pass into the callback\nat each step of the phrase. Depending on the callback\nfunction's requirements, these values may be numbers,\nstrings, or an object with multiple parameters.\nZero (0) indicates a rest.
\n"],"line":[0,9173],"itemtype":[0,"property"],"class":[0,"p5.Phrase"],"isConstructor":[0,false],"path":[0,"p5.Phrase/sequence"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.PitchShifter"],"entry":[0,{"id":[0,"en/p5.sound/p5.PitchShifter.mdx"],"slug":[0,"en/p5sound/p5pitchshifter"],"body":[0,"\n\n# p5.PitchShifter\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.PitchShifter"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/PitchShifter.js"],"description":[0,"Change the pitch of a sound."],"line":[0,10],"chainable":[0,false],"example":[1,[[0,"\n\n\n let cnv, soundFile, pitchShifter;\n \nfunction preload() {\n soundFile = loadSound('//assets/beatbox.mp3');\n}\n \nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mousePressed(startSound);\n background(220);\n textAlign(CENTER);\n textSize(9);\n text('click to play sound', width/2, height/2);\n pitchShifter = new p5.PitchShifter();\n \n soundFile.disconnect();\n soundFile.connect(pitchShifter);\n //change the pitch and retrigger sample when done playing\n soundFile.onended(changePitch);\n}\n\nfunction startSound () {\n soundFile.play();\n}\n \nfunction changePitch () {\n let pitchValue = random(-12, 12);\n pitchShifter.shift(pitchValue);\n soundFile.play();\n}\n
\n"]]],"methods":[0,{"shift":[0,{"description":[0,"Shift the pitch of the source audio."],"path":[0,"p5.PitchShifter/shift"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.PitchShifter"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.PitchShifter/shift.mdx"],"slug":[0,"en/p5pitchshifter/shift"],"body":[0,"\n\n# shift\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"shift()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/PitchShifter.js"],"description":[0,"Shift the pitch of the source audio."],"line":[0,55],"params":[1,[[0,{"name":[0,"pitchValue"],"description":[0,"amount of semitones to shift the pitch"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.PitchShifter"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PitchShifter/shift"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.PolySynth"],"entry":[0,{"id":[0,"en/p5.sound/p5.PolySynth.mdx"],"slug":[0,"en/p5sound/p5polysynth"],"body":[0,"\n\n# p5.PolySynth\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.PolySynth"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"An AudioVoice is used as a single voice for sound synthesis.\nThe PolySynth class holds an array of AudioVoice, and deals\nwith voices allocations, with setting notes to be played, and\nparameters to be set.
\n"],"line":[0,11691],"params":[1,[[0,{"name":[0,"synthVoice"],"description":[0,"A monophonic synth voice inheriting\n the AudioVoice class. Defaults to p5.MonoSynth
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"maxVoices"],"description":[0,"Number of voices, defaults to 8;
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet polySynth;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSynth);\n background(220);\n text('click to play', 20, 20);\n\n polySynth = new p5.PolySynth();\n}\n\nfunction playSynth() {\n userStartAudio();\n\n // note duration (in seconds)\n let dur = 1.5;\n\n // time from now (in seconds)\n let time = 0;\n\n // velocity (volume, from 0 to 1)\n let vel = 0.1;\n\n // notes can overlap with each other\n polySynth.play('G2', vel, 0, dur);\n polySynth.play('C3', vel, time += 1/3, dur);\n polySynth.play('G3', vel, time += 1/3, dur);\n}\n
"]]],"methods":[0,{"play":[0,{"description":[0,"Play a note by triggering noteAttack and noteRelease with sustain time
\n"],"path":[0,"p5.PolySynth/play"]}],"noteADSR":[0,{"description":[0,"noteADSR sets the envelope for a specific note that has just been triggered.\nUsing this method modifies the envelope of whichever audiovoice is being used\nto play the desired note. The envelope should be reset before noteRelease is called\nin order to prevent the modified envelope from being used on other notes.
\n"],"path":[0,"p5.PolySynth/noteADSR"]}],"setADSR":[0,{"description":[0,"Set the PolySynths global envelope. This method modifies the envelopes of each\nmonosynth so that all notes are played with this envelope.
\n"],"path":[0,"p5.PolySynth/setADSR"]}],"noteAttack":[0,{"description":[0,"Trigger the Attack, and Decay portion of a MonoSynth.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go.
\n"],"path":[0,"p5.PolySynth/noteAttack"]}],"noteRelease":[0,{"description":[0,"Trigger the Release of an AudioVoice note. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.
\n"],"path":[0,"p5.PolySynth/noteRelease"]}],"connect":[0,{"description":[0,"Connect to a p5.sound / Web Audio object.
\n"],"path":[0,"p5.PolySynth/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all outputs
\n"],"path":[0,"p5.PolySynth/disconnect"]}],"dispose":[0,{"description":[0,"Get rid of the MonoSynth and free up its resources / memory.
\n"],"path":[0,"p5.PolySynth/dispose"]}]}],"properties":[0,{"notes":[0,{"description":[0,"An object that holds information about which notes have been played and\nwhich notes are currently being played. New notes are added as keys\non the fly. While a note has been attacked, but not released, the value of the\nkey is the audiovoice which is generating that note. When notes are released,\nthe value of the key becomes undefined.
\n"],"path":[0,"p5.PolySynth/notes"]}],"polyvalue":[0,{"description":[0,"A PolySynth must have at least 1 voice, defaults to 8
\n"],"path":[0,"p5.PolySynth/polyvalue"]}],"AudioVoice":[0,{"description":[0,"Monosynth that generates the sound for each note that is triggered. The\np5.PolySynth defaults to using the p5.MonoSynth as its voice.
\n"],"path":[0,"p5.PolySynth/AudioVoice"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.PolySynth"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.PolySynth/AudioVoice.mdx"],"slug":[0,"en/p5polysynth/audiovoice"],"body":[0,"\n\n# AudioVoice\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"AudioVoice"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Monosynth that generates the sound for each note that is triggered. The\np5.PolySynth defaults to using the p5.MonoSynth as its voice.
\n"],"line":[0,11761],"itemtype":[0,"property"],"class":[0,"p5.PolySynth"],"isConstructor":[0,false],"path":[0,"p5.PolySynth/AudioVoice"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/connect.mdx"],"slug":[0,"en/p5polysynth/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect to a p5.sound / Web Audio object.
\n"],"line":[0,12105],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"A p5.sound or Web Audio object
\n"],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PolySynth/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/disconnect.mdx"],"slug":[0,"en/p5polysynth/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all outputs
\n"],"line":[0,12119],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PolySynth/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/dispose.mdx"],"slug":[0,"en/p5polysynth/dispose"],"body":[0,"\n\n# dispose\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"dispose()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Get rid of the MonoSynth and free up its resources / memory.
\n"],"line":[0,12133],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PolySynth/dispose"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/noteADSR.mdx"],"slug":[0,"en/p5polysynth/noteadsr"],"body":[0,"\n\n# noteADSR\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"noteADSR()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"noteADSR sets the envelope for a specific note that has just been triggered.\nUsing this method modifies the envelope of whichever audiovoice is being used\nto play the desired note. The envelope should be reset before noteRelease is called\nin order to prevent the modified envelope from being used on other notes.
\n"],"line":[0,11849],"params":[1,[[0,{"name":[0,"note"],"description":[0,"Midi note on which ADSR should be set.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"attackTime"],"description":[0,"Time (in seconds before envelope\n reaches Attack Level
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"decayTime"],"description":[0,"Time (in seconds) before envelope\n reaches Decay/Sustain Level
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"susRatio"],"description":[0,"Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange
),\n then decayLevel would increase proportionally, to become 0.5.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"releaseTime"],"description":[0,"Time in seconds from now (defaults to 0)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PolySynth/noteADSR"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/noteAttack.mdx"],"slug":[0,"en/p5polysynth/noteattack"],"body":[0,"\n\n# noteAttack\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"noteAttack()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Trigger the Attack, and Decay portion of a MonoSynth.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go.
\n"],"line":[0,11909],"params":[1,[[0,{"name":[0,"note"],"description":[0,"midi note on which attack should be triggered.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"velocity"],"description":[0,"velocity of the note to play (ranging from 0 to 1)/
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"secondsFromNow"],"description":[0,"time from now (in seconds)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"example":[1,[[0,"\n\nlet polySynth = new p5.PolySynth();\nlet pitches = ['G', 'D', 'G', 'C'];\nlet octaves = [2, 3, 4];\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playChord);\n background(220);\n text('tap to play', 20, 20);\n}\n\nfunction playChord() {\n userStartAudio();\n\n // play a chord: multiple notes at the same time\n for (let i = 0; i < 4; i++) {\n let note = random(pitches) + random(octaves);\n polySynth.noteAttack(note, 0.1);\n }\n}\n\nfunction mouseReleased() {\n // release all voices\n polySynth.noteRelease();\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.PolySynth/noteAttack"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/noteRelease.mdx"],"slug":[0,"en/p5polysynth/noterelease"],"body":[0,"\n\n# noteRelease\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"noteRelease()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Trigger the Release of an AudioVoice note. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.
\n"],"line":[0,12021],"params":[1,[[0,{"name":[0,"note"],"description":[0,"midi note on which attack should be triggered.\n If no value is provided, all notes will be released.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"secondsFromNow"],"description":[0,"time to trigger the release
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"example":[1,[[0,"\n\nlet polySynth = new p5.PolySynth();\nlet pitches = ['G', 'D', 'G', 'C'];\nlet octaves = [2, 3, 4];\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playChord);\n background(220);\n text('tap to play', 20, 20);\n}\n\nfunction playChord() {\n userStartAudio();\n\n // play a chord: multiple notes at the same time\n for (let i = 0; i < 4; i++) {\n let note = random(pitches) + random(octaves);\n polySynth.noteAttack(note, 0.1);\n }\n}\n\nfunction mouseReleased() {\n // release all voices\n polySynth.noteRelease();\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.PolySynth/noteRelease"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/notes.mdx"],"slug":[0,"en/p5polysynth/notes"],"body":[0,"\n\n# notes\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"notes"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"An object that holds information about which notes have been played and\nwhich notes are currently being played. New notes are added as keys\non the fly. While a note has been attacked, but not released, the value of the\nkey is the audiovoice which is generating that note. When notes are released,\nthe value of the key becomes undefined.
\n"],"line":[0,11742],"itemtype":[0,"property"],"class":[0,"p5.PolySynth"],"isConstructor":[0,false],"path":[0,"p5.PolySynth/notes"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/play.mdx"],"slug":[0,"en/p5polysynth/play"],"body":[0,"\n\n# play\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"play()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Play a note by triggering noteAttack and noteRelease with sustain time
\n"],"line":[0,11800],"params":[1,[[0,{"name":[0,"note"],"description":[0,"midi note to play (ranging from 0 to 127 - 60 being a middle C)
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"velocity"],"description":[0,"velocity of the note to play (ranging from 0 to 1)
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"secondsFromNow"],"description":[0,"time from now (in seconds) at which to play
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"sustainTime"],"description":[0,"time to sustain before releasing the envelope
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"example":[1,[[0,"\n\nlet polySynth;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSynth);\n background(220);\n text('click to play', 20, 20);\n\n polySynth = new p5.PolySynth();\n}\n\nfunction playSynth() {\n userStartAudio();\n\n // note duration (in seconds)\n let dur = 1.5;\n\n // time from now (in seconds)\n let time = 0;\n\n // velocity (volume, from 0 to 1)\n let vel = 0.1;\n\n // notes can overlap with each other\n polySynth.play('G2', vel, 0, dur);\n polySynth.play('C3', vel, time += 1/3, dur);\n polySynth.play('G3', vel, time += 1/3, dur);\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.PolySynth/play"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/polyvalue.mdx"],"slug":[0,"en/p5polysynth/polyvalue"],"body":[0,"\n\n# polyvalue\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"polyvalue"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A PolySynth must have at least 1 voice, defaults to 8
\n"],"line":[0,11755],"itemtype":[0,"property"],"class":[0,"p5.PolySynth"],"isConstructor":[0,false],"path":[0,"p5.PolySynth/polyvalue"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.PolySynth/setADSR.mdx"],"slug":[0,"en/p5polysynth/setadsr"],"body":[0,"\n\n# setADSR\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setADSR()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the PolySynths global envelope. This method modifies the envelopes of each\nmonosynth so that all notes are played with this envelope.
\n"],"line":[0,11881],"params":[1,[[0,{"name":[0,"attackTime"],"description":[0,"Time (in seconds before envelope\n reaches Attack Level
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"decayTime"],"description":[0,"Time (in seconds) before envelope\n reaches Decay/Sustain Level
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"susRatio"],"description":[0,"Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange
),\n then decayLevel would increase proportionally, to become 0.5.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"releaseTime"],"description":[0,"Time in seconds from now (defaults to 0)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.PolySynth"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.PolySynth/setADSR"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Pulse"],"entry":[0,{"id":[0,"en/p5.sound/p5.Pulse.mdx"],"slug":[0,"en/p5sound/p5pulse"],"body":[0,"\n\n# p5.Pulse\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Pulse"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Creates a Pulse object, an oscillator that implements\nPulse Width Modulation.\nThe pulse is created with two oscillators.\nAccepts a parameter for frequency, and to set the\nwidth between the pulses. See \np5.Oscillator
for a full list of methods.
\n"],"line":[0,5779],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Frequency in oscillations per second (Hz)
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"w"],"description":[0,"Width between the pulses (0 to 1.0,\n defaults to 0)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\nlet pulse;\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(startPulse);\n background(220);\n\n pulse = new p5.Pulse();\n pulse.amp(0.5);\n pulse.freq(220);\n}\nfunction startPulse() {\n pulse.start();\n pulse.amp(0.5, 0.02);\n}\nfunction mouseReleased() {\n pulse.amp(0, 0.2);\n}\nfunction draw() {\n background(220);\n text('tap to play', 5, 20, width - 20);\n let w = map(mouseX, 0, width, 0, 1);\n w = constrain(w, 0, 1);\n pulse.width(w);\n text('pulse width: ' + w, 5, height - 20);\n}\n
"]]],"methods":[0,{"width":[0,{"description":[0,"Set the width of a Pulse object (an oscillator that implements\nPulse Width Modulation).
\n"],"path":[0,"p5.Pulse/width"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Pulse"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Pulse/width.mdx"],"slug":[0,"en/p5pulse/width"],"body":[0,"\n\n# width\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"width()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the width of a Pulse object (an oscillator that implements\nPulse Width Modulation).
\n"],"line":[0,5871],"params":[1,[[0,{"name":[0,"width"],"description":[0,"Width between the pulses (0 to 1.0,\n defaults to 0)
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Pulse"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Pulse/width"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.Reverb"],"entry":[0,{"id":[0,"en/p5.sound/p5.Reverb.mdx"],"slug":[0,"en/p5sound/p5reverb"],"body":[0,"\n\n# p5.Reverb\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Reverb"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Reverb.js"],"description":[0,"Add reverb to a sound."],"line":[0,10],"params":[1,[[0,{"name":[0,"decayTime"],"description":[0,"Set the decay time of the reverb"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet noise, osc, env, reverb;\nlet randomTime = 0;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n noise = new p5.Noise();\n env = new p5.Envelope();\n reverb = new p5.Reverb();\n noise.disconnect();\n noise.connect(env);\n env.disconnect();\n env.connect(reverb);\n noise.start();\n textAlign(CENTER);\n}\n\nfunction playSound() {\n randomTime = random(0.1, 3);\n reverb.set(randomTime); \n env.play();\n}\n\nfunction draw() {\n background(220);\n text('click to play', width/2, 20);\n text('decay ' + round(randomTime, 2), width/2, 40);\n describe('Click to play a sound with a random decay time.');\n}\n
\n"]]],"methods":[0,{"process":[0,{"description":[0,"Connect a source to the reverb, and assign reverb parameters.
\n"],"path":[0,"p5.Reverb/process"]}],"set":[0,{"description":[0,"Set the decay time of the reverb."],"path":[0,"p5.Reverb/set"]}],"amp":[0,{"description":[0,"Set the output level of the reverb effect.
\n"],"path":[0,"p5.Reverb/amp"]}],"connect":[0,{"description":[0,"Send output to a p5.sound or web audio object
\n"],"path":[0,"p5.Reverb/connect"]}],"disconnect":[0,{"description":[0,"Disconnect all output.
\n"],"path":[0,"p5.Reverb/disconnect"]}],"drywet":[0,{"description":[0,"Adjust the dry/wet value."],"path":[0,"p5.Reverb/drywet"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Reverb"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Reverb/amp.mdx"],"slug":[0,"en/p5reverb/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the output level of the reverb effect.
\n"],"line":[0,8482],"params":[1,[[0,{"name":[0,"volume"],"description":[0,"amplitude between 0 and 1.0
\n"],"type":[0,"Number"]}],[0,{"name":[0,"rampTime"],"description":[0,"create a fade that lasts rampTime
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"timeFromNow"],"description":[0,"schedule this event to happen\n seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Reverb"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Reverb/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Reverb/connect.mdx"],"slug":[0,"en/p5reverb/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Send output to a p5.sound or web audio object
\n"],"line":[0,8493],"params":[1,[[0,{"name":[0,"unit"],"description":[0,""],"type":[0,"Object"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Reverb"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Reverb/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Reverb/disconnect.mdx"],"slug":[0,"en/p5reverb/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnect all output.
\n"],"line":[0,8501],"itemtype":[0,"method"],"class":[0,"p5.Reverb"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Reverb/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Reverb/drywet.mdx"],"slug":[0,"en/p5reverb/drywet"],"body":[0,"\n\n# drywet\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"drywet()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Reverb.js"],"description":[0,"Adjust the dry/wet value."],"line":[0,66],"params":[1,[[0,{"name":[0,"mix"],"description":[0,"The desired mix between the original and the affected signal. A number between 0 and 1. 0 is all dry, 1 is completely affected."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Reverb"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Reverb/drywet"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Reverb/process.mdx"],"slug":[0,"en/p5reverb/process"],"body":[0,"\n\n# process\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"process()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect a source to the reverb, and assign reverb parameters.
\n"],"line":[0,8409],"params":[1,[[0,{"name":[0,"src"],"description":[0,"p5.sound / Web Audio object with a sound\n output.
\n"],"type":[0,"Object"]}],[0,{"name":[0,"seconds"],"description":[0,"Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"decayRate"],"description":[0,"Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"reverse"],"description":[0,"Play the reverb backwards or forwards.
\n"],"type":[0,"Boolean"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.Reverb"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Reverb/process"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Reverb/set.mdx"],"slug":[0,"en/p5reverb/set"],"body":[0,"\n\n# set\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"set()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Reverb.js"],"description":[0,"Set the decay time of the reverb."],"line":[0,56],"params":[1,[[0,{"name":[0,"time"],"description":[0,"Decay time of the reverb in seconds."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Reverb"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Reverb/set"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.SawOsc"],"entry":[0,{"id":[0,"en/p5.sound/p5.SawOsc.mdx"],"slug":[0,"en/p5sound/p5sawosc"],"body":[0,"\n\n# p5.SawOsc\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.SawOsc"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Creates a sawtooth oscillator."],"line":[0,219],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the frequency"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.SawOsc"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.Score"],"entry":[0,{"id":[0,"en/p5.sound/p5.Score.mdx"],"slug":[0,"en/p5sound/p5score"],"body":[0,"\n\n# p5.Score\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.Score"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"A Score consists of a series of Parts. The parts will\nbe played back in order. For example, you could have an\nA part, a B part, and a C part, and play them back in this order\nnew p5.Score(a, a, b, a, c)
\n"],"line":[0,9493],"params":[1,[[0,{"name":[0,"parts"],"description":[0,"One or multiple parts, to be played in sequence.
\n"],"type":[0,"p5.Part"],"optional":[0,true]}]]],"chainable":[0,false],"methods":[0,{"start":[0,{"description":[0,"Start playback of the score.
\n"],"path":[0,"p5.Score/start"]}],"stop":[0,{"description":[0,"Stop playback of the score.
\n"],"path":[0,"p5.Score/stop"]}],"pause":[0,{"description":[0,"Pause playback of the score.
\n"],"path":[0,"p5.Score/pause"]}],"loop":[0,{"description":[0,"Loop playback of the score.
\n"],"path":[0,"p5.Score/loop"]}],"noLoop":[0,{"description":[0,"Stop looping playback of the score. If it\nis currently playing, this will go into effect\nafter the current round of playback completes.
\n"],"path":[0,"p5.Score/noLoop"]}],"setBPM":[0,{"description":[0,"Set the tempo for all parts in the score
\n"],"path":[0,"p5.Score/setBPM"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.Score"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.Score/loop.mdx"],"slug":[0,"en/p5score/loop"],"body":[0,"\n\n# loop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"loop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Loop playback of the score.
\n"],"line":[0,9581],"itemtype":[0,"method"],"class":[0,"p5.Score"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Score/loop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Score/noLoop.mdx"],"slug":[0,"en/p5score/noloop"],"body":[0,"\n\n# noLoop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"noLoop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Stop looping playback of the score. If it\nis currently playing, this will go into effect\nafter the current round of playback completes.
\n"],"line":[0,9594],"itemtype":[0,"method"],"class":[0,"p5.Score"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Score/noLoop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Score/pause.mdx"],"slug":[0,"en/p5score/pause"],"body":[0,"\n\n# pause\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pause()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Pause playback of the score.
\n"],"line":[0,9569],"itemtype":[0,"method"],"class":[0,"p5.Score"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Score/pause"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Score/setBPM.mdx"],"slug":[0,"en/p5score/setbpm"],"body":[0,"\n\n# setBPM\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setBPM()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the tempo for all parts in the score
\n"],"line":[0,9628],"params":[1,[[0,{"name":[0,"BPM"],"description":[0,"Beats Per Minute
\n"],"type":[0,"Number"]}],[0,{"name":[0,"rampTime"],"description":[0,"Seconds from now
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.Score"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Score/setBPM"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Score/start.mdx"],"slug":[0,"en/p5score/start"],"body":[0,"\n\n# start\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"start()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Start playback of the score.
\n"],"line":[0,9542],"itemtype":[0,"method"],"class":[0,"p5.Score"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Score/start"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.Score/stop.mdx"],"slug":[0,"en/p5score/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Stop playback of the score.
\n"],"line":[0,9555],"itemtype":[0,"method"],"class":[0,"p5.Score"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.Score/stop"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.SinOsc"],"entry":[0,{"id":[0,"en/p5.sound/p5.SinOsc.mdx"],"slug":[0,"en/p5sound/p5sinosc"],"body":[0,"\n\n# p5.SinOsc\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.SinOsc"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Creates a sine oscillator."],"line":[0,261],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the frequency"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.SinOsc"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.SoundFile"],"entry":[0,{"id":[0,"en/p5.sound/p5.SoundFile.mdx"],"slug":[0,"en/p5sound/p5soundfile"],"body":[0,"\n\n# p5.SoundFile\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.SoundFile"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Load and play sound files."],"line":[0,60],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet sound, amp, delay, cnv;\n\nfunction preload() {\n //replace this sound with something local with rights to distribute\n //need to fix local asset loading first though :) \n sound = loadSound('//assets/doorbell.mp3');\n}\n\nfunction setup() {\n cnv = createCanvas(100, 100);\n textAlign(CENTER);\n cnv.mousePressed(playSound);\n amp = new p5.Amplitude();\n delay = new p5.Delay();\n sound.disconnect();\n sound.connect(delay);\n delay.connect(amp);\n}\n\nfunction playSound() {\n sound.play();\n}\n\nfunction draw() {\n let dtime = map(mouseX, 0, width, 0, 1);\n delay.delayTime(dtime);\n let f = map(mouseY, 0, height, 0, .75);\n delay.feedback(f);\n let level = map(amp.getLevel(), 0, 0.5, 0, 255);\n background(level, 0, 0);\n fill(255);\n text('click to play', width/2, 20);\n }\n
\n"]]],"methods":[0,{"isLoaded":[0,{"description":[0,"Returns true if the sound file finished loading successfully.
\n"],"path":[0,"p5.SoundFile/isLoaded"]}],"play":[0,{"description":[0,"Start the soundfile."],"path":[0,"p5.SoundFile/play"]}],"playMode":[0,{"description":[0,"p5.SoundFile has two play modes: restart
and\nsustain
. Play Mode determines what happens to a\np5.SoundFile if it is triggered while in the middle of playback.\nIn sustain mode, playback will continue simultaneous to the\nnew playback. In restart mode, play() will stop playback\nand start over. With untilDone, a sound will play only if it's\nnot already playing. Sustain is the default mode.
\n"],"path":[0,"p5.SoundFile/playMode"]}],"pause":[0,{"description":[0,"Pause the soundfile."],"path":[0,"p5.SoundFile/pause"]}],"loop":[0,{"description":[0,"Loop the soundfile."],"path":[0,"p5.SoundFile/loop"]}],"setLoop":[0,{"description":[0,"Set a loop region, and optionally a playback rate, and amplitude for the soundfile."],"path":[0,"p5.SoundFile/setLoop"]}],"isLooping":[0,{"description":[0,"Return the playback state of the soundfile."],"path":[0,"p5.SoundFile/isLooping"]}],"isPlaying":[0,{"description":[0,"Return the playback state of the soundfile."],"path":[0,"p5.SoundFile/isPlaying"]}],"isPaused":[0,{"description":[0,"Returns true if a p5.SoundFile is paused, false if not (i.e.\nplaying or stopped).
\n"],"path":[0,"p5.SoundFile/isPaused"]}],"stop":[0,{"description":[0,"Stop the soundfile."],"path":[0,"p5.SoundFile/stop"]}],"pan":[0,{"description":[0,"Set the stereo panning of a p5.sound object to\na floating point number between -1.0 (left) and 1.0 (right).\nDefault is 0.0 (center).
\n"],"path":[0,"p5.SoundFile/pan"]}],"getPan":[0,{"description":[0,"Returns the current stereo pan position (-1.0 to 1.0)
\n"],"path":[0,"p5.SoundFile/getPan"]}],"rate":[0,{"description":[0,"Set the playback rate of the soundfile."],"path":[0,"p5.SoundFile/rate"]}],"setVolume":[0,{"description":[0,"Multiply the output volume (amplitude) of a sound file\nbetween 0.0 (silence) and 1.0 (full volume).\n1.0 is the maximum amplitude of a digital sound, so multiplying\nby greater than 1.0 may cause digital distortion. To\nfade, provide a rampTime
parameter. For more\ncomplex fades, see the Envelope class.
\nAlternately, you can pass in a signal source such as an\noscillator to modulate the amplitude with an audio signal.
\n"],"path":[0,"p5.SoundFile/setVolume"]}],"duration":[0,{"description":[0,"Returns the duration of a sound file in seconds."],"path":[0,"p5.SoundFile/duration"]}],"currentTime":[0,{"description":[0,"Return the current position of the p5.SoundFile playhead, in seconds.\nTime is relative to the normal buffer direction, so if reverseBuffer
\nhas been called, currentTime will count backwards.
\n"],"path":[0,"p5.SoundFile/currentTime"]}],"jump":[0,{"description":[0,"Move the playhead of a soundfile that is currently playing to a new position."],"path":[0,"p5.SoundFile/jump"]}],"channels":[0,{"description":[0,"Gets the number of channels in the sound file."],"path":[0,"p5.SoundFile/channels"]}],"sampleRate":[0,{"description":[0,"Gets the number of channels in the sound file."],"path":[0,"p5.SoundFile/sampleRate"]}],"frames":[0,{"description":[0,"Return the number of samples in a sound file."],"path":[0,"p5.SoundFile/frames"]}],"getPeaks":[0,{"description":[0,"Returns an array of amplitude peaks in a p5.SoundFile that can be\nused to draw a static waveform. Scans through the p5.SoundFile's\naudio buffer to find the greatest amplitudes. Accepts one\nparameter, 'length', which determines size of the array.\nLarger arrays result in more precise waveform visualizations.
\nInspired by Wavesurfer.js.
\n"],"path":[0,"p5.SoundFile/getPeaks"]}],"reverseBuffer":[0,{"description":[0,"Reverses the p5.SoundFile's buffer source.\nPlayback must be handled separately (see example).
\n"],"path":[0,"p5.SoundFile/reverseBuffer"]}],"onended":[0,{"description":[0,"Define a function to call when the soundfile is done playing."],"path":[0,"p5.SoundFile/onended"]}],"connect":[0,{"description":[0,"Connects the output of a p5sound object to input of another\np5.sound object. For example, you may connect a p5.SoundFile to an\nFFT or an Effect. If no parameter is given, it will connect to\nthe main output. Most p5sound objects connect to the master\noutput when they are created.
\n"],"path":[0,"p5.SoundFile/connect"]}],"disconnect":[0,{"description":[0,"Disconnects the output of this p5sound object.
\n"],"path":[0,"p5.SoundFile/disconnect"]}],"setPath":[0,{"description":[0,"Change the path for the soundfile."],"path":[0,"p5.SoundFile/setPath"]}],"setBuffer":[0,{"description":[0,"Replace the current Audio Buffer with a new Buffer.
\n"],"path":[0,"p5.SoundFile/setBuffer"]}],"addCue":[0,{"description":[0,"Schedule events to trigger every time a MediaElement\n(audio/video) reaches a playback cue point.
\nAccepts a callback function, a time (in seconds) at which to trigger\nthe callback, and an optional parameter for the callback.
\nTime will be passed as the first parameter to the callback function,\nand param will be the second parameter.
\n"],"path":[0,"p5.SoundFile/addCue"]}],"removeCue":[0,{"description":[0,"Remove a callback based on its ID. The ID is returned by the\naddCue method.
\n"],"path":[0,"p5.SoundFile/removeCue"]}],"clearCues":[0,{"description":[0,"Remove all of the callbacks that had originally been scheduled\nvia the addCue method.
\n"],"path":[0,"p5.SoundFile/clearCues"]}],"save":[0,{"description":[0,"Save a p5.SoundFile as a .wav file. The browser will prompt the user\nto download the file to their device. To upload a file to a server, see\ngetBlob
\n"],"path":[0,"p5.SoundFile/save"]}],"getBlob":[0,{"description":[0,"This method is useful for sending a SoundFile to a server. It returns the\n.wav-encoded audio data as a \"Blob\".\nA Blob is a file-like data object that can be uploaded to a server\nwith an http request. We'll\nuse the httpDo
options object to send a POST request with some\nspecific options: we encode the request as multipart/form-data
,\nand attach the blob as one of the form values using FormData
.
\n"],"path":[0,"p5.SoundFile/getBlob"]}],"start":[0,{"description":[0,"Start the soundfile."],"path":[0,"p5.SoundFile/start"]}],"amp":[0,{"description":[0,"Adjust the amplitude of the soundfile."],"path":[0,"p5.SoundFile/amp"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.SoundFile"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.SoundFile/addCue.mdx"],"slug":[0,"en/p5soundfile/addcue"],"body":[0,"\n\n# addCue\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"addCue()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Schedule events to trigger every time a MediaElement\n(audio/video) reaches a playback cue point.
\nAccepts a callback function, a time (in seconds) at which to trigger\nthe callback, and an optional parameter for the callback.
\nTime will be passed as the first parameter to the callback function,\nand param will be the second parameter.
\n"],"line":[0,2719],"params":[1,[[0,{"name":[0,"time"],"description":[0,"Time in seconds, relative to this media\n element's playback. For example, to trigger\n an event every time playback reaches two\n seconds, pass in the number 2. This will be\n passed as the first parameter to\n the callback function.
\n"],"type":[0,"Number"]}],[0,{"name":[0,"callback"],"description":[0,"Name of a function that will be\n called at the given time. The callback will\n receive time and (optionally) param as its\n two parameters.
\n"],"type":[0,"Function"]}],[0,{"name":[0,"value"],"description":[0,"An object to be passed as the\n second parameter to the\n callback function.
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"id ID of this cue,\n useful for removeCue(id)"],"type":[0,"Number"]}],"example":[1,[[0,"\n\nlet mySound;\nfunction preload() {\n mySound = loadSound('/assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n background(220);\n text('tap to play', 10, 20);\n\n // schedule calls to changeText\n mySound.addCue(0, changeText, \"hello\" );\n mySound.addCue(0.5, changeText, \"hello,\" );\n mySound.addCue(1, changeText, \"hello, p5!\");\n mySound.addCue(1.5, changeText, \"hello, p5!!\");\n mySound.addCue(2, changeText, \"hello, p5!!!!!\");\n}\n\nfunction changeText(val) {\n background(220);\n text(val, 10, 20);\n}\n\nfunction canvasPressed() {\n mySound.play();\n}\n
"]]],"isConstructor":[0,false],"path":[0,"p5.SoundFile/addCue"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/amp.mdx"],"slug":[0,"en/p5soundfile/amp"],"body":[0,"\n\n# amp\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"amp()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Adjust the amplitude of the soundfile."],"line":[0,220],"params":[1,[[0,{"name":[0,"amplitude"],"description":[0,"amplitude value between 0 and 1."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/amp"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/channels.mdx"],"slug":[0,"en/p5soundfile/channels"],"body":[0,"\n\n# channels\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"channels()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Gets the number of channels in the sound file."],"line":[0,438],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"Returns the number of channels in the sound file."]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/channels"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/clearCues.mdx"],"slug":[0,"en/p5soundfile/clearcues"],"body":[0,"\n\n# clearCues\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"clearCues()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Remove all of the callbacks that had originally been scheduled\nvia the addCue method.
\n"],"line":[0,2817],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/clearCues"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/connect.mdx"],"slug":[0,"en/p5soundfile/connect"],"body":[0,"\n\n# connect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"connect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connects the output of a p5sound object to input of another\np5.sound object. For example, you may connect a p5.SoundFile to an\nFFT or an Effect. If no parameter is given, it will connect to\nthe main output. Most p5sound objects connect to the master\noutput when they are created.
\n"],"line":[0,2565],"params":[1,[[0,{"name":[0,"object"],"description":[0,"Audio object that accepts an input
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/connect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/currentTime.mdx"],"slug":[0,"en/p5soundfile/currenttime"],"body":[0,"\n\n# currentTime\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"currentTime()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Return the current position of the p5.SoundFile playhead, in seconds.\nTime is relative to the normal buffer direction, so if reverseBuffer
\nhas been called, currentTime will count backwards.
\n"],"line":[0,2293],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"currentTime of the soundFile in seconds."],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/currentTime"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/disconnect.mdx"],"slug":[0,"en/p5soundfile/disconnect"],"body":[0,"\n\n# disconnect\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"disconnect()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Disconnects the output of this p5sound object.
\n"],"line":[0,2590],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/disconnect"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/duration.mdx"],"slug":[0,"en/p5soundfile/duration"],"body":[0,"\n\n# duration\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"duration()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Returns the duration of a sound file in seconds."],"line":[0,301],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"duration"],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/duration"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/frames.mdx"],"slug":[0,"en/p5soundfile/frames"],"body":[0,"\n\n# frames\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"frames()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Return the number of samples in a sound file."],"line":[0,394],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"The number of samples in the sound file."],"type":[0,"Number"]}],"example":[1,[[0,"\n\n\nlet player;\n\nfunction preload() {\n player = loadSound('//assets/lucky_dragons_-_power_melody.mp3');\n}\n\nfunction setup() {\n describe('A sketch that calculates and displays the length of a sound file using number of samples and sample rate.');\n createCanvas(100, 100);\n background(220);\n textAlign(CENTER);\n textWrap(WORD);\n textSize(10);\n frames = player.frames();\n sampleRate = player.sampleRate();\n sampleLength = round((frames / sampleRate), 2);\n info = `sample is ${sampleLength} seconds long`;\n text(info, 0, 20, 100);\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.SoundFile/frames"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/getBlob.mdx"],"slug":[0,"en/p5soundfile/getblob"],"body":[0,"\n\n# getBlob\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getBlob()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"This method is useful for sending a SoundFile to a server. It returns the\n.wav-encoded audio data as a \"Blob\".\nA Blob is a file-like data object that can be uploaded to a server\nwith an http request. We'll\nuse the httpDo
options object to send a POST request with some\nspecific options: we encode the request as multipart/form-data
,\nand attach the blob as one of the form values using FormData
.
\n"],"line":[0,2882],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"A file-like data object"],"type":[0,"Blob"]}],"example":[1,[[0,"\n \n function preload() {\n mySound = loadSound('/assets/doorbell.mp3');\n }\n\n function setup() {\n noCanvas();\n let soundBlob = mySound.getBlob();\n\n // Now we can send the blob to a server...\n let serverUrl = 'https://jsonplaceholder.typicode.com/posts';\n let httpRequestOptions = {\n method: 'POST',\n body: new FormData().append('soundBlob', soundBlob),\n headers: new Headers({\n 'Content-Type': 'multipart/form-data'\n })\n };\n httpDo(serverUrl, httpRequestOptions);\n\n // We can also create an `ObjectURL` pointing to the Blob\n let blobUrl = URL.createObjectURL(soundBlob);\n\n // The `
"]]],"isConstructor":[0,false],"path":[0,"p5.SoundFile/getBlob"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/getPan.mdx"],"slug":[0,"en/p5soundfile/getpan"],"body":[0,"\n\n# getPan\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getPan()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns the current stereo pan position (-1.0 to 1.0)
\n"],"line":[0,2131],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"Returns the stereo pan setting of the Oscillator\n as a number between -1.0 (left) and 1.0 (right).\n 0.0 is center and default."],"type":[0,"Number"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/getPan"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/getPeaks.mdx"],"slug":[0,"en/p5soundfile/getpeaks"],"body":[0,"\n\n# getPeaks\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"getPeaks()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns an array of amplitude peaks in a p5.SoundFile that can be\nused to draw a static waveform. Scans through the p5.SoundFile's\naudio buffer to find the greatest amplitudes. Accepts one\nparameter, 'length', which determines size of the array.\nLarger arrays result in more precise waveform visualizations.
\nInspired by Wavesurfer.js.
\n"],"line":[0,2381],"params":[1,[[0,{"name":[0,"length"],"description":[0,"length is the size of the returned array.\n Larger length results in more precision.\n Defaults to 5*width of the browser window.
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"Array of peaks."],"type":[0,"Float32Array"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/getPeaks"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/isLoaded.mdx"],"slug":[0,"en/p5soundfile/isloaded"],"body":[0,"\n\n# isLoaded\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"isLoaded()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns true if the sound file finished loading successfully.
\n"],"line":[0,1662],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,""],"type":[0,"Boolean"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/isLoaded"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/isLooping.mdx"],"slug":[0,"en/p5soundfile/islooping"],"body":[0,"\n\n# isLooping\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"isLooping()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Return the playback state of the soundfile."],"line":[0,341],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"Looping State, true or false."],"type":[0,"Boolean"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/isLooping"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/isPaused.mdx"],"slug":[0,"en/p5soundfile/ispaused"],"body":[0,"\n\n# isPaused\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"isPaused()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Returns true if a p5.SoundFile is paused, false if not (i.e.\nplaying or stopped).
\n"],"line":[0,2011],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,""],"type":[0,"Boolean"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/isPaused"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/isPlaying.mdx"],"slug":[0,"en/p5soundfile/isplaying"],"body":[0,"\n\n# isPlaying\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"isPlaying()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Return the playback state of the soundfile."],"line":[0,331],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"return":[0,{"description":[0,"Playback state, true or false."],"type":[0,"Boolean"]}],"isConstructor":[0,false],"path":[0,"p5.SoundFile/isPlaying"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/jump.mdx"],"slug":[0,"en/p5soundfile/jump"],"body":[0,"\n\n# jump\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"jump()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Move the playhead of a soundfile that is currently playing to a new position."],"line":[0,321],"params":[1,[[0,{"name":[0,"timePoint"],"description":[0,"Time to jump to in seconds."],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/jump"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/loop.mdx"],"slug":[0,"en/p5soundfile/loop"],"body":[0,"\n\n# loop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"loop()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Loop the soundfile."],"line":[0,196],"params":[1,[[0,{"name":[0,"loopState"],"description":[0,"Set to True or False in order to set the loop state."],"type":[0,"Boolean"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/loop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/onended.mdx"],"slug":[0,"en/p5soundfile/onended"],"body":[0,"\n\n# onended\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"onended()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Define a function to call when the soundfile is done playing."],"line":[0,351],"params":[1,[[0,{"name":[0,"callback"],"description":[0,"Name of a function that will be called when the soundfile is done playing."],"type":[0,"Function"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\n\nlet player;\n\nfunction preload() {\n player = loadSound('//assets/lucky_dragons_-_power_melody.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(220);\n textAlign(CENTER);\n textSize(10);\n text('click to play', width/2, height/2);\n cnv.mousePressed(playSound);\n player.onended(coolFunction);\n}\n\nfunction coolFunction() {\n background(220);\n text('sound is done', width/2, height/2);\n}\n\nfunction playSound() {\n background(0, 255, 255);\n text('sound is playing', width/2, height/2);\n if (!player.isPlaying()) {\n player.play();\n }\n}\n
\n"]]],"isConstructor":[0,false],"path":[0,"p5.SoundFile/onended"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/pan.mdx"],"slug":[0,"en/p5soundfile/pan"],"body":[0,"\n\n# pan\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pan()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set the stereo panning of a p5.sound object to\na floating point number between -1.0 (left) and 1.0 (right).\nDefault is 0.0 (center).
\n"],"line":[0,2087],"params":[1,[[0,{"name":[0,"panValue"],"description":[0,"Set the stereo panner
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"timeFromNow"],"description":[0,"schedule this event to happen\n seconds from now
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\n let ballX = 0;\n let soundFile;\n\n function preload() {\n soundFormats('ogg', 'mp3');\n soundFile = loadSound('/assets/beatbox.mp3');\n }\n\n function draw() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n background(220);\n ballX = constrain(mouseX, 0, width);\n ellipse(ballX, height/2, 20, 20);\n }\n\n function canvasPressed(){\n // map the ball's x location to a panning degree\n // between -1.0 (left) and 1.0 (right)\n let panning = map(ballX, 0., width,-1.0, 1.0);\n soundFile.pan(panning);\n soundFile.play();\n }\n
"]]],"isConstructor":[0,false],"path":[0,"p5.SoundFile/pan"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/pause.mdx"],"slug":[0,"en/p5soundfile/pause"],"body":[0,"\n\n# pause\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pause()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Pause the soundfile."],"line":[0,147],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\nlet player;\n\nfunction preload() {\n player = loadSound('//assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n describe('A sketch that pauses and resumes sound file playback.');\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n background(220);\n textAlign(CENTER);\n textWrap(WORD);\n textSize(10);\n background(220);\n text('click to play', 0, 20, 100);\n \n player.loop();\n}\n\nfunction playSound() {\n if (!player.isPlaying()) {\n player.play();\n background(220);\n text('click to pause', 0, 20, 100);\n }\n else {\n player.pause();\n background(220);\n text('click to play', 0, 20, 100);\n }\n}\n
\np5.SoundFile has two play modes: restart
and\nsustain
. Play Mode determines what happens to a\np5.SoundFile if it is triggered while in the middle of playback.\nIn sustain mode, playback will continue simultaneous to the\nnew playback. In restart mode, play() will stop playback\nand start over. With untilDone, a sound will play only if it's\nnot already playing. Sustain is the default mode.
'restart' or 'sustain' or 'untilDone'
\n"],"type":[0,"String"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\nlet mySound;\nfunction preload(){\n mySound = loadSound('/assets/Damscray_DancingTiger.mp3');\n}\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n noFill();\n rect(0, height/2, width - 1, height/2 - 1);\n rect(0, 0, width - 1, height/2);\n textAlign(CENTER, CENTER);\n fill(20);\n text('restart', width/2, 1 * height/4);\n text('sustain', width/2, 3 * height/4);\n}\nfunction canvasPressed() {\n if (mouseX < height/2) {\n mySound.playMode('restart');\n } else {\n mySound.playMode('sustain');\n }\n mySound.play();\n}\n\n
Remove a callback based on its ID. The ID is returned by the\naddCue method.
\n"],"line":[0,2790],"params":[1,[[0,{"name":[0,"id"],"description":[0,"ID of the cue, as returned by addCue
\n"],"type":[0,"Number"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/removeCue"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/reverseBuffer.mdx"],"slug":[0,"en/p5soundfile/reversebuffer"],"body":[0,"\n\n# reverseBuffer\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"reverseBuffer()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Reverses the p5.SoundFile's buffer source.\nPlayback must be handled separately (see example).
\n"],"line":[0,2443],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\nlet drum;\nfunction preload() {\n drum = loadSound('/assets/drum.mp3');\n}\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n background(220);\n text('tap to play', 20, 20);\n}\n\nfunction canvasPressed() {\n drum.stop();\n drum.reverseBuffer();\n drum.play();\n}\n
\n Save a p5.SoundFile as a .wav file. The browser will prompt the user\nto download the file to their device. To upload a file to a server, see\ngetBlob
\n"],"line":[0,2850],"params":[1,[[0,{"name":[0,"fileName"],"description":[0,"name of the resulting .wav file.
\n"],"type":[0,"String"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\n let mySound;\n function preload() {\n mySound = loadSound('/assets/doorbell.mp3');\n }\n function setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n background(220);\n text('tap to download', 10, 20);\n }\n\n function canvasPressed() {\n mySound.save('my cool filename');\n }\n
Replace the current Audio Buffer with a new Buffer.
\n"],"line":[0,2630],"params":[1,[[0,{"name":[0,"buf"],"description":[0,"Array of Float32 Array(s). 2 Float32 Arrays\n will create a stereo source. 1 will create\n a mono source.
\n"],"type":[0,"Array"]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/setBuffer"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/setLoop.mdx"],"slug":[0,"en/p5soundfile/setloop"],"body":[0,"\n\n# setLoop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setLoop()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Set a loop region, and optionally a playback rate, and amplitude for the soundfile."],"line":[0,206],"params":[1,[[0,{"name":[0,"startTime"],"description":[0,"Set to True or False in order to set the loop state."],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"rate"],"description":[0,"Set to True or False in order to set the loop state."],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"amp"],"description":[0,"Set to True or False in order to set the loop state."],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"duration"],"description":[0,"Set to True or False in order to set the loop state."],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/setLoop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/setPath.mdx"],"slug":[0,"en/p5soundfile/setpath"],"body":[0,"\n\n# setPath\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setPath()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Change the path for the soundfile."],"line":[0,231],"params":[1,[[0,{"name":[0,"path"],"description":[0,"Path to the sound file."],"type":[0,"String"]}],[0,{"name":[0,"successCallback"],"description":[0,"Function to call when the sound file is loaded."],"type":[0,"Function"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"example":[1,[[0,"\n\nlet soundSource, cnv, btn;\n\nfunction preload() {\n soundSource = loadSound('//assets/Damscray_-_Dancing_Tiger_01.mp3');\n}\n\nfunction setup() {\n describe(\n 'a sketch that says click to play sound. there is a button that says load sound. when you click the button, the path of the sound file player changes and the new sound plays.');\n cnv = createCanvas(100, 100);\n cnv.mousePressed(playSound);\n background(220);\n textAlign(CENTER);\n textWrap(WORD);\n textSize(10);\n text('click to play sound or the button to load a new sound', 0, 20, 100);\n btn = createButton('New Sound');\n btn.mousePressed(setNewPath);\n soundSource.loop(); \n}\n\nfunction playSound() {\n soundSource.play();\n}\n\nfunction setNewPath() {\n background(220);\n text('a new sound was loaded', 0, 20, 100);\n soundSource.setPath('//assets/Damscray_-_Dancing_Tiger_02.mp3', playSound); \n}\n
\nMultiply the output volume (amplitude) of a sound file\nbetween 0.0 (silence) and 1.0 (full volume).\n1.0 is the maximum amplitude of a digital sound, so multiplying\nby greater than 1.0 may cause digital distortion. To\nfade, provide a rampTime
parameter. For more\ncomplex fades, see the Envelope class.
Alternately, you can pass in a signal source such as an\noscillator to modulate the amplitude with an audio signal.
\n"],"line":[0,2239],"params":[1,[[0,{"name":[0,"volume"],"description":[0,"Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator
\n"],"type":[0,"Number|Object"]}],[0,{"name":[0,"rampTime"],"description":[0,"Fade for t seconds
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"timeFromNow"],"description":[0,"Schedule this event to happen at\n t seconds in the future
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/setVolume"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/start.mdx"],"slug":[0,"en/p5soundfile/start"],"body":[0,"\n\n# start\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"start()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Start the soundfile."],"line":[0,111],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/start"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundFile/stop.mdx"],"slug":[0,"en/p5soundfile/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"SoundFile"],"file":[0,"src/SoundFile.js"],"description":[0,"Stop the soundfile."],"line":[0,137],"itemtype":[0,"method"],"class":[0,"p5.SoundFile"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundFile/stop"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.SoundLoop"],"entry":[0,{"id":[0,"en/p5.sound/p5.SoundLoop.mdx"],"slug":[0,"en/p5sound/p5soundloop"],"body":[0,"\n\n# p5.SoundLoop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.SoundLoop"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"SoundLoop
\n"],"line":[0,9673],"params":[1,[[0,{"name":[0,"callback"],"description":[0,"this function will be called on each iteration of theloop
\n"],"type":[0,"Function"]}],[0,{"name":[0,"interval"],"description":[0,"amount of time (if a number) or beats (if a string, following Tone.Time convention) for each iteration of the loop. Defaults to 1 second.
\n"],"type":[0,"Number|String"],"optional":[0,true]}]]],"chainable":[0,false],"example":[1,[[0,"\n\n let synth, soundLoop;\n let notePattern = [60, 62, 64, 67, 69, 72];\n\n function setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n colorMode(HSB);\n background(0, 0, 86);\n text('tap to start/stop', 10, 20);\n\n //the looper's callback is passed the timeFromNow\n //this value should be used as a reference point from\n //which to schedule sounds\n let intervalInSeconds = 0.2;\n soundLoop = new p5.SoundLoop(onSoundLoop, intervalInSeconds);\n\n synth = new p5.MonoSynth();\n}\n\nfunction canvasPressed() {\n // ensure audio is enabled\n userStartAudio();\n\n if (soundLoop.isPlaying) {\n soundLoop.stop();\n } else {\n // start the loop\n soundLoop.start();\n }\n}\n\nfunction onSoundLoop(timeFromNow) {\n let noteIndex = (soundLoop.iterations - 1) % notePattern.length;\n let note = midiToFreq(notePattern[noteIndex]);\n synth.play(note, 0.5, timeFromNow);\n background(noteIndex * 360 / notePattern.length, 50, 100);\n}\n
Start the loop
\n"],"path":[0,"p5.SoundLoop/start"]}],"stop":[0,{"description":[0,"Stop the loop
\n"],"path":[0,"p5.SoundLoop/stop"]}],"pause":[0,{"description":[0,"Pause the loop
\n"],"path":[0,"p5.SoundLoop/pause"]}],"syncedStart":[0,{"description":[0,"Synchronize loops. Use this method to start two or more loops in synchronization\nor to start a loop in synchronization with a loop that is already playing\nThis method will schedule the implicit loop in sync with the explicit master loop\ni.e. loopToStart.syncedStart(loopToSyncWith)
\n"],"path":[0,"p5.SoundLoop/syncedStart"]}]}],"properties":[0,{"bpm":[0,{"description":[0,"Getters and Setters, setting any paramter will result in a change in the clock's\nfrequency, that will be reflected after the next callback\nbeats per minute (defaults to 60)
\n"],"path":[0,"p5.SoundLoop/bpm"]}],"timeSignature":[0,{"description":[0,"number of quarter notes in a measure (defaults to 4)
\n"],"path":[0,"p5.SoundLoop/timeSignature"]}],"interval":[0,{"description":[0,"length of the loops interval
\n"],"path":[0,"p5.SoundLoop/interval"]}],"iterations":[0,{"description":[0,"how many times the callback has been called so far
\n"],"path":[0,"p5.SoundLoop/iterations"]}],"musicalTimeMode":[0,{"description":[0,"musicalTimeMode uses Tone.Time convention\ntrue if string, false if number
\n"],"path":[0,"p5.SoundLoop/musicalTimeMode"]}],"maxIterations":[0,{"description":[0,"Set a limit to the number of loops to play. defaults to Infinity
\n"],"path":[0,"p5.SoundLoop/maxIterations"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.SoundLoop"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.SoundLoop/bpm.mdx"],"slug":[0,"en/p5soundloop/bpm"],"body":[0,"\n\n# bpm\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"bpm"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Getters and Setters, setting any paramter will result in a change in the clock's\nfrequency, that will be reflected after the next callback\nbeats per minute (defaults to 60)
\n"],"line":[0,9729],"itemtype":[0,"property"],"class":[0,"p5.SoundLoop"],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/bpm"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/interval.mdx"],"slug":[0,"en/p5soundloop/interval"],"body":[0,"\n\n# interval\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"interval"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"length of the loops interval
\n"],"line":[0,9770],"itemtype":[0,"property"],"class":[0,"p5.SoundLoop"],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/interval"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/iterations.mdx"],"slug":[0,"en/p5soundloop/iterations"],"body":[0,"\n\n# iterations\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"iterations"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"how many times the callback has been called so far
\n"],"line":[0,9787],"itemtype":[0,"property"],"class":[0,"p5.SoundLoop"],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/iterations"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/maxIterations.mdx"],"slug":[0,"en/p5soundloop/maxiterations"],"body":[0,"\n\n# maxIterations\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"maxIterations"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Set a limit to the number of loops to play. defaults to Infinity
\n"],"line":[0,9816],"itemtype":[0,"property"],"class":[0,"p5.SoundLoop"],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/maxIterations"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/musicalTimeMode.mdx"],"slug":[0,"en/p5soundloop/musicaltimemode"],"body":[0,"\n\n# musicalTimeMode\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"musicalTimeMode"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"musicalTimeMode uses Tone.Time convention\ntrue if string, false if number
\n"],"line":[0,9800],"itemtype":[0,"property"],"class":[0,"p5.SoundLoop"],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/musicalTimeMode"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/pause.mdx"],"slug":[0,"en/p5soundloop/pause"],"body":[0,"\n\n# pause\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"pause()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Pause the loop
\n"],"line":[0,9878],"params":[1,[[0,{"name":[0,"timeFromNow"],"description":[0,"schedule a pausing time
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundLoop"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/pause"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/start.mdx"],"slug":[0,"en/p5soundloop/start"],"body":[0,"\n\n# start\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"start()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Start the loop
\n"],"line":[0,9841],"params":[1,[[0,{"name":[0,"timeFromNow"],"description":[0,"schedule a starting time
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundLoop"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/start"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/stop.mdx"],"slug":[0,"en/p5soundloop/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Stop the loop
\n"],"line":[0,9860],"params":[1,[[0,{"name":[0,"timeFromNow"],"description":[0,"schedule a stopping time
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundLoop"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/stop"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/syncedStart.mdx"],"slug":[0,"en/p5soundloop/syncedstart"],"body":[0,"\n\n# syncedStart\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"syncedStart()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Synchronize loops. Use this method to start two or more loops in synchronization\nor to start a loop in synchronization with a loop that is already playing\nThis method will schedule the implicit loop in sync with the explicit master loop\ni.e. loopToStart.syncedStart(loopToSyncWith)
\n"],"line":[0,9896],"params":[1,[[0,{"name":[0,"otherLoop"],"description":[0,"a p5.SoundLoop to sync with
\n"],"type":[0,"Object"]}],[0,{"name":[0,"timeFromNow"],"description":[0,"Start the loops in sync after timeFromNow seconds
\n"],"type":[0,"Number"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundLoop"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/syncedStart"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundLoop/timeSignature.mdx"],"slug":[0,"en/p5soundloop/timesignature"],"body":[0,"\n\n# timeSignature\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"timeSignature"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"number of quarter notes in a measure (defaults to 4)
\n"],"line":[0,9750],"itemtype":[0,"property"],"class":[0,"p5.SoundLoop"],"isConstructor":[0,false],"path":[0,"p5.SoundLoop/timeSignature"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.SoundRecorder"],"entry":[0,{"id":[0,"en/p5.sound/p5.SoundRecorder.mdx"],"slug":[0,"en/p5sound/p5soundrecorder"],"body":[0,"\n\n# p5.SoundRecorder\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.SoundRecorder"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Record sounds for playback and/or to save as a .wav file.\nThe p5.SoundRecorder records all sound output from your sketch,\nor can be assigned a specific source with setInput().
\nThe record() method accepts a p5.SoundFile as a parameter.\nWhen playback is stopped (either after the given amount of time,\nor with the stop() method), the p5.SoundRecorder will send its\nrecording to that p5.SoundFile for playback.
"],"line":[0,10559],"chainable":[0,false],"example":[1,[[0,"\n\nlet mic, recorder, soundFile;\nlet state = 0;\n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n cnv.mousePressed(canvasPressed);\n background(220);\n textAlign(CENTER, CENTER);\n\n // create an audio in\n mic = new p5.AudioIn();\n\n // prompts user to enable their browser mic\n mic.start();\n\n // create a sound recorder\n recorder = new p5.SoundRecorder();\n\n // connect the mic to the recorder\n recorder.setInput(mic);\n\n // this sound file will be used to\n // playback & save the recording\n soundFile = new p5.SoundFile();\n\n text('tap to record', width/2, height/2);\n}\n\nfunction canvasPressed() {\n // ensure audio is enabled\n userStartAudio();\n\n // make sure user enabled the mic\n if (state === 0 && mic.enabled) {\n\n // record to our p5.SoundFile\n recorder.record(soundFile);\n\n background(255,0,0);\n text('Recording!', width/2, height/2);\n state++;\n }\n else if (state === 1) {\n background(0,255,0);\n\n // stop recorder and\n // send result to soundFile\n recorder.stop();\n\n text('Done! Tap to play and download', width/2, height/2, width - 20);\n state++;\n }\n\n else if (state === 2) {\n soundFile.play(); // play the result!\n save(soundFile, 'mySound.wav');\n state++;\n }\n}\n
Connect a specific device to the p5.SoundRecorder.\nIf no parameter is given, p5.SoundRecorer will record\nall audible p5.sound from your sketch.
\n"],"path":[0,"p5.SoundRecorder/setInput"]}],"record":[0,{"description":[0,"Start recording. To access the recording, provide\na p5.SoundFile as the first parameter. The p5.SoundRecorder\nwill send its recording to that p5.SoundFile for playback once\nrecording is complete. Optional parameters include duration\n(in seconds) of the recording, and a callback function that\nwill be called once the complete recording has been\ntransfered to the p5.SoundFile.
\n"],"path":[0,"p5.SoundRecorder/record"]}],"stop":[0,{"description":[0,"Stop the recording. Once the recording is stopped,\nthe results will be sent to the p5.SoundFile that\nwas given on .record(), and if a callback function\nwas provided on record, that function will be called.
\n"],"path":[0,"p5.SoundRecorder/stop"]}]}],"isConstructor":[0,true],"path":[0,"p5.sound/p5.SoundRecorder"]}],"render":[0,null]}],"entries":[1,[[0,{"id":[0,"en/p5.SoundRecorder/record.mdx"],"slug":[0,"en/p5soundrecorder/record"],"body":[0,"\n\n# record\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"record()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Start recording. To access the recording, provide\na p5.SoundFile as the first parameter. The p5.SoundRecorder\nwill send its recording to that p5.SoundFile for playback once\nrecording is complete. Optional parameters include duration\n(in seconds) of the recording, and a callback function that\nwill be called once the complete recording has been\ntransfered to the p5.SoundFile.
\n"],"line":[0,10703],"params":[1,[[0,{"name":[0,"soundFile"],"description":[0,"p5.SoundFile
\n"],"type":[0,"p5.SoundFile"]}],[0,{"name":[0,"duration"],"description":[0,"Time (in seconds)
\n"],"type":[0,"Number"],"optional":[0,true]}],[0,{"name":[0,"callback"],"description":[0,"The name of a function that will be\n called once the recording completes
\n"],"type":[0,"Function"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundRecorder"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundRecorder/record"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundRecorder/setInput.mdx"],"slug":[0,"en/p5soundrecorder/setinput"],"body":[0,"\n\n# setInput\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"setInput()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Connect a specific device to the p5.SoundRecorder.\nIf no parameter is given, p5.SoundRecorer will record\nall audible p5.sound from your sketch.
\n"],"line":[0,10676],"params":[1,[[0,{"name":[0,"unit"],"description":[0,"p5.sound object or a web audio unit\n that outputs sound
\n"],"type":[0,"Object"],"optional":[0,true]}]]],"itemtype":[0,"method"],"class":[0,"p5.SoundRecorder"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundRecorder/setInput"]}],"render":[0,null]}],[0,{"id":[0,"en/p5.SoundRecorder/stop.mdx"],"slug":[0,"en/p5soundrecorder/stop"],"body":[0,"\n\n# stop\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"stop()"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"lib/addons/p5.sound.js"],"description":[0,"Stop the recording. Once the recording is stopped,\nthe results will be sent to the p5.SoundFile that\nwas given on .record(), and if a callback function\nwas provided on record, that function will be called.
\n"],"line":[0,10739],"itemtype":[0,"method"],"class":[0,"p5.SoundRecorder"],"chainable":[0,false],"isConstructor":[0,false],"path":[0,"p5.SoundRecorder/stop"]}],"render":[0,null]}]]]}],[0,{"name":[0,"p5.SqrOsc"],"entry":[0,{"id":[0,"en/p5.sound/p5.SqrOsc.mdx"],"slug":[0,"en/p5sound/p5sqrosc"],"body":[0,"\n\n# p5.SqrOsc\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.SqrOsc"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Creates a square oscillator."],"line":[0,233],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the frequency"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.SqrOsc"]}],"render":[0,null]}],"entries":[1,[]]}],[0,{"name":[0,"p5.TriOsc"],"entry":[0,{"id":[0,"en/p5.sound/p5.TriOsc.mdx"],"slug":[0,"en/p5sound/p5triosc"],"body":[0,"\n\n# p5.TriOsc\n"],"collection":[0,"reference"],"data":[0,{"title":[0,"p5.TriOsc"],"module":[0,"p5.sound"],"submodule":[0,"p5.sound"],"file":[0,"src/Oscillator.js"],"description":[0,"Creates a triangle oscillator."],"line":[0,247],"params":[1,[[0,{"name":[0,"freq"],"description":[0,"Set the frequency"],"type":[0,"Number"],"optional":[0,true]}]]],"chainable":[0,false],"isConstructor":[0,true],"path":[0,"p5.sound/p5.TriOsc"]}],"render":[0,null]}],"entries":[1,[]]}]]]}]]],"uiTranslations":[0,{"Home":[0,"Home"],"Menu":[0,"Menu"],"Reference":[0,"Reference"],"Tutorials":[0,"Tutorials"],"Examples":[0,"Examples"],"Contribute":[0,"Contribute"],"Community":[0,"Community"],"About":[0,"About"],"Start Coding":[0,"Start Coding"],"Donate":[0,"Donate"],"Download":[0,"Download"],"Accessibility":[0,"Accessibility"],"Search":[0,"Search"],"Filter by keyword":[0,"Filter by keyword"],"Jump To":[0,"Jump to"],"Resources":[0,"Resources"],"Information":[0,"Information"],"Socials":[0,"Socials"],"Contact":[0,"Contact"],"Copyright":[0,"Copyright"],"Privacy Policy":[0,"Privacy Policy"],"Terms of Use":[0,"Terms of Use"],"Forum":[0,"Forum"],"Sketches":[0,"Sketches"],"Libraries":[0,"Libraries"],"Events":[0,"Events"],"People":[0,"People"],"Contributors":[0,"Contributors"],"Contributor Docs":[0,"Contributor Docs"],"Alumni":[0,"Alumni"],"View Alt Text":[0,"View Alt Text"],"Monochrome Mode":[0,"Monochrome Mode"],"Dark Mode":[0,"Dark Mode"],"Reduced Motion":[0,"Reduced Motion"],"Syntax":[0,"Syntax"],"Methods":[0,"Methods"],"Fields":[0,"Fields"],"Parameters":[0,"Parameters"],"Returns":[0,"Returns"],"Related References":[0,"Related References"],"Related Examples":[0,"Related Examples"],"Show Code":[0,"Show Code"],"Donate to p5.js":[0,"Donate to p5.js"],"Download p5.js":[0,"Download p5.js"],"No Results":[0,"No entries found for that search."],"No alt text":[0,"No alt text"],"briefPageDescriptions":[0,{"Reference":[0,"Find easy explanations for every piece of p5.js code."],"p5.sound Reference":[0,"Extend p5.js with Web Audio functionality including audio input, playback, analysis and synthesis."],"Examples":[0,"Explore the possibilities of p5.js with short examples."],"Tutorials":[0,"Start from scratch or expand your skills with step-by-step lessons in p5.js."],"Contribute":[0,"Get involved with p5.js—create, code, document, donate, teach, and more!"],"Community":[0,"See what people around the world are making with p5.js, and share what you’re building"],"Sketches":[0,"Get inspired by sketches from the p5.js community."],"Events":[0,"See how p5.js brings people together—or organize your own event."],"Libraries":[0,"Expand the possibilities of p5.js with community-created libraries."],"About":[0,"Learn about the mission, values, and people behind p5.js."],"People":[0,"Get to know the p5.js team."]}],"contributePage":[0,{"Statement":[0,"Our community values contributions of all forms and seeks to expand the meaning of the word contributor as far and wide as possible. It includes documentation, teaching, writing code, making art, writing, design, activism, organizing, curating, or anything else you might imagine.\n"],"ImageAltText":[0,"Group photo of participants smiling enthusiastically with their hands in the air.\n"],"ImageCaption":[0,"Participants of p5.js Contributors Conference 2019.\n"],"DonateDescription":[0,"p5.js needs your support!\n"]}],"peoplePage":[0,{"PageDescription":[0,"p5.js was created by Lauren Lee McCarthy in 2013 as a new interpretation of Processing for the context of the web. Since then we have allowed ourselves space to deviate and grow, while drawing inspiration from Processing and our shared community. p5.js is sustained by a community of contributors, with support from the Processing Foundation. Currently, p5.js follows a rotating leadership model started in 2020."]}],"peopleCategories":[0,{"lead":[0,"p5.js Leads"],"mentor":[0,"p5.js Mentors"],"alumni":[0,"p5.js Alumni"],"contributor":[0,"p5.js Contributors"]}],"libraryCategories":[0,{"drawing":[0,"Drawing"],"color":[0,"Color"],"ui":[0,"User Interface"],"math":[0,"Math"],"physics":[0,"Physics"],"algorithms":[0,"Algorithms"],"3d":[0,"3D"],"ai-ml-cv":[0,"AI, ML, and CV"],"animation":[0,"Animation"],"shaders":[0,"Shaders"],"language":[0,"Language"],"hardware":[0,"Hardware"],"sound":[0,"Sound"],"data":[0,"Data"],"teaching":[0,"Teaching"],"networking":[0,"Networking"],"export":[0,"Export"],"utils":[0,"Utilities"]}],"tutorialCategories":[0,{"introduction":[0,"Introduction to p5.js"],"drawing":[0,"Drawing"],"web-design":[0,"Web Design"],"accessibility":[0,"Accessibility"],"webgl":[0,"WebGL"],"advanced":[0,"Advanced Topics"]}],"tutorialsPage":[0,{"education-resources":[0,"Education Resources"],"education-resources-snippet":[0,"Every teaching experience has unique goals, messages, conditions, and environments. By documenting and sharing p5.js educational resources, such as workshops and classes, we aim to better connect the p5.js learner and educator communities worldwide. "],"view-education-resources":[0,"View Education Resources"]}],"exampleCategories":[0,{"Featured":[0,"Featured"],"Shapes And Color":[0,"Shapes And Color"],"Animation And Variables":[0,"Animation And Variables"],"Imported Media":[0,"Imported Media"],"Input Elements":[0,"Input Elements"],"Transformation":[0,"Transformation"],"Calculating Values":[0,"Calculating Values"],"Repetition":[0,"Repetition"],"Listing Data With Arrays":[0,"Listing Data With Arrays"],"Angles And Motion":[0,"Angles And Motion"],"Games":[0,"Games"],"3D":[0,"3D"],"Advanced Canvas Rendering":[0,"Advanced Canvas Rendering"],"Classes And Objects":[0,"Classes And Objects"],"Loading And Saving Data":[0,"Loading And Saving Data"],"Math And Physics":[0,"Math And Physics"]}],"referenceCategories":[0,{"modules":[0,{"Foundation":[0,"Foundation"],"Image":[0,"Image"],"Typography":[0,"Typography"],"3D":[0,"3D"],"Math":[0,"Math"],"Events":[0,"Events"],"Color":[0,"Color"],"Data":[0,"Data"],"Transform":[0,"Transform"],"Shape":[0,"Shape"],"Rendering":[0,"Rendering"],"DOM":[0,"DOM"],"Constants":[0,"Constants"],"p5.sound":[0,"p5.sound"],"IO":[0,"IO"],"Environment":[0,"Environment"],"Structure":[0,"Structure"]}],"submodules":[0,{"Foundation":[0,"Foundation"],"Pixels":[0,"Pixels"],"Loading & Displaying":[0,"Loading & Displaying"],"Material":[0,"Material"],"Calculation":[0,"Calculation"],"Acceleration":[0,"Acceleration"],"Trigonometry":[0,"Trigonometry"],"Creating & Reading":[0,"Creating & Reading"],"Lights":[0,"Lights"],"Array Functions":[0,"Array Functions"],"Transform":[0,"Transform"],"2D Primitives":[0,"2D Primitives"],"Setting":[0,"Setting"],"Vertex":[0,"Vertex"],"3D Primitives":[0,"3D Primitives"],"Curves":[0,"Curves"],"Rendering":[0,"Rendering"],"Conversion":[0,"Conversion"],"Camera":[0,"Camera"],"DOM":[0,"DOM"],"LocalStorage":[0,"LocalStorage"],"Constants":[0,"Constants"],"p5.sound":[0,"p5.sound"],"Image":[0,"Image"],"Dictionary":[0,"Dictionary"],"Vector":[0,"Vector"],"Output":[0,"Output"],"Environment":[0,"Environment"],"Time & Date":[0,"Time & Date"],"Interaction":[0,"Interaction"],"Structure":[0,"Structure"],"Mouse":[0,"Mouse"],"Attributes":[0,"Attributes"],"Input":[0,"Input"],"String Functions":[0,"String Functions"],"Keyboard":[0,"Keyboard"],"3D Models":[0,"3D Models"],"Noise":[0,"Noise"],"Table":[0,"Table"],"Random":[0,"Random"],"Touch":[0,"Touch"]}]}],"calloutTitles":[0,{"Try this!":[0,"Try this!"],"Tip":[0,"Tip"],"Note":[0,"Note"]}],"LibrariesLayout":[0,{"View All":[0,"View All"],"Featured":[0,"Featured"],"Everything":[0,"Everything"]}],"experimentalApi":[0,{"title":[0,"This API is experimental"],"description":[0,"Its behavior may change in a future version of p5.js."]}]}]}" opts="{"name":"ReferenceDirectoryWithFilter","value":true}" component-url="/_astro/ReferenceDirectoryWithFilter.CtiNjunC.js" component-export="ReferenceDirectoryWithFilter" client="load" await-children="">