Need experts to review my post on Ionic + Web Audio API

Hey all,

Just calling out any javascript/Ionic/WebAudio experts out there who would like to review my recent post on AirPair regarding using the Web Audio API within Ionic?

I used Web Audio in a recent Ionic project of mine which is now in the App Stores, and thought that it might be useful to talk about the steps I went through, so that it would be easier for anyone else who wanted to go down this path using Ionic in the future.

My article is at: and is currently not published as it needs some expert eyes to review it for accuracy and quality. If anyone here has time, I would appreciate it if you could cast your eyes over my post and give me some constructive feedback.


Good one, very informative.

your metronomClick function is not needed on the scope ;).
Define a simple javascript function instead.

Try to avoid polluting scopes with stuff that is not needed there.

Another hint:

angular.module('AudioTest', [])
  .controller('MetronomeCtrl', function($scope, $timeout) {

if you are loading stuff please inject them first (it is necessary if you want to minify your code).

angular.module('AudioTest', [])
 .controller('MetronomeCtrl', ['$scope', '$timeout', function($scope, $timeout) {

For angular providers this is not necessary but i think it is better to learn this correct and to know why and how i can inject things.
The same in your run block.

Something like: “first inject them and then use them” :smile:
But thats are all trivial stuff and only suggestions of mine… i want that other peaple learn that correct.

But why you are putting all the metronom stuff on the $rootScope?
And keep in mind that loading the file is async… if your call prepareMetronome before the file is loaded -> you will get javascript execeptions.

I would build this whole initial process in a service.
and hold all metronom functions there.

there would be a function like “initMetronom” which is a promise function and resolves if the file is correct loaded or onerror it will rejected.

All in all it is well written article.

1 Like

Superb feedback @bengtler - thank you so much for your very useful input.

Yes, I know in a perfect world, the Metronome functionality would be put in a Service, but this was really a quick, hacked together example.

I may break up the examples a bit more and perhaps create a Controller for the view, and that way use $scope instead of $rootScope everywhere. Unless of course it is possible to inject $scope into my app.js when not using a controller? I seem to remember trying that, but it kept throwing an error.


in a “run” block you have no “scope” so you can not inject it ;).

$scopes are only present in stuff connected with dom for databinding. (so in controllers, directives).

1 Like

Yes, that is what I thought too - that’s why the only I could figure out how to bind the view controls to the code was to use $rootScope. In my actual app, the metronome is in a controller, so I could use $scope there.

Yep and for those purposes you can work with services/factories … because they can share data through controllers :wink:

Your article offers valuable information. It covers many useful points on using the web audio API for precision audio in Ionic. I could experience the several stages of building a web audio app with the specification of code. I really impressed with the presentation of topic by focusing on a single key feature like Web Audio API. Usually I go for reviews essay writing service for getting authentic reviews.

Hey I really impressed to your article. I can work with Vehicle towing company because with the help of this company person should be suitable for towing services. Thanks for sharing this article because your article informative.