Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda