Skip to content

Commit

Permalink
adding block
Browse files Browse the repository at this point in the history
  • Loading branch information
mayarajan3 committed Jul 23, 2024
1 parent b5351dd commit 308fcc9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions extensions/src/music_generation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,9 @@ export default class ExtensionNameGoesHere extends extension(details, "ui") {
@(scratch.command`Play note ${"number"} of generated notes`)
async playGeneratedNote(index: number, util: BlockUtilityWithID) {
console.log("here");
util.stackFrame.timer = null;
let sequenceNotes = this.musicInstance.convertToBeats(this.generated);
console.log(sequenceNotes);
let note = sequenceNotes[index];
console.log(note);
// Play the note
let beats = Math.min(Math.max(note.beats, 0), 100);
note = Math.min(Math.max(note.pitch, 0), 130);
Expand All @@ -221,6 +218,13 @@ export default class ExtensionNameGoesHere extends extension(details, "ui") {
}
@(scratch.reporter`Get note ${"number"} of generated notes`)
getNote(index: number) {
let sequenceNotes = this.musicInstance.convertToBeats(this.generated);
let note = sequenceNotes[index];
return note.pitch;
}
@(scratch.reporter`Beats ${"number"} to seconds`)
beatsToSeconds(beats: number) {
Expand Down

0 comments on commit 308fcc9

Please sign in to comment.