Extension music

Can anyone make a music extension

1 Like

Why do you need an extension? You could use the built-in Player and Sound components.
https://ai2.appinventor.mit.edu/reference/components/media.html

Alternatively, you could use the TaifunPlayer extension.

1 Like

You can generate frequencies with this extension, which means that you can play music through it.


Alternatively, you can play music with the WebViewer and some clever JavaScript. It's unreliable though, sometimes it unexpectedly stops. I guess the WebViewer is not designed to fully function like a browser.

playFunction:

// https://dev.to/gkucmierz/play-sound-in-javascript-1n95

const play = (frequency = 300, duration = 1e3) => {
  const context = new AudioContext();
  const gainNode = context.createGain();
  const oscillator = context.createOscillator();
  oscillator.frequency.value = frequency;
  oscillator.connect(gainNode);
  gainNode.connect(context.destination);
  oscillator.start(0);
  setTimeout(() => oscillator.stop(), duration);
};

MusicJavaScript.aia (4.3 KB)

Code extracted from StackOverflow and Dev.to

1 Like

Hi...Sorry saw this late...I normally don't see mit app inventor too much...I wanted an extension to make my own streaming app like spotify....Or make a radio like radio garden...Anyways thanks for the taifun player...

Thanks so much....I will use this