Playing notes?

Discussion in 'Plugin Development' started by jojohnson1, Dec 9, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    jojohnson1

    Hello guys,
    i want to play a tune for every player on the server that sounds like it was played by noteblocks. There is a part in the Bukkit API that allows you to do this.
    Code:
    public void playNote(Location loc, byte instrument, byte note);
    this gives no error, but also no note, even though i created a noteblock under the player.

    Then, there is
    Code:
    public void playSound(Location location, Sound sound, float volume, float pitch);
    which could work perfectly, given that Sound sound = Sound.NOTE_PIANO; , but how can i change the pitch of the played note? I entered multiple values for float pitch, but i couldn't see like a regularity how the note is affected by the float. What is the range of that float? and which value equals which Tone? I couldn't find any explanations by Bukkit, neither in javadocs nor on github, so i'd be delighted if anyone could help.

    Thanks, jojohnson1

    Oh, i forgot to say that the playSound() way works, i can hear a tone, but i just want to know how to change the pitch...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  2. Offline

    fireblast709

    pitch goes from 0 to 63 (can be higher)
     
  3. Offline

    jojohnson1

    Great, thank you. Where did you get that information?
     
  4. Offline

    fireblast709

Thread Status:
Not open for further replies.

Share This Page