Export dynamic audio from Flash - actionscript-3

I'm generating a 44100hz dynamic audio stream in Flash using a flash.media.Sound object and the SAMPLE_DATA event. I'd like to be able to analyze the output instead of just listening to it.
What would be the most straightforward way of converting my Flash stream of float samples to an audio file, in a standard format that can be opened by an audio editor? Is there any audio format that would be particularly suitable for this?

If you don't want to listen to it, there's no need to use Sound or the Event.SAMPLE_DATA at all. Just create the numbers and store them in a ByteArray or other data structure.
Is there any audio format that would be particularly suitable for this?
A format that can be opened by your audio editor would be preferable.
Otherwise, this totally depends on what you want to do with the sound data.
What would be the most straightforward way of converting my Flash stream of float samples to an audio file, in a standard format that can be opened by an audio editor?
To use an existing library that encodes the data into the specified format.
tonfall supports "various audio formats Wav AIFF RAW PCM (no header) "Encoder/Decoder
WaveEncoder from Nicolas Bretin apparently encodes to WAV
Of course, if you know the specification, you can write your own encoder.

Related

Use JSON instead of m3u8 in hls.js

I am using hls.js in my project and it works well with .m3u8 playlists. However, in case of short clips, it is time-consuming to generate m3u8 playlists and therefore I want to pass a file, containing .ts paths ideally in a json format. Is this possible at all? Can we feed a hls player with chunks of json data rather than a whole m3u8 playlist?

How to merge to sound files in WP8?

It it possible to merge sound captured from microphone with an mp3 file selected and save as a new mp3 file in windows phone 8?
Does naudio have wp8 support??
Possible, yes. But you would have to decode the mp3 file into raw PCM data that matches the waveformat of the captured audio data, merge the pcm data (either an additive or mean merge or you'd simply add the captured audio data to the end of the pcm data from the mp3) and encode your new pcm data to MP3. There are plenty of libraries out there that support encoding/decoding of mp3 data and you might even find one that would let you decode/re-encode only the sub-sample of the mp3 file that you're interested in merging with captured audio data.
NAudio has, AFAIK, no WP8 support. I believe that they're currently working on Windows Store App support.
You would need to use WASAPI - which is a native-only API - or the Microsoft.XNA.Audio.Microphone-class to capture data.

Converting Mpeg file to flv and simultaneously playing the converted file in flash cs3 using as3

I have an mpg file which I want to convert to flv format, but I have a requirement that while converting the mpg file, I also have to simultaneously play the converted flv file in the flash cs3. How to do it? I am using cs3 and as3.
If you want to convert your files programmaticly then use ffmpeg. This is a commandline tool which can convert video files to nearly everything. You have to execute ffmpeg with the correct params and wait until the video is ready. This works only on serverside. Means the flash client loads up the video file to the server. There it gets converted. You can execute ffmpeg with any serverside language like php.
Sadly I have no idea if it is possible to watch the video while converting. I think not but maybe someone else knows more.

Flash record sound locally

Using flex,As can we record sound from microphone and store locally and and upload later?? Is there any relevant links to this please indicate
Check this link for how to use the microphone to record and use FileReference to save the recording
It is possible to record audio using the Microphone API SAMPLE_DATA event. The data property of the event is a ByteArray with the audio data.
A web based Flash application could copy these data samples to a data structure in memory and prompt the user to save the data to a local file. An AIR application would be able to write the data to the file system or SQL database directly.
See the links below for accessing audio from the microphone in ActionScript:
http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d1d.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Microphone.html
It may help to encode the data in a standardised format to help with reading and editing later (WAV or PCM). You may also want to use compression to reduce the file size for transmission (eg: Ogg Vorbis codec from Adobe).

Embed a wav as3

How can I embed a wav into as3/flash builder?
I have:
[Embed(source="assets/sounds/claps.wav")]
public var testSound:Class;
private var blahsound:Sound = Sound(new testSound());
But no luck...
You can't. Well, not directly.
Although there are various sound file formats used to encode digital
audio, ActionScript 3.0, Flash Player and AIR support sound files that
are stored in the mp3 format. They cannot directly load or play sound
files in other formats like WAV or AIFF.
You either need to convert it to an mp3 before embedding it. Or embed it as a ByteArray, and then try to use SampleDataEvent.SAMPLE_DATA to fill the sound buffer manually with the bytes from the wav file, but you are going to have to do some finagling.
It's possible, but hacky. As #32bitkid said, FP doesn't directly support loading sound files other than mp3. The solution is to load the wav as a ByteArray, construct a SWF in memory (as using the Flash IDE, you can add wav files), then access the Sound object from this SWF.
Check out http://richapps.de/?p=97
You can try the open source library, as3wavsound (AWS). It supports embedding .wav files and playing them natively.