reactronica icon indicating copy to clipboard operation
reactronica copied to clipboard

Buffer / loading sample files

Open ClaireBookworm opened this issue 3 years ago • 2 comments

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!

ClaireBookworm avatar Feb 18 '22 15:02 ClaireBookworm

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

stevebarakat avatar Feb 20 '22 08:02 stevebarakat

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",, }}

dos320 avatar Mar 29 '22 17:03 dos320