Audio plugin / Loopindex limits?

0 favourites
  • 8 posts
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • As the title says...

    Does anyone know what are the limits of loopindex and audio plugin analyser song read?

    because im trying to get a complete waveform of a song... but for some reason even though the loopindex works even for 2mil counts and above... audio plugin seems to not work properly... or cant read a song properly based on loopindex after 22500 ..... as more i test the C2 new versions it seems there is a limit always that ends in 25 same was for the new audio post that had a 0.025 wait ... now i seen lately nothing happens under 0.025 anymore is that the new tick count?

    the code to create a waveform is taking a "songlenght" multiplied by 1000 to get each millisecond and for X from 1 to songlenght creates a sprite

    however even if i can create more then 22500 objects .. the loopindex seems to stop at 22500 ... which is weird... is there something im missing?

    here is a capx file using the canvas plugin, i was thinking it wold work better by working around the sprite limits but its not ... Ashley have any idea why it stops? its exactly 2.25 seconds again the magic number "25"

    sorry for my confusing writing its really late ... didn't sleep for 2 days trying to find something about it ... either i was looking for the wrong words or dunno couldn't find nothing about waveform in c2

    Edited: as you can see instead of 1000 i used 1002.25 because i cant get the exact song length in milliseconds for the loopindex to match incrementally by 1

    however the multiplication has nothing to do with the song reading waveform ... it should not stop at 22500 or 2.25 seconds of the song.. im thinking the audio buffer is limited to 2 seconds?

    the 22500 its the song with 36000 HZ in name... since the total lenght is around 3 minutes but it stops at around 1% of the song basically.

  • 22500 is a common sample rate for sounds so maybe that has something to do with it. It could be just how far ahead the plugin looks. You could try searching for the number in the audio plugin's source code to see if it's ever used.

    On another note in webaudio the analyzer effect seems to mainly just be used to get the waveform in sections. I'm not sure if it can get the entire song at once. Some googling about the webaudio analyzer hasn't yielding anything yet except for it being used to show the sound as it plays.

  • 22500 is a common sample rate for sounds so maybe that has something to do with it. It could be just how far ahead the plugin looks. You could try searching for the number in the audio plugin's source code to see if it's ever used.

    On another note in webaudio the analyzer effect seems to mainly just be used to get the waveform in sections. I'm not sure if it can get the entire song at once. Some googling about the webaudio analyzer hasn't yielding anything yet except for it being used to show the sound as it plays.

    hi r0j0 yea i have been looking into that .... .... however sample rates in audio plugin are not the real samples they have to be calculated on gettingfrequencybeat which c2 audio can do but ... not further then the first 22500 of them il look into that...

    i tried using functions and even arrays and saving the bitdataat each milisecond but the effect is the same just 22500 are read and written even if i have an array of 2250000

    i did look in the audio runtime js and the only close enough number to 22500 is 22050 which is on line 2399

    and the code is for playing a empty buffer

    // play empty buffer to unmute audio
    			var buffer = context["createBuffer"](1, 220, 22050);
    			var source = context["createBufferSource"]();
    			source["buffer"] = buffer;
    			source["connect"](context["destination"]);
    			startSource(source);
    		};[/code:2i4hq3rs]
    
    not even sure if this has any relevance...
    
    Edited: and it does not
    
    if i do draw while playing works good for the entire song... but not sections... something is up with the cache of the buffer clearing the samples and only reading from source it might be also that ... seen a few browser "Has enough memory tag around then cache cleared.." so im guessing the enough memory is around 2.25 seconds or i guess under 1 mb then after that the app wold buffer directly from the source... the weird part is .. even if i move the music in the sounds folder it still does it... so it cannot be the preloading of the music... its way out of my area...
    
    Edit2: have to mention if i draw a repeat from 1 to 22500 starting the loopindex("x") at 0 lets say and then repeat the same number loopindex at next interval of 200 px to right its drawing the same thing... the only problem is why it does not draw further after 22500 even though the loopindex takes the time to read the entire data of the song...which is 2.250.000 X rows
    
    how i know it reads all the data? .. if i leave only the 1 to 22500 repeat once then its only taking around 0.5-1 second if i leave it for the entire song... takes around 5 -10 seconds so something is reading the problem is does the writting is jumping with 10k further? i tried using the 100k layout to see if shows further out but no changes...  
    if i use the w3 audio array formula and saving of the bitssamples and repeat the audio.bincount 512 for the loopindex 1 to 22500 which is called preloading the samples of the song.... its not doing nothing else but repeating the same 22500 bits in same place... so its clearly something limiting it to that number or to 1-2% of a Music file(.ogg).
    
    as i noticed if i use the 36000hz song then the data is smaller and reads faster but same stops at the same 1-2% if i decrease the fft size from 2^15 which is 36000hz to 1024 or 2^10 then it reads the half of that so... i wold increase the fft size just we cant above 2^15 i dont see a usage above that either since the more bits the harder computers and browser wold be compatible....
    
    

    R0J0hound you said something is interrupting what ived seen in the runtime was that on some browsers its preloading till and quote "Memory is Enough" then after that it clears the cache and starts live streaming.[/p] [/p] Edit3: but as many websites that did tutorials on the web audio api a fft size of 1024 should read the entire song... it does not require to be that large... unless.................. i have to check something il edit later a bit...[/p] [/p] Edit4: ok so its nothing else but the first point i was wabling around... its related to the [url=http://support.ircam.fr/docs/AudioSculpt/3.0/co/FFT%20Size.html]fft size[/url] calculus and [url=http://support.ircam.fr/docs/AudioSculpt/3.0/co/Time%20Buffer.html]time buffer[/url] thats why is the 22050 in there its basically 21.35 hz band and on that hand the time buffer only plays an average 0.23s which in the example i made its a fftsize 10 times bigger so its adding up to 2.25 / 2.135 makes sense... but... now remains the question..[/p] [/p] how do we preload more samples then the 1 its doing?[/p] [/p] found a beat detection tutorial about samples... however i cant really understand how i wold move the next 1024 instances to the right... im guessing the loopindex it should automatically do it .........in C2 right? [/p] [/p] Simple sound energy algorithm #1: its relating to the sampling issue.[/p] [/p] [url=http://archive.gamedev.net/archive/reference/programming/features/beatdetection/index.html]Beat detection Gamedev[/url]

  • My next guess is that's how far ahead the song is loaded if it's being streamed. I'll try to look into it more tomorrow when I get access to construct again.

  • Ok I had a look and to me it looks like the audio analyser in webaudio isn't meant to read the entire song, only what's currently playing as a real time analysis. Maybe instead you could utilize the following to take a sound file and decode it into the raw pcm data and analyse that somehow:

    https://developer.mozilla.org/en-US/doc ... eAudioData

    Here's a the result:

    https://dl.dropboxusercontent.com/u/542 ... eform.capx

  • Ok I had a look and to me it looks like the audio analyser in webaudio isn't meant to read the entire song, only what's currently playing as a real time analysis. Maybe instead you could utilize the following to take a sound file and decode it into the raw pcm data and analyse that somehow:

    https://developer.mozilla.org/en-US/doc ... eAudioData

    Here's a the result:

    https://dl.dropboxusercontent.com/u/542 ... eform.capx

    ..... i wish i was near you to kiss you ... your my hero... this is perfect...... this solves a big problem of what i needed <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> now fun part comes haha <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> il keep you updated

    also what is the c2 brakets system for js ? cause i tried a few times using a normal javascript code but i always get some missing tips poping up cause of the closing being wrong does it have to be always between ("")? cause if thats how it works... how we replace the quote sign inside the js? with a ( ' ) ?

  • Usually I just replace all the " in the js with ' which works well. To actually use " in js it looks much uglier and makes it harder to find typos.

    For example the take this js:

    var name = "bob";

    To use in c2 this usually is what I do:

    "var name ='bob';"

    But if you want to still use " it looks like this:

    "var name=""bob"";"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • R0J0hound

    oh i see so if we keep the normal "bob" we have to basically add an extra " "bob" " system as for the words in a text variable. thats cool i guess thats why i was getting those issues i never added the extra quote signs

    that means i can use any js in w3 school

    thanks again Mr R0j0.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)