microsoft / pxt-adafruit

Microsoft MakeCode editor for Adafruit Circuit Playground Express
https://makecode.adafruit.com
Other
81 stars 77 forks source link

A "twinkle" variable from "variables" can't be put into "play sound" #985

Closed Helen09 closed 5 years ago

Helen09 commented 5 years ago

Describe the bug A "twinkle" variable from "variables" can't be put into "play sound"

Steps to reproduce the behavior

  1. Navigate to https://makecode.adafruit.com/projects/musical-cloud/code
  2. Follow the step to drag blocks on content pane
  3. Until the 4th step, as shared project https://makecode.com/_FWRUhkY3tgj4

Expected behavior Drag a "twinkle" variable from "variables" into the "play sound" where is says "power up" Capture

Actual behavior A "twinkle" variable from "variables" can't be put into "play sound" Issue40301

Additional info:

  1. test OS: Windows
  2. Adafruit Circuit Playground Express version: 1.4.7 Microsoft MakeCode version: 5.5.37 codal-circuit-playground runtime version: v1.5.4-samd-peripherals.11
pelikhan commented 5 years ago

We are using fixed instances now to handle sounds so tutorials have to be updated.

ganicke commented 5 years ago

The situation is that this project wants to compose a sound (where the sound string is filled in a later step) and uses the now deprecated playSound block. The new melody blocks don't support a custom sound string.

The new play block has he exact same text as playSound. So, the coding steps won't work with the available blocks. We'll need to get rid of the "twinkle" sound or have the user to stay in JS only.

let twinkle = ""
music.playSound(twinkle)
music.baDing.play()

image

pelikhan commented 5 years ago

The customizable api was nice. This is an issue.

ganicke commented 5 years ago

Maybe a melody editor, makes one byte notes packed into Buffer... sometime later, over the horizon.

pelikhan commented 5 years ago

It perfectly acceptable to instantiate a new Melody and play it. We should have a block that takes a string.

From: Galen Nickel notifications@github.com Sent: Thursday, April 18, 2019 1:25 PM To: Microsoft/pxt-adafruit pxt-adafruit@noreply.github.com Cc: Peli de Halleux jhalleux@microsoft.com; Comment comment@noreply.github.com Subject: Re: [Microsoft/pxt-adafruit] A "twinkle" variable from "variables" can't be put into "play sound" (#985)

Maybe a melody editor, makes one byte notes packed into Buffer... sometime later, over the horizon.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2Fpxt-adafruit%2Fissues%2F985%23issuecomment-484677282&data=02%7C01%7Cjhalleux%40microsoft.com%7Cf590a523870442bc7aff08d6c43bfe15%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636912159282959924&sdata=q5qi0m3pjBleg2bfL9fZoCirRk4caXzxE4oJnyVQTSY%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA73QKMPJFNKU43CEIS47MLPRDKLLANCNFSM4HDHCRHA&data=02%7C01%7Cjhalleux%40microsoft.com%7Cf590a523870442bc7aff08d6c43bfe15%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636912159282959924&sdata=1PqhG1pfy9tEy5jz%2FbQtjOpq9xZEEL63Jhens%2FoDrFo%3D&reserved=0.

ganicke commented 5 years ago

Yea, maybe add a helper to create it that takes a string: let song = createMelody("e:2 b:4")?

pelikhan commented 5 years ago

Will not work with fixed instances...

ganicke commented 5 years ago

Change melody up a bit to do...

//% fixedInstances
export class StaticMelody extends Melody {
}

export class ComposedMelody extends Melody {
}

...except compile the melody on create rather than in play() in order to not retain the bulky melody string.

abchatra commented 5 years ago

@ganicke we are planning to release this today. Sorry for the late notice. Is it possible to generate a PR for these tutorials. As soon as the release is done, we will merge the PR.

abchatra commented 5 years ago

Hmm ignore my comment. I don't know what we can do here.

ganicke commented 5 years ago

OK, I'm fixing the others now...