ActionScript 3.0 :: Generating A Simple Waveform Of A Sound Object?
May 28, 2011How do I go about generating a simple waveform of a sound object.
View 5 RepliesHow do I go about generating a simple waveform of a sound object.
View 5 RepliesI have a project that requires me to display the waveform for a uploaded sound. The sound is always an MP3, most of the time 22.05 kHz mono, with speech only. The project are written with Flex/ActionScript 3. It's meant to run in the browser, but might also consider converting to AIR if that can help.
All examples I've found and looked at for generating a wave, are either doing some visualization in real time as the sound is playing, or, the most promising, as3soundeditorlib, keeps the wave already generated, but does it very slowly, seemingly using as long time as playing through the audio would've taken.Is there any way to generate the wave faster than real time?
Flash is not in my toolset, but I am an old Director jock and have spent some hours dipping my head into the Flash manual. I suppose that makes me a promising beginner-level poster. I'm working in CS5.
I need to make a simple Flash-based sound player for a website for a newly-released novel (http://www.bearriverbooks.com/index.html). I want the user to click on what appears to be an icon (or image), which kicks open a simple controller and starts playing a sound file (a radio interview, which I will probably export using Flash's voice compression). Nothing fancy. Just want the visitor to hear the sound and be able to apply simple controls (stop/start/rewind/volume).
I can learn ActionScript, I suppose, since I used to dream in Lingo, but my life would be a lot simpler if I could just publish a controller without having to roll my own. I'd like to think there's a magic button somewhere that can do this, but I haven't found it yet.
If I have a sound waveform stored as a ByteArray in actionscript 3, how would I go about converting this into a Sound object that can be played?
Note that the array is full of sound samples - a complete generated waveform. It isn't an array containing an mp3 or other compressed data.
I'm trying to create a visual waveform for an MP3. The code I've included is called on successful load of the MP3. I intend to extract just a few important samples from the sound to create the waveform, rather than extract the entire sound into a bytearray. Even on a good machine, extracting an entire song can cause flash to freeze up for 3-5 seconds (or longer!). For my purposes, this isn't feasible.
Unfortunately, the code I've got below is failing to produce any numbers. If I extract the entire song it functions, but extraction of just the key points is giving me nothing. Does performing an extract make the remainder of the sound object invalid for future extracts? If so, is there some way around this that won't freeze flash for an extended period of time during the extract? Some important variables from the rest of the code:
[Code]...
I found on Adobe website this cool as3 code to grab a sound and make a realtime waveform graph (I cannot post the link..The problem, to me, is that I cannot create in the same stage 2 graph from 2 input: the mic and an mp3.In my purpose, I'd like a stage with just 2 waveform graph. the upper one with the realtime voice from the mic input.the second one (just below the previous one) with a similar waveform graph but drawn by an MP3 file (or wav).
At the beginning I tried to use 2 inputs ".microphone" but I can always see just 1 graph. It's like the resources cannot be shared (al least not so simply).
I'm generating a sine wave and playing it as a sound. But When I call SoundMixer.StopAll() it's causing a click when sounds stops. I think its because it's cutting the sound off in the middle of the wave, I was wondering of a way to make the sine wave slowly ripple out before i stop it. Is there already functions to do this in Action Script 3 or is my sine wave function i need to modify here is my code for the wave.
function sineWave(event:SampleDataEvent):void { var sample:Number for (var i:int=0; i<8192; i++) { sample = Math.sin((i+event.position) * ((2 * Math.PI)/44100) * freq); // freq is just any frequency event.data.writeFloat(sample * .15); event.data.writeFloat(sample * .15); } }
basically i simply want to give the option of turning of the sound in my flash via a button (If you press it sound goes mute, press it again sound unmutes) I searched around in the tutorials but i could only find (for this purpose) complicated pan sound control stuff.
View 1 Repliesi am writing a class for button bar and encapsulating it into main file when i call the setter an object should generate ex:
var s:ButtonBar = new ButtonBar();
s._texts ="kiran";
s._texts = "karthik";
[code].....
Im trying to do a simple roll over sound on a nav button for my website, I thought this would be simple, iv got loads of simple code like
[Code]....
Which I imagine works perfect, but I cant find where I give the sound in my library the instance name "my_sound" or whatever ?
Is there any AS3 library or code-snippet that can create altered versions of a Sound object on-the-fly (at runtime)? Either based on:
An existing Sound object; A ByteArray object;
For example, say you have a "dry" sound of a gun-shot. You could:
[Code]...
I am using the following to extract the byte info from a sound object - however if I go back to the same sound object and run this again, The byteArray has no bytes available.
var data:ByteArray = new ByteArray;
sound.extract(data,sound.length*44.1);
data.position = 0;
return data;
Is this the correct behavior? Is there not a way to do this multiple times on the same sound object?
I have been at this for about 19 hours straight! I am going to go to bed immediately after this post, but for crying out loud, I have NEVER had this problem before today! Before anyone reads ahead and says 'you have to attach your sound object to a completely separate mc to be able to control it independently from all other sound/root volumes.' see if the following code accomplishes just that:
[Code]...
This is what I try to do: I am creating a game with spoken sentences. These sentences are loaded dynamically from an XML file, which contains the paths to mp3-files.This is what is currently happening: All sentences are spoken at the same time.I want them to be spoken one after another - how to I obtain this requirement?This is my (simplified) code example:
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
[code].....
Does anybody have a simple "load sound" example to show me the proper way to load the sound within a class file?
I tried
ActionScript Code:
import flash.events.*;
import flash.media.*;
[Code].....
Quote:
1067: Implicit coercion of a value of type String to an unrelated type flash.net:URLRequest.
I also tried declaring a "loader" variable, and then setting my sound variable to = my load variable, but that didnt work either ....
Is it possible to take two Sound objects and combine them into one Sound object so that one Sound plays, and then the second plays right after it? I can just play the first Sound and then the next right after it, but it would be much cleaner to combine them before playing the audio.
View 1 RepliesI have a streaming sound that is loaded into my flash movie (will end up on CD) that is very distorted, it sounds like someone is slowing down the audio, the voice sounds deep and slow
View 1 RepliesI am unable to visualize the audio waveform in my flash timeline. I need to synchronize audio voiceover work and this is impossible to do without being able to see the timeline.
I am using CS4.....in previous versions I was able to see the waveform but no go for this version.....
I'm trying to create a WAV audio player for a website which will display the audio waveform like this site does: [URL]
Is there a way to do this? I've spent hours searching the internet with no luck.
I'm trying to stream *.wav files on a webpage and looking for a flash program which will show the full audio waveforms. Something like this:
How to do this? Again, streamings not the heard part, I just need to allow users to see the waveform timeline.
i've come across this ActionScript sample, which demonstrates drawing of the color spectrum, one line at a time via a loop, using waveforms.however, the waveform location of each RGB channel create a color spectrum that is missing colors (pure yellow, cyan and magenta) and therefore the spectrum is incomplete.how can i remedy this problem so that the drawn color spectrum will exhibit all colors?
// Loop through all of the pixels from '0' to the specified width.
for(var i:int = 0; i < nWidth; i++)
{[code]...........
I am trying to create an audio watermarking system. I figure the best solution is to create an audio file (WAV) based on a unique string of text and then combine this with the original wav.The part that makes this tricky (for me anyway) is:How do I convert the text string to a wav?How do I ensure that the resulting WAV form is inaudible (or at least barely noticeable to the listener). would prefer this be done server side (via PHP, etc) but if the processing load isn't too much then would be ok with something in Flash or Javascript.
View 1 RepliesI've got a flash 10.1 app that lets me record microphone input to a wav without a media server, which I am saving to an Amazon S3 bucket.I have another process running on a server which gets wavs from this bucket, converts to mp3 using LAME and puts them into another bucket. This all works fine, but in converting wav > mp3, about 0.1sec or so of silence is added to my sound.In the application this are being used in, perfect sync is critical, so I need to trim off that little bit. If I have to trim it off the original waveform that is okay, I don't expect anything important to happen in that first fraction of a second.
What is the best way to go about this? I am using Adobe's WavWriter to convert by ByteArray into a proper waveform. Is there a way I can easily trim off the first few samples from my ByteArray without invalidating the structure?Alternatively, is there a good server-side tool I can use to trim the wav before running it through LAME, or an argument I can give LAME? Or, could I even trim that sound off the mp3 after it has been converted?
I'm making a audio recorder with Adobe Flex (Microphone, NetStream), I want to get the current audio wave from Microphone to display in the visualization area, how can i get the data?
View 1 RepliesSo I am trying to make a music player in AS3 that displays the tracks waveform. how to display the waveform in flash.
basically I'm look for a player like this [URL]
Is there a way to convert the XML object into a simple object? I'm parsing a string into XML and I realize that in itself is an object, but I want an object that doesn't include the functions/properties related to XML itself (appendChild, attribute, etc).
The problem is that I want to pass the XML data (in object form) to Javascript via the ExternalInterface, but I can't seem to pass anything more complicated than a simple object.
I have got three screenshots below of Flash-based audio players on various websites that draw a waveform of the clip it is going to play and moves along while it is playing and also allowing the user to click on a point on the audio file and it jumps to that point.I have very little Flash knowledge but is this easy to achieve? I would like to just show the Flash file an mp3 and it draws the waveform. I understand this could be quite intensive on CPU so would there be a way of caching the waveform data so it doesn't redraw each time the file is loaded?
View 5 RepliesI'm trying to check to see if an object exists by using a simple if statement.
if (object.name) {
//Do this
}
However, if the object doesn't exist, I get this error, "Error #1010: A term is undefined and has no properties" - which I understand is because the object doesn't exist. Is there a better way to check to see if an object exists?
What resources should I look at to learn how to create a very simple platform game, with a character who can simply jump on platforms and avoid enemies to reach the end of the level? I have made games like this with other languages but never flash.
View 2 RepliesSo what I nedd is simple - how to create a drag and dropable circle with flex 4 and AS3 and using Box2d make it fly some more in the direction of drag and than stop?
View 2 Replies