From 4a7e8c5fa86cf06827de188834fbeef09cfdb692 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 16 Nov 2017 23:28:44 -0800 Subject: [PATCH] adding block for sounds --- libs/music/_locales/music-jsdoc-strings.json | 4 + libs/music/_locales/music-strings.json | 129 +++++++++ libs/music/sounds.ts | 278 ++++++++++--------- 3 files changed, 284 insertions(+), 127 deletions(-) diff --git a/libs/music/_locales/music-jsdoc-strings.json b/libs/music/_locales/music-jsdoc-strings.json index 872a8255..ddbf3375 100644 --- a/libs/music/_locales/music-jsdoc-strings.json +++ b/libs/music/_locales/music-jsdoc-strings.json @@ -2,6 +2,8 @@ "Sound.buffer": "Returns the underlaying Buffer object.", "Sound.play": "Play sound.", "music": "Generation of music tones.", + "music._soundPicker": "A sound", + "music._soundPicker|param|sound": "the sound", "music.beat": "Return the duration of a beat in milliseconds (the beat fraction).", "music.beat|param|fraction": "the fraction of the current whole note, eg: BeatFraction.Half", "music.changeTempoBy": "Change the tempo up or down by some amount of beats per minute (bpm).", @@ -10,6 +12,8 @@ "music.noteFrequency": "Get the frequency of a note.", "music.noteFrequency|param|name": "the note name, eg: Note.C", "music.playSound": "Start playing a sound and don't wait for it to finish.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]", + "music.playSoundEffect": "Plays a sound", + "music.playSoundEffect|param|sound": "the sound to play", "music.playSoundUntilDone": "Play a sound and wait until the sound is done.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]", "music.playSoundUntilDone|param|sound": "the melody to play, eg: music.sounds(Sounds.PowerUp)", "music.playSound|param|sound": "the melody to play, eg: music.sounds(Sounds.PowerUp)", diff --git a/libs/music/_locales/music-strings.json b/libs/music/_locales/music-strings.json index 5b2bce36..96657c5d 100644 --- a/libs/music/_locales/music-strings.json +++ b/libs/music/_locales/music-strings.json @@ -28,9 +28,11 @@ "Sounds.PowerUp|block": "power up", "Sounds.Siren|block": "siren", "Sounds.Wawawawaa|block": "wawawawaa", + "music._soundPicker|block": "%sound", "music.beat|block": "%fraction|beat", "music.changeTempoBy|block": "change tempo by %value|(bpm)", "music.noteFrequency|block": "%note", + "music.playSoundEffect|block": "play %sound", "music.playSoundUntilDone|block": "play sound %sound=music_sounds|until done", "music.playSound|block": "play sound %sound=music_sounds", "music.playTone|block": "play tone|at %note=device_note|for %duration=device_beat", @@ -42,6 +44,133 @@ "music.stopAllSounds|block": "stop all sounds", "music.tempo|block": "tempo (bpm)", "music|block": "music", + "sounds.animalsCatPurr|block": "Animals cat purr", + "sounds.animalsDogBark1|block": "Animals dog bark 1", + "sounds.animalsDogBark2|block": "Animals dog bark 2", + "sounds.animalsDogGrowl|block": "Animals dog growl", + "sounds.animalsDogSniff|block": "Animals dog sniff", + "sounds.animalsDogWhine|block": "Animals dog whine", + "sounds.animalsElephantCall|block": "Animals elephant call", + "sounds.animalsInsectBuzz1|block": "Animals insect buzz1", + "sounds.animalsInsectBuzz2|block": "Animals insect buzz2", + "sounds.animalsInsectChirp|block": "Animals insect chirp", + "sounds.animalsSnakeHiss|block": "Animals snake hiss", + "sounds.animalsSnakeRattle|block": "Animals snake rattle", + "sounds.animalsTRexRoar|block": "Animals trex roar", + "sounds.colorsBlack|block": "Colors black", + "sounds.colorsBlue|block": "Colors blue", + "sounds.colorsBrown|block": "Colors brown", + "sounds.colorsGreen|block": "Colors green", + "sounds.colorsRed|block": "Colors red", + "sounds.colorsWhite|block": "Colors white", + "sounds.colorsYellow|block": "Colors yellow", + "sounds.communicationBravo|block": "Communication bravo", + "sounds.communicationEv3|block": "Communication ev3", + "sounds.communicationFantastic|block": "Communication fantastic", + "sounds.communicationGameOver|block": "Communication game over", + "sounds.communicationGoodJob|block": "communicationGoodJob", + "sounds.communicationGoodbye|block": "communication goodbye", + "sounds.communicationGood|block": "communication good", + "sounds.communicationGo|block": "Communication go", + "sounds.communicationHello|block": "communication hello", + "sounds.communicationHi|block": "communication hi", + "sounds.communicationLego|block": "communication lego", + "sounds.communicationMindstorms|block": "communication mindstorms", + "sounds.communicationMorning|block": "communication morning", + "sounds.communicationNo|block": "communication no", + "sounds.communicationOkay|block": "communication okay", + "sounds.communicationOkeyDokey|block": "communication okey dokey", + "sounds.communicationSorry|block": "communication sorry", + "sounds.communicationThankYou|block": "communication thank you", + "sounds.communicationYes|block": "communication yes", + "sounds.expressionsBoing|block": "expressions boing", + "sounds.expressionsBoo|block": "expressions boo", + "sounds.expressionsCheering|block": "expressions cheering", + "sounds.expressionsCrunching|block": "expressions crunching", + "sounds.expressionsCrying|block": "expressions crying", + "sounds.expressionsFanfare|block": "expressions fanfare", + "sounds.expressionsKungFu|block": "expressions kung fu", + "sounds.expressionsLaughing1|block": "expressions laughing1", + "sounds.expressionsLaughing2|block": "expressions laughing2", + "sounds.expressionsMagicWand|block": "expressions magic wand", + "sounds.expressionsOuch|block": "expressions ouch", + "sounds.expressionsShouting|block": "expressions shouting", + "sounds.expressionsSmack|block": "expressions smack", + "sounds.expressionsSneezing|block": "expressions sneezing", + "sounds.expressionsSnoring|block": "expressions snoring", + "sounds.expressionsUhOh|block": "expressions uh oh", + "sounds.informationActivate|block": "information activate", + "sounds.informationAnalyze|block": "information analyze", + "sounds.informationBackwards|block": "information backwards", + "sounds.informationColor|block": "information color", + "sounds.informationDetected|block": "information detected", + "sounds.informationDown|block": "information down", + "sounds.informationErrorAlarm|block": "information error alarm", + "sounds.informationError|block": "information error", + "sounds.informationFlashing|block": "information flashing", + "sounds.informationForward|block": "information forward", + "sounds.informationLeft|block": "information left", + "sounds.informationObject|block": "information object", + "sounds.informationRight|block": "information right", + "sounds.informationSearching|block": "information searching", + "sounds.informationStart|block": "information start", + "sounds.informationStop|block": "information stop", + "sounds.informationTouch|block": "information touch", + "sounds.informationTurn|block": "information turn", + "sounds.informationUp|block": "information up", + "sounds.mechanicalAirRelease|block": "mechanical air release", + "sounds.mechanicalAirbrake|block": "mechanical airbrake", + "sounds.mechanicalBackingAlert|block": "mechanical backing alert", + "sounds.mechanicalBlip1|block": "mechanical blip1", + "sounds.mechanicalBlip2|block": "mechanical blip2", + "sounds.mechanicalBlip3|block": "mechanical blip3", + "sounds.mechanicalBlip4|block": "mechanical blip4", + "sounds.mechanicalHorn1|block": "mechanical horn1", + "sounds.mechanicalHorn2|block": "mechanical horn2", + "sounds.mechanicalLaser|block": "mechanical laser", + "sounds.mechanicalMotorIdle|block": "mechanical motor idle", + "sounds.mechanicalMotorStart|block": "mechanical motor start", + "sounds.mechanicalMotorStop|block": "mechanical motor stop", + "sounds.mechanicalRatchet|block": "mechanical ratchet", + "sounds.mechanicalSonar|block": "\"mechanical sonar\"", + "sounds.mechanicalTickTack|block": "mechanical tick tack", + "sounds.mechanicalWalk|block": "mechanical walk", + "sounds.movementsArm1|block": "movements arm1", + "sounds.movementsArm2|block": "movements arm2", + "sounds.movementsArm3|block": "movements arm3", + "sounds.movementsArm4|block": "movements arm4", + "sounds.movementsDropLoad|block": "movements drop load", + "sounds.movementsLiftLoad|block": "movements lift load", + "sounds.movementsServo1|block": "movements servo1", + "sounds.movementsServo2|block": "movements servo2", + "sounds.movementsServo3|block": "movements servo3", + "sounds.movementsServo4|block": "movements servo4", + "sounds.movementsSlideLoad|block": "movements slide load", + "sounds.movementsSnap|block": "movements snap", + "sounds.movementsSpeedDown|block": "movements speed down", + "sounds.movementsSpeedIdle|block": "movements speed idle", + "sounds.movementsSpeedUp|block": "movements speed up", + "sounds.movementsSpeeding|block": "movements speeding", + "sounds.numbersEight|block": "numbers eight", + "sounds.numbersFive|block": "numbers five", + "sounds.numbersFour|block": "numbers four", + "sounds.numbersNine|block": "numbers nine", + "sounds.numbersOne|block": "numbers one", + "sounds.numbersSeven|block": "numbers seven", + "sounds.numbersSix|block": "numbers six", + "sounds.numbersTen|block": "numbers ten", + "sounds.numbersThree|block": "numbers three", + "sounds.numbersTwo|block": "numbers two", + "sounds.numbersZero|block": "numbers zero", + "sounds.systemClick|block": "system click", + "sounds.systemConfirm|block": "system confirm", + "sounds.systemConnect|block": "system connect", + "sounds.systemDownload|block": "system download", + "sounds.systemGeneralAlert|block": "system general alert", + "sounds.systemOverpower|block": "system overpower", + "sounds.systemPowerDown|block": "system power down", + "sounds.systemReady|block": "system ready", + "sounds.systemStartUp|block": "S", "{id:category}Music": "Music", "{id:category}Sound": "Sound", "{id:category}Sounds": "Sounds" diff --git a/libs/music/sounds.ts b/libs/music/sounds.ts index 5a7d8adf..845c97c8 100644 --- a/libs/music/sounds.ts +++ b/libs/music/sounds.ts @@ -1,256 +1,280 @@ namespace sounds { - //% fixedInstance jres + //% fixedInstance jres block="Animals cat purr" export const animalsCatPurr = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals dog bark 1" export const animalsDogBark1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals dog bark 2" export const animalsDogBark2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals dog growl" export const animalsDogGrowl = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals dog sniff" export const animalsDogSniff = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals dog whine" export const animalsDogWhine = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals elephant call" export const animalsElephantCall = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals insect buzz1" export const animalsInsectBuzz1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals insect buzz2" export const animalsInsectBuzz2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals insect chirp" export const animalsInsectChirp = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals snake hiss" export const animalsSnakeHiss = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals snake rattle" export const animalsSnakeRattle = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Animals trex roar" export const animalsTRexRoar = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors black" export const colorsBlack = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors blue" export const colorsBlue = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors brown" export const colorsBrown = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors green" export const colorsGreen = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors red" export const colorsRed = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors white" export const colorsWhite = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Colors yellow" export const colorsYellow = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Communication bravo" export const communicationBravo = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Communication ev3" export const communicationEv3 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Communication fantastic" export const communicationFantastic = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Communication game over" export const communicationGameOver = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="Communication go" export const communicationGo = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communicationGoodJob" export const communicationGoodJob = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication good" export const communicationGood = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication goodbye" export const communicationGoodbye = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication hello" export const communicationHello = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication hi" export const communicationHi = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication lego" export const communicationLego = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication mindstorms" export const communicationMindstorms = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication morning" export const communicationMorning = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication no" export const communicationNo = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication okay" export const communicationOkay = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication okey dokey" export const communicationOkeyDokey = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication sorry" export const communicationSorry = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication thank you" export const communicationThankYou = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="communication yes" export const communicationYes = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions boing" export const expressionsBoing = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions boo" export const expressionsBoo = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions cheering" export const expressionsCheering = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions crunching" export const expressionsCrunching = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions crying" export const expressionsCrying = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions fanfare" export const expressionsFanfare = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions kung fu" export const expressionsKungFu = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions laughing1" export const expressionsLaughing1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions laughing2" export const expressionsLaughing2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions magic wand" export const expressionsMagicWand = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions ouch" export const expressionsOuch = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions shouting" export const expressionsShouting = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions smack" export const expressionsSmack = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions sneezing" export const expressionsSneezing = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions snoring" export const expressionsSnoring = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="expressions uh oh" export const expressionsUhOh = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information activate" export const informationActivate = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information analyze" export const informationAnalyze = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information backwards" export const informationBackwards = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information color" export const informationColor = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information detected" export const informationDetected = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information down" export const informationDown = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information error alarm" export const informationErrorAlarm = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information error" export const informationError = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information flashing" export const informationFlashing = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information forward" export const informationForward = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information left" export const informationLeft = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information object" export const informationObject = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information right" export const informationRight = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information searching" export const informationSearching = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information start" export const informationStart = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information stop" export const informationStop = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information touch" export const informationTouch = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information turn" export const informationTurn = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="information up" export const informationUp = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical air release" export const mechanicalAirRelease = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical airbrake" export const mechanicalAirbrake = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical backing alert" export const mechanicalBackingAlert = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical blip1" export const mechanicalBlip1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical blip2" export const mechanicalBlip2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical blip3" export const mechanicalBlip3 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical blip4" export const mechanicalBlip4 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical horn1" export const mechanicalHorn1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical horn2" export const mechanicalHorn2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical laser" export const mechanicalLaser = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical motor idle" export const mechanicalMotorIdle = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical motor start" export const mechanicalMotorStart = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical motor stop" export const mechanicalMotorStop = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical ratchet" export const mechanicalRatchet = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block='"mechanical sonar"' export const mechanicalSonar = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical tick tack" export const mechanicalTickTack = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="mechanical walk" export const mechanicalWalk = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements arm1" export const movementsArm1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements arm2" export const movementsArm2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements arm3" export const movementsArm3 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements arm4" export const movementsArm4 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements drop load" export const movementsDropLoad = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements lift load" export const movementsLiftLoad = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements servo1" export const movementsServo1 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements servo2" export const movementsServo2 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements servo3" export const movementsServo3 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements servo4" export const movementsServo4 = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements slide load" export const movementsSlideLoad = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements snap" export const movementsSnap = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements speed down" export const movementsSpeedDown = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements speed idle" export const movementsSpeedIdle = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements speed up" export const movementsSpeedUp = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="movements speeding" export const movementsSpeeding = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers eight" export const numbersEight = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers five" export const numbersFive = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers four" export const numbersFour = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers nine" export const numbersNine = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers one" export const numbersOne = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers seven" export const numbersSeven = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers six" export const numbersSix = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers ten" export const numbersTen = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers three" export const numbersThree = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers two" export const numbersTwo = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="numbers zero" export const numbersZero = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system click" export const systemClick = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system confirm" export const systemConfirm = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system connect" export const systemConnect = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system download" export const systemDownload = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system general alert" export const systemGeneralAlert = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system overpower" export const systemOverpower = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system power down" export const systemPowerDown = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block="system ready" export const systemReady = music.fromWAV(hex``); - //% fixedInstance jres + //% fixedInstance jres block=S export const systemStartUp = music.fromWAV(hex``); } + +namespace music { + /** + * Plays a sound + * @param sound the sound to play + */ + //% blockId=music_play_sound_effect block="play %sound" + //% weight=98 + export function playSoundEffect(sound: Sound) { + if (!sound) return; + + sound.play(); + } + + /** + * A sound + * @param sound the sound + */ + //% blockId=music_sound_picker block="%sound" shim=TD_ID + //% weight=0 blockHidden=1 + export function _soundPicker(sound: Sound): Sound { + return sound; + } +}