We are about to switch to a new forum software. Until then we have removed the registration on this forum.
What's the correct way to preload a lot of samples? Instead of just one file like shown in this video: 11.1: Loading and Playing - p5.js Sound Tutorial
Answers
not like this:
Look at array in the reference:
I know about arrays, but the issue is here
"key"+i =constvariable for it then:const FOLDER = 'keys/'.constfor it:const EXT = '.wav'.const. Let's call it:const INDEX_START = 53.const INDEX_END = 77.const INDEX_TOTAL = 1 + INDEX_END - INDEX_START.const sounds = Array(INDEX_TOTAL).const FOLDER = 'keys/', EXT = '.wav', INDEX_START = 53, INDEX_END = 77, INDEX_TOTAL = 1 + INDEX_END - INDEX_START, sounds = Array(INDEX_TOTAL); function preload() { for (let i = 0; i < INDEX_TOTAL; ++i) sounds[i] = loadSound(FOLDER + (i + INDEX_START) + EXT); }@GoToLoop that's amazing. Thanks for this detailed answer. In the for loop, what is the "let" doing?
https://Developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let