upgrading music APIs (#12)

This commit is contained in:
Peli de Halleux
2017-12-14 10:34:04 -08:00
committed by GitHub
parent 63047454cb
commit 5a6cbf2639
9 changed files with 420 additions and 36 deletions

View File

@ -321,21 +321,30 @@
"motors.motorCommand": "Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.",
"motors.motorPower": "Turns on the motor at a certain percent of power. Switches to single motor mode!",
"motors.motorPower|param|power": "%percent of power sent to the motor. Negative power goes backward. eg: 50",
"music": "Generation of music tones through pin ``P0``.",
"music": "Generation of music tones.",
"music.beat": "Returns the duration of a beat in milli-seconds",
"music.beginMelody": "Starts playing a melody.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]",
"music.beginMelody|param|melodyArray": "the melody array to play, eg: ['g5:1']",
"music.beginMelody|param|options": "melody options, once / forever, in the foreground / background",
"music.builtInMelody": "Gets the melody array of a built-in melody.",
"music.changeTempoBy": "Change the tempo by the specified amount",
"music.changeTempoBy|param|bpm": "The change in beats per minute to the tempo, eg: 20",
"music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|param|name": "the note name",
"music.playTone": "Plays a tone through ``speaker`` for the given duration.",
"music.noteFrequency|param|name": "the note name, eg: Note.C",
"music.onEvent": "Registers code to run on various melody events",
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
"music.rest|param|ms": "rest duration in milliseconds (ms)",
"music.ringTone": "Plays a tone through ``speaker``.",
"music.ringTone": "Plays a tone through pin ``P0``.",
"music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.setPlayTone": "Sets a custom playTone function for playing melodies",
"music.setTempo": "Sets the tempo to the specified amount",
"music.setTempo|param|bpm": "The new tempo in beats per minute, eg: 120",
"music.speakerPlayTone": "Plays a tone through ``speaker`` for the given duration.",
"music.speakerPlayTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.speakerPlayTone|param|ms": "tone duration in milliseconds (ms)",
"music.tempo": "Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.",
"parseInt": "Convert A string to an integer.",
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",

View File

@ -20,6 +20,8 @@
"BaudRate.BaudRate115200|block": "115200",
"BaudRate.BaudRate56700|block": "57600",
"BaudRate.BaudRate9600|block": "9600",
"BeatFraction.Breve|block": "4",
"BeatFraction.Double|block": "2",
"BeatFraction.Eighth|block": "1/8",
"BeatFraction.Half|block": "1/2",
"BeatFraction.Quarter|block": "1/4",
@ -121,10 +123,44 @@
"Math.randomBoolean|block": "pick random true or false",
"Math.random|block": "pick random 0 to %limit",
"Math|block": "Math",
"Melodies.BaDing|block": "ba ding",
"Melodies.Baddy|block": "baddy",
"Melodies.Birthday|block": "birthday",
"Melodies.Blues|block": "blues",
"Melodies.Chase|block": "chase",
"Melodies.Dadadadum|block": "dadadum",
"Melodies.Entertainer|block": "entertainer",
"Melodies.Funeral|block": "funereal",
"Melodies.Funk|block": "funk",
"Melodies.JumpDown|block": "jump down",
"Melodies.JumpUp|block": "jump up",
"Melodies.Nyan|block": "nyan",
"Melodies.Ode|block": "ode",
"Melodies.PowerDown|block": "power down",
"Melodies.PowerUp|block": "power up",
"Melodies.Prelude|block": "prelude",
"Melodies.Punchline|block": "punchline",
"Melodies.Ringtone|block": "ringtone",
"Melodies.Wawawawaa|block": "wawawawaa",
"Melodies.Wedding|block": "wedding",
"MelodyOptions.ForeverInBackground|block": "forever in background",
"MelodyOptions.Forever|block": "forever",
"MelodyOptions.OnceInBackground|block": "once in background",
"MelodyOptions.Once|block": "once",
"Motor.AB|block": "A and B",
"MotorCommand.Break|block": "break",
"MotorCommand.Coast|block": "coast",
"MotorCommand.Sleep|block": "sleep",
"MusicEvent.BackgroundMelodyEnded|block": "background melody ended",
"MusicEvent.BackgroundMelodyNotePlayed|block": "background melody note played",
"MusicEvent.BackgroundMelodyPaused|block": "background melody paused",
"MusicEvent.BackgroundMelodyRepeated|block": "background melody repeated",
"MusicEvent.BackgroundMelodyResumed|block": "background melody resumed",
"MusicEvent.BackgroundMelodyStarted|block": "background melody started",
"MusicEvent.MelodyEnded|block": "melody ended",
"MusicEvent.MelodyNotePlayed|block": "melody note played",
"MusicEvent.MelodyRepeated|block": "melody repeated",
"MusicEvent.MelodyStarted|block": "melody started",
"Note.CSharp3|block": "C#3",
"Note.CSharp4|block": "C#4",
"Note.CSharp5|block": "C#5",
@ -225,8 +261,11 @@
"motors.motorPower|block": "motor on at %percent",
"motors|block": "motors",
"music.beat|block": "%fraction|beat",
"music.beginMelody|block": "start melody %melody=device_builtin_melody| repeating %options",
"music.builtInMelody|block": "%melody",
"music.changeTempoBy|block": "change tempo by (bpm)|%value",
"music.noteFrequency|block": "%note",
"music.onEvent|block": "music on %value",
"music.playTone|block": "play|tone %note=device_note|for %duration=device_beat",
"music.rest|block": "rest(ms)|%duration=device_beat",
"music.ringTone|block": "ring tone (Hz)|%note=device_note",