How to create a guitar tuner in javascript? - fft

i would like to create a guitar tuner in javascript but i don't know to to do it...
Once I recorded a 2 sec fragment audio file from the microphone, I would like for example what frequency is the note played in the recorded wav file !.
How to do it ?
I've heard about FFT, but what is the main purpose of FFT ?
Because when I edit an audio wav file un sublime text i obtain a thing like this:
0A12 4A3B etc...
Am I obliged to read this hexadecimal file or an algorithm detect frequency of a wav file ? Which one ? There is a tutorial ?

Look into this source code. And then make your own guitar tuner based on audio processing functions from that code.

Related

Compiling structure of .as back in swf

I am having a problem related to flash/as3 files.,
I decompiled an .swf file (shop in a open source game) wich, its in chinese. i want to translate some chinese pushstrings in "text" to english text.
I can decompile it simply, as wells after decompiling, editing it.
My main problem is (after spending 3 days in the Internet searching a method 2 do it), i can't just publish a new version of the .swf , with the .as translates back. It just gives an 1kb swf with no .as on it.
Btw: the .swf files consists of no animations, since its a sub part of a main one.
The structure of .swf after decompiling looks like this:
tinypic.com(safe) - .swf structure
I'm using Flash builder + Flash CS6 to edit. -- in case link broken -- http://tinypic.com/view.php?pic=2ldzy4o&s=8#.U6UVI_ldWSo
Any help would be apreciated. Thank you community ;)
De-compiling a Flash (SWF) file in order to recompile it will very, very rarely work.
It could be as simple as you having one error, but you'll find that all variable names are using standard names and without knowing the structure of the application, it wouldn't be easy to work out where the problems are.
You should begin by making sure that CS6 has the correct document class set up. Once you've got that, you'll start seeing the errors. With that amount of classes, though, I would expect there to be a lot of errors.
I've searched the Internet for about 5 days or something to make a method work, like u said barely worked. My main interest was to convert .as3 with Traditional Chinese Lang, to English. I found a program with a little slow method: JPEXS Free Flash Decompiler.
I can open a .swf file and edit it without decompiling, and edit the text(hard work with /Google translator) but, hey, it works (don't know how but somehow he compiles the traits of the text in the .as3). And I had to be cautious editing it, one little error or a " missing bugged the whole file.
Thanks anyway for your response :)

Streaming MP3 with pre-processing

I was wondering if there's a way to get streaming audio data (mp3, flac, arbitrary chunks of data in any encoding) from a server, process it and start playing after first chunk?
Background: All of our data is stored in compressed chunks, with a LAMP environment serving the data. de-compression and re-assembling is done client-side with
xhr-downloads, indexeddb, filehandle and/or chromefs. All currently
available audio/video functionality requires the audio to be
downloaded completely (otherwise decodeAudioData fails) or requires an
URL to the source without giving me a chance to process incoming data
client-side.
I am looking for a solution to squeeze my processing into the browser "inbuild" streaming/caching/decoding functionality (e.g. audio/video tag). I don't want to pre-process anything server-side, I don't want flash/java-applets and I'd like to avoid aligning data client-side (e.g. process mp3)
Question: Would it be possible to dynamically "grow" a storage that a bloburl points to? In other words: Create a filehandle / fileentry, generate a blobURL, feed it into an audio tag and grow the file with more data ?
Any other ideas?
Michaela
Added: Well, after another day of fruitless attempts, I must confirm that there are two problems in dealing with streamed/chunked mp3|ogg data:
1) decodeAudioData ist just too picky about what's fed into it. Even if I pre-align ogg-audio (splitting at "OggS" boundaries) I am unable to get the second chunk decoded.
2) Even IF I would be able to get the chunks decoded, how would I proceed playing them without setting timers, start positions or other head-banging detours? Maybe the webAudioAPI developers should take a look at aurora/mp3 ?
Added: Sorry to be bitching. But my newest experiments with recording audio from the microphone are not very promising either. 400K of WAV for a few seconds of recording? I have taken a few minutes to write about my experiences with webAudioAPI and added a few suggestions - from a coders perspective: http://blog.michaelamerz.com/wordpress/a-coders-perspective-on-the-webaudioapi/
Checkout https://github.com/brion/ogv.js. Brion's project chunk-loads an .ogv video and outputs the raw data back to screen through WebAudio API and Canvas, playing in the original FPS/timing of the file itself.
There is a StreamFile object in the codebase that handles the chunked load, buffering and readout of the data, as well as an example of how it is being assembled for playback through WebAudio.
I actually emailed Brion directly for a little help and he got back to me within an hour. It wan't built for exactly your use case, but the elements are there and I highly recommend Brion who is very knowledgeable on file formats, encoding and playback.
You cannot use <audio> tag for this. However, what you can use
Web Audio API - allows you dynamically construct audio stream in JavaScript
WebRTC - might need the streamed data pre-processing on the server-side, not sure
Buffers are recyclable, so you can discard already played audio.
How you load your data (XHR, WebSockets, chuncked file downloads) really doesn't matter as long as you can stick the raw data to a JavaScript buffer.
Please note that there is no universal audio format the browsers can decode and your mileage with MP3 may vary. AAC (mpeg-4 audio) is more supported and it has best web and mobile coverage. You can also decode AAC using pure JavaScript in Firefox: http://jster.net/library/aac-js - you can also decode MP3 in pure JavaScript: http://audiocogs.org/codecs/mp3/
Note that localStorage supports only 5 MB data per origin without additional dialog boxes, so this severely limits storing audio on the client-side.

Merge two sound files into a new file

How can merge two sounds and save as a new file?. One sound is a loaded mp3 file and the other from the microphone. Then I need to upload this sound into a server. Is this possible?
This all can be done, but if you looking simple example with few methods to call, I'm afraid it's not so easy.
You can extract bytes from sound with Sound.extract(). This data is sound amplitude in 16-bit numbers, right and left channel interleaved. Use ByteArray.readShort() to get them.
Microphone data can be captured with SampleDataEvent.SAMPLE_DATA, see example here. To mix them with song, just add sound amplitudes and write result into third array. The result will be essentially WAV-format (without header,) unpacked sound data. You can upload it raw, or search for "as3 mp3 encoder" (google), but these things are rare and written by entusiasts, so maybe you can get them work. Also, to mix sounds correctly, frequencies of data from mic and sound file must be equal.
And upload part - if this was file on disk, this would be easy - FileReference.upload(). But there's only data in memory. So you can look into Socket class to send it.

decompile/extract microsoft agent?

I'm looking for a way to decompress or decompile a microsoft agent.
for example the merlin agent
I'd like to extract the animations/images. best way i've found so far is. recording my screen with a pink background. and splitting the video... but this isn't really good practice...
any tips?
Years ago, I authored an MSAgent Character Data Specification, which documents the complete ACS, ACF, and ACA file formats.
I have used that knowledge to write my own MSAgent decompiler that can fully decompile an ACS file into its constituent image and audio files, and create a complete ACD file that can be opened in the MSAgent Editor.
You can download the decompiler from my website, under
"Products | Applications | MSAgent Decompiler".
As for extracting the animations from the ACS file, which is the file for the MS Agent Character, it cannot be done with any known software. Over the years, I have searched for methods to extract the files from the ACS file, have found nothing even as of today (May 6, 2017).
You might be able to get somewhere using resourcehacker. At the least, separate out the useless parts from the useful.
I'm not sure what format they would have used for that, which makes this more difficult. Either way you need to first break open the container first.

How to scan through a Flash .swf or .flv file and extract a specified number of frames from it?

I would like to be able to
create a folder for the copied video frames
access the individual frames frome a .flv video file and/or .swf file
save these frames to the auto-created folder
I assume one would need to do this using Action Script 3 to scan through the .swf and .flv files and extract the frames.
Are there gudies on how to do this?
You need to know WHAT frames do you want to extract. For example:
extract 20 frames in regular interval from the video clip
extract frames at 15 seconds interval
extract frames at keyframes (scene changes)
I guess that you don't have to use as3 to extract frames, but can also create the script in some other language. Central piece to frame extraction could be ffmpeg, as described in this article.
If it is as3 solution i would do following
- make a loader which loads your fla/flv
- add enter frame event listener to it and on each frame draw loader object to buffer, if you ever done any loading and drawing, this will probably take you 10-20 minutes to set up.
This is pretty much the only straigt-forward solution if you're dealing with code-based animations, videos can be handled in different and easier ways i guess.
You will face the challenge of saving the output tho. Flash player can save images on your computer, however only by prompting you to save the file. You will need to use functions available only in Air player if you want to save anything without prompts.