open-audiovisual
Search GitHub

oav-p5 reference · Recording

OAVp5.record.sources#

variableoav-p5
OAVp5.record.sources

Which sounds the running take is hearing right now: a list of 'sound', 'drums', 'mic' and 'p5sound'; empty when no take runs.

It is what the take has connected, not whether something is audible at this moment. A source that is switched on halfway joins the list within a quarter of a second. After the take, recordingSaved() gives the final list in info.sources.

Type
Array<String>

A new list on every read. 'sound' is the instrument of startSound(), 'drums' the drum machine and the pads, 'mic' the microphone, 'p5sound' p5.sound 1.x.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
  startDrums('breakbeat', 120);
  startSound('synth/pluck');
  textSize(14);
}

function keyPressed() {
  if (key === 'r') recordingIsOn ? stopRecording() : startRecording();
}

function draw() {
  background(20);
  fill(255);
  text(recordingIsOn ? 'in the take: ' + OAVp5.record.sources.join(', ') : 'press r to start a take', 20, 30);
}
Press r: the text lists what the take has connected, here the drum machine and the instrument.

Related

  • recordingSaved() An event you define: it is called when a recording has been saved and checked, with an info object about the file.
  • startRecording() Records the canvas and the sound your sketch makes into one video file, and returns a promise that says whether the recording began.
  • startSound() Makes the keys you play heard through an instrument you name, and returns a promise that says whether sound is on.
  • startDrums() Starts a drum machine: a 16-step grid on the page that plays a preset, your own grid or one line of rhythm, and counts the bars for your sketch.
  • startMic() Turns the microphone on and returns a promise that says whether it worked.

p5/oav-p5.js, line 1932

↑ Back to top · All names