Search the Community
Showing results for tags 'web audio'.
-
Hi, I'm building a Phaser 3 game currently and looked into the new dynamic sound. I made a tiny bleep maker myself that has a core oscillator, a second oscillator for frequency modulation on the first, pitch bend on the first, and a third oscillator to create an "artifact" trailing sound(using same frequency mod as first oscillator)..its very simple ,I'm new to webaudio and thought someone else might have fun with it for funky bleeps. here's a test html: <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <head> <body> <script> context = new AudioContext(); function start_Sfx(vco,fm,artifact) { context!=undefined?context.close():null; context = new AudioContext(); var core_vco = context.createOscillator(); //waveform type: "sine", "triangle", "square", "sawtooth" core_vco.type = vco.wave; core_vco.frequency.value = vco.freq; //frequency mod fm_source = context.createOscillator(); fm_source.frequency.value = fm.freq; fm_source.type = fm.wave; modulationGain = context.createGain(); modulationGain = context.createGain(); modulationGain.gain.value = 1000; fm_source.connect(modulationGain); modulationGain.connect(core_vco.detune); core_vco.connect(context.destination); //end //cheap pitch bend on first vco core_vco.frequency.setValueAtTime(vco.freq, context.currentTime); core_vco.frequency.linearRampToValueAtTime(vco.freq*vco.bendAmt,context.currentTime+vco.decay); //end //start vco and fm vco fm_source.start(context.currentTime); core_vco.start(context.currentTime); core_vco.stop(vco.decay); fm_source.stop(fm.decay); //artifact if(artifact!=undefined) { artifact_vco = context.createOscillator(); artifact_vco.type = artifact.wave; artifact_vco.frequency.value = artifact.freq; artifact_vco.connect(context.destination); modulationGain.connect(artifact_vco.detune); artifact_vco.start(context.currentTime+artifact.wait); artifact_vco.stop(artifact.decay); } } function playSound() { start_Sfx({wave:'square',freq:50,wait:.1,decay:.2,bendAmt:10},{wave:'sine',freq:10,wait:0,decay:1},{wave:'square',freq:200,wait:.1,decay:.2}); } </script> <button onClick="playSound()"><b>test audio</b></button> </body> </html>
-
- web audio
- chip sound
-
(and 1 more)
Tagged with:
-
Hi. I remember meeting a French guy who was very close with his brother (he talked about him a lot) and worked on the audio for Babylon.js. I have a question for him. I am looking at my audio files and trying to determine if they should be playing at any particular keyframe based on them being set to Play at an earlier key frame. Right now I'm looking at the soundFile._audioBuffer.duration and then doing some math to determine if it should be playing part way through at the current key frame. Two questions: 1. is there an easier way to do this? 2. is the "duration" accurate or is there a better way to get duration of a sound file? Thanks, Jeff
-
I've been building a little scene that is driven by a number of sound files (9) using this kind of code: sound1 = new BABYLON.Sound("sound1", "sound1.mp3", myScene, soundReady, { loop: false, volume: theVolume }); sound2 = new BABYLON.Sound("sound2", "sound2.mp3", myScene, soundReady, { loop: false, volume: theVolume }); sound3 = new BABYLON.Sound("sound3", "sound3.mp3", myScene, soundReady, { loop: false, volume: theVolume }); ... sound9 = new BABYLON.Sound("sound9", "sound9.mp3", myScene, soundReady, { loop: false, volume: theVolume }); function soundReady() { soundsReady++; .... } Everything worked nicely when I tested it on my XP machine in Firefox. But then I started testing it in a variety of browsers I have on my machines - and then I started getting problems. So Windows 7 - Chrome and Firefox only Windows 10 - Chrome, Firefox and Edge Samsung Tablet (Android 5 - "Lollipop") - Chrome, but only if repeatedly I clear out the browser cache. ( Drove me crazy for several days ) Today I found this list : Can I Use : Web Audio API Is that the best summation of the current situation? And is it telling me that Apple devices will be a problem without fancy coding? cheers, gryff
-
Hello all, I'm the author of an open-source audio library that I think would be very useful to anyone making a game on the internet. WAD.js is the Web Audio DAW (digital audio workstation). The goal of WAD.js is to emulate the features you would find in a DAW like FL Studio, with an interface that is much, much simpler than working with native WebAudio. Instead of creating complex networks of audio nodes to make basic sounds, as you have to do in native web audio, WAD.js wraps everything that is needed for a single sound into a single object (a "wad") that has convenient methods that you can use to dynamically modify the sound. For example, if you want to simulate a bustling city, WAD.js makes it easy to pan sounds in 3-dimensions, so you can hear different people (or cars, or dogs, or whatever) moving around the main character. Or maybe your character just went into a tunnel, so you'll want to increase the reverb on all the sound effects. If you're really the DIY type, you can use WAD.js to combine oscillators, filters, and effects to make your own sound effects. WAD.js also supports MIDI input, so if you wanted to make some kind of rock-band like game, you could certainly do that without too much difficulty. I'm actively developing this project, so new features are being added all the time. Please check it out on github. Contributions are certainly welcome! https://github.com/rserota/wad Also, I have a demo online that shows off some of the basic features of this library, in case you want more information before you really dive into the code. http://www.codecur.io/us/songdemo
-
I'm going to add a new synthesiser engine in Babylon.js. - engine can play sound of hundred instruments and drums - you can change any song parts in realtime - engine is compatible with mobile browsers see demo at http://molgav.nn.ru/babylonsynth/ Any feature requests are welcome.
-
I've been working on a simple canvas game and have run into a problem :/ Here it is --- http://users.sussex.ac.uk/~bc216/AXOLOTLBASS/ Here's a link to the code on github https://github.com/BB-000/Axolotl-Bass-in-Space/tree/master/js It uses the metronome example from this Web Audio tutorial http://www.html5rocks.com/en/tutorials/audio/scheduling/ Everything works fine on my macbook pro when run on my local server, however when I uploaded it live to the web it sometimes starts struggling after about 10 minutes of running the audio starts to crackle and eventually stop. I tested it on some slower laptops and it struggled a lot more - took a couple of minutes before the audio crackled / cut out and and started to lag. This makes me pretty sure it's a memory leak causing this. I did some profiling and fixed the way the entity images were handled, used a resource loading class instead of using new Image() each time. This fixed the dom node problem on the timeline : Before After But the problem still occurs, the memory usage still slowly creeps up. The memory snapshots show some image elements in the detached dom tree in red : heap snapshot - Does this mean the entity images are somehow not getting removed properly or are being duplicated still? - Or could the problem be my removal of entities using Array.splice[index] ? I've read this can cause problems but thought my game was too small / simple for this to be the case? Here is the relevant code for dealing with entities (they are spawned by pushing them onto the monsters[] array) // in the monster's update function if (this.isDead === true) { if (barNumber % this.barTiming === 0) if (current16thNote % this.timing === 0) { // Waits until it's queue to disappear and play it's sound score += this.points; this.toRemove = true; // sets to remove to true, read this could solve some problems // playSoundDelay(samplebb[this.sound], this.channel); } } // monster's render function, (thought this could be something to do with it if the image elements are the problem) render: function (ctx) { if (this.isDead === false) { ctx.drawImage(resources.get(this.monsterImage), this.x, this.y, this.sizex, this.sizey); } else if (this.isDead === true) { // if monster is dead, make it translucent ctx.save(); ctx.globalAlpha = 0.4; ctx.drawImage(resources.get(this.monsterImage), this.x, this.y, this.sizex, this.sizey); // resources.js is an asset loading library ctx.restore(); } } // One type of entity var Shark = function (position) { this.x = position.x; this.y = position.y; this.sizex = 64; ..... ..... this.speed = Math.random() * (120 - 50) + 50; this.monsterImage = "images/Shark.png"; // the url to be passed into the resource.get call }; Shark.prototype = Object.create(MonsterMove2.prototype); function updateEntities(dt) { for (var x=0; x < monsters.length; x++) { var monster = monsters[x]; monster.update(); if (typeof monster.move === 'function') { if (!monster.isDead) { // If entity is alive, chase the player monster.move(dt); } } if (monster.toRemove){ monsters.splice(x,1); // Removes the monster from the array } } Thanks in advance if anyone can point me in the right direction!! This has been driving me mad for a while!
- 1 reply
-
- javascript
- web audio
-
(and 6 more)
Tagged with:
-
Hello, everybody. I've been using Phaser for the last couple of weeks and I had almost no problem until I reached the point where I need to modify the sound graph on the web audio API implementation inside the engine. I saw Sound.externalNode but I have no idea of how to connect the nodes and how to access them through Sound or SoundManager. I just want to create delay and feedback nodes and connect them somehow using the Sound class. Is this possible? Is there any example? Is the node structure (the graph) of how SoundManager and Sound are connected anywhere in the docs? I can't find it Thanks a lot in advance and keep on with this awesome software!
-
- web audio
- web audio api
-
(and 3 more)
Tagged with:
-
I tested on iPhone 4 iOS 6 and there is no sound! Also strange, that there is no message with: 'Web Audio supported' or not, cause I have put it with alert message. Please, I need your help! Press the button and write, is it any sound? And write your OS version and device. http://bit.ly/1dfeIfW