0

Why I get these 404 File not found errors for my tone.js samples when loading the page?

GET http://127.0.0.1 :8000/audios/F 404 (File not found)

GET http://127.0.0.1:8000/audi0s/G 404 (File not found)

GET http://127.0.0.1:8000/audios/C 404 (File not found)

GET http://127.0.0.1:8000/audios/D 404 (File not found)

GET http://127.0.0.1:8000/audios/A 404 (File not found)

page link and its code:

<html>
  <head>
    <script src="https://cdn.jsdelivr.net/npm/nexusui@latest/dist/NexusUI.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/tone@latest/build/Tone.min.js"></script>
  </head>
  <body>

    <div id="piano-keyboard"></div>

    <script>
var piano = new Nexus.Piano('#piano-keyboard',{
    'size': [500,125],
    'mode': 'button',  // 'button', 'toggle', or 'impulse'
    'lowNote': 24,
    'highNote': 72 
})

       
// PIANO SAMPLER
const sampler = new Tone.Sampler({
    urls: {
       "C1":"C1.wav",
"C#1":"C#1.wav",
"D1":"D1.wav",
"D#1":"D#1.wav",
"E1":"E1.wav",
"F1":"F1.wav",
"F#1":"F#1.wav",
"G1":"G1.wav",
"G#1":"G#1.wav",
"A1":"A1.wav",
"A#1":"A#1.wav",
"B1":"B1.wav",
"C2":"C2.wav",
"C#2":"C#2.wav",
"D2":"D2.wav",
"D#2":"D#2.wav",
"E2":"E2.wav",
"F2":"F2.wav",
"F#2":"F#2.wav",
"G2":"G2.wav",
"G#2":"G#2.wav",
"A2":"A2.wav",
"A#2":"A#2.wav",
"B2":"B2.wav",
"C3":"C3.wav",
"C#3":"C#3.wav",
"D3":"D3.wav",
"D#3":"D#3.wav",
"E3":"E3.wav",
"F3":"F3.wav",
"F#3":"F#3.wav",
"G3":"G3.wav",
"G#3":"G#3.wav",
"A3":"A3.wav",
"A#3":"A#3.wav",
"B3":"B3.wav",
"C4":"C4.wav",
"C#4":"C#4.wav",
"D4":"D4.wav",
"D#4":"D#4.wav",
"E4":"E4.wav",
"F4":"F4.wav",
"F#4":"F#4.wav",
"G4":"G4.wav",
"G#4":"G#4.wav",
"A4":"A4.wav",
"A#4":"A#4.wav",
"B4":"B4.wav",
"C5":"C5.wav"
    },

    // Cela règle la durée de permanence des notes jouées
    release: 1,

    // Source locale des sons
    baseUrl: "./audios/"

    // baseUrl: "http://127.0.0.1:8000/audios/"
}).toDestination();



piano.on('change',function(v) {
Tone.loaded().then(() => {
  sampler.triggerAttackRelease(Tone.Frequency((v.note), "midi").toNote());
})


})

    </script>

  </body>
</html>
iMath
  • 2,326
  • 2
  • 43
  • 75
  • I didn't get any 404 errors when i loaded your page. I tried all of the keys, but only the black keys gave "Error: buffer is either not set or not loaded" – Jesper Oct 14 '21 at 06:18
  • @Jesper Perhaps you should try again and see the errors in the 'Console' or the 'Network' tab of Chrome – iMath Oct 14 '21 at 08:48
  • Chrome gives tons of errors, but Firefox gives none. – Jesper Oct 14 '21 at 08:53

0 Answers0