Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Temporización incorrecta del secuenciador de pasos en P5.js

Estoy trabajando en un secuenciador de pasos en Tone.js Enlace aquí: https://glitch.com/edit/#!/sustaining-lunar-chard Todo funciona bien, pero parece que no puedo entender por qué el tiempo esta apagado. La primera nota se dispara bien si hace clic en la primera columna, pero después de hacer clic en varias notas, parece salirse de control.

Código relacionado para activar audio:

 // Here is where we actually play the audio function onSequenceStep(time, column) { // We build up a list of notes, which will equal // the numRows. This gets passed into our PolySynth let notesToPlay = []; // console.log(column) // output the current column // Go through each row data.forEach((row, rowIndex) => { // See if the note is "on" const isOn = row[column] == 1; // If its on, add it to the list of notes to play if (isOn) { const note = notes[rowIndex]; notesToPlay.push(note); } }); // Trigger a note const velocity = random(0.5, 1); synth.triggerAttackRelease(notesToPlay, noteInterval, time, velocity); Tone.Draw.schedule(function() { currentColumn = column; }, time); } // Code to assist in conversion of shapesList data into format of data array function splitArrayIntoChunksOfLen(arr, len) { var chunks = [], i = 0, n = arr.length; while (i < n) { chunks.push(arr.slice(i, i += len)); } return chunks; } function inputSequencerData() { /* 1. Get shapesList active data into same format as data array ✅ 2. Set value of data array to array of shapesList active data ✅ */ // console.log(data); let shapesListSplit = splitArrayIntoChunksOfLen(shapesList, 16); for (let i = 0; i < shapesListSplit.length; i++) { // console.log(shapesListSplit[i]); // Log all rows of values // Loop over each shapesListSplit[i] and check if shapes are active for (let j = 0; j < shapesListSplit[i].length; j++) { if (shapesListSplit[i][j].active == true) { data[i][j] = 1; } else { data[i][j] = 0; } } } }

Este es el código de audio que se activa en la función dibujar().

 // Clear canvas and redraw for (let i = 0; i < shapesList.length; i++) { shapesList[i].show(); inputSequencerData(); }

Se basa en este ejemplo: https://glitch.com/edit/#!/tone-example-sequencer?path=sketch.js%3A223%3A27

¿Alguien sabe qué puede estar pasando aquí? Cualquier ayuda sería muy apreciada

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!