Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.7.1 for MC 1.7.10, 1.10.2, 1.11.2 & 1.12.1. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)

Search the Community

Showing results for tags 'note'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OpenComputers
    • Announcements
    • Feedback
    • IRC
  • Code Central
    • Support
    • Showcase
    • Tutorials
  • Addons & More
    • Addons Mods
    • Architectures
    • OpenEngineering Task Force
  • General
    • Lounge
    • Forum Games
    • Showcase
    • Servers
  • Archives
    • Public Archives

Found 2 results

  1. Hi, I am new to OC, coming from CC and I want to make my music player in OC... The issue I had with CC was that it was not possible to play multiple notes at the same time, but this was fixed with the information here: http://www.computercraft.info/forums2/index.php?/topic/18995-openperipherals-play-2-or-more-noteblocks-at-the-same-time/ Now the 2 solutions available for CC don't seem to be available in CC so I tried around a bit with events... Didn't work as intended and even got a crashing computer out of it... Here's my code: local component = require("component") local counter = 1 local noteblocks = {} for address, componentType in component.list("music") do print(tostring(address) .. "," .. componentType) noteblocks[counter] = component.proxy(address) counter = counter + 1; end for _,nb in pairs(noteblocks) do nb.trigger(10) end local computer = require("computer") local event = require("event") function trigger() component.musicblock.trigger(15) end event.listen("note", trigger) for i=1, 10 do computer.pushSignal("note") end event.pull() print("finish") To replicate my issue, just place an adapter anywhere with one or more noteblocks connected to it. If you run the program you'll hear a clear delay between each note, music will need multiple notes at once... Preferably I want multiple notes to play instantly out of one single noteblock, but if that's impossible then I guess multiple will have to do... As for the memory leak: Running this part of the code local computer = require("computer") local event = require("event") function trigger() component.musicblock.trigger(15) end event.listen("note", trigger) for i=1, 10 do computer.pushSignal("note") end event.pull() Multiple times it will: 1. keep playing more and more notes at the end. 2. eventually crash, saying it ran out of memory.
  2. Basically, this API provides a single function: song.play(notes: table or string,shortest: number) Input being either a table or a string. Using a table, each note-duration combination is a string in a table value. The function will iterate through every entry of the table and play all the notes with their specified duration. Using a string, every note-duration combination is seperated by a free space " ". Regarding the special syntax used, this is copied from the header of the song API: Examples: "E5": Plays the note "E5" for the duration specified in the second parameter (default 0.125, equaling 120 bpm) "-E5": Plays the note "E5" with double the specified duration "E5_4": Plays the note "E5" with 4 times the specified duration, change "4" to any number x to play the note x times the duration specified "P_4": Plays a pause with 4 times the specified duration, change "4" to any number x to play the note x times the duration specified For note names, use the syntax of the strings of the Note API If you haven't already guessed, you require the note API for this to work, just run "pastebin get XwLD0xa8 note" inside the folder you are going to have the song API in. This method utilizes the Note API which is now natively included in OpenComputers. To get the song API, install it via OPPM using "oppm install song" or run "pastebin get R88y1eD2 song". Find the song API on OpenPrograms, at https://github.com/OpenPrograms/Vexatos-Programs/tree/master/song. For an example song, check out the github folder linked, or, alternatively, run "pastebin get i1YC56vJ example" in your computer console and run "example" then. I hope you have fun with the API. Feel free to post any songs you make in the section below! Sincerely, Vexatos
×