Buffer / loading sample files
Even after using onload Buffer as well as the tone.js buffer component, the console still loads buffer is either not set or not loaded. I've checked the network location and it does show that the .wav files have loaded, so is there something we should include in between?
<Song isPlaying={isPlaying} bpm={60}>
<Track steps={[(props.note)]}>
{/* <Instrument type="monoSynth" notes={['C3']} envelope={{attack: 0.2,release: 0.5,}} /> */}
<Instrument
type="sampler"
notes={notes}
samples={{
A0: "/public/piano/A0vH.wav",
B0: "/public/piano/B0vH.wav",,
}}
onLoad={(buffers) => {
// runs when all samples are loaded
}}
/>
</Track>
</Song>
Thank you!
You can try doing it the native way, using the web audio api. https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer tutorial - https://www.youtube.com/watch?v=3NgVlAscdcA
If you're still having this issue, I solved it by simply using the file path relative to the public folder: e.g.,
samples={{ A0: "/piano/A0vH.wav", B0: "/piano/B0vH.wav",, }}