Advertisement
Feaders

music

Mar 4th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. -- Exemple : "Twinkle Twinkle Little Star" (domaine public)
  2. -- Adaptez "left" Γ  la face oΓΉ est branchΓ© le Iron Note Block
  3.  
  4. local noteblock = peripheral.wrap("left")
  5.  
  6. -- Instrument possible : 0..6 ou "harp","bass","basedrum","snare","hat","guitar","flute"
  7. -- Notes possibles : 0..24 (12 = do central, 24 = do octave au-dessus)
  8.  
  9. local musique = {
  10. {note=12, duree=0.4}, -- C
  11. {note=12, duree=0.4}, -- C
  12. {note=19, duree=0.4}, -- G
  13. {note=19, duree=0.4}, -- G
  14. {note=21, duree=0.4}, -- A
  15. {note=21, duree=0.4}, -- A
  16. {note=19, duree=0.8}, -- G
  17. {note=17, duree=0.4}, -- F
  18. {note=17, duree=0.4}, -- F
  19. {note=16, duree=0.4}, -- E
  20. {note=16, duree=0.4}, -- E
  21. {note=14, duree=0.4}, -- D
  22. {note=14, duree=0.4}, -- D
  23. {note=12, duree=0.8}, -- C
  24. }
  25.  
  26. while true do
  27. for _, noteData in ipairs(musique) do
  28. noteblock.playNote("harp", noteData.note)
  29. sleep(noteData.duree)
  30. end
  31. -- Petite pause avant de rejouer
  32. sleep(2)
  33. end
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement