Giter Site home page Giter Site logo

sri-soham / shine-mp3-encoder-on-as3-alchemy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyrildiagne/shine-mp3-encoder-on-as3-alchemy

10.0 7.0 1.0 2.38 MB

Flash/Alchemy port of the lightweight Shine MP3 Encoder

Home Page: mp3encoderAS3

ActionScript 2.18% C 97.82%

shine-mp3-encoder-on-as3-alchemy's Introduction

To use the swc file in your flex application, include the swc file while
compiling the application.

"mxmlc my_app.mxml -library-path+=/path/to/shineMP3_alchemy.swc"

I have included only the option to include the swc file. There will/might be
other options that you have to pass to mxmlc.

Shine converts wav to mp3. If you want to convert raw sound data in bytearray
to mp3, you have to first convert the raw sound to wav and then convert wav to
mp3.
http://code.google.com/p/speechapi/source/browse/trunk/src/flash/com/adobe/audio/format/WAVWriter.as

You can read this http://www.adobe.com/devnet/air/flex/articles/using_mic_api.html
on how to capture raw sound data and on how to convert to wav.

Some sample code to get you started.
-----------------------------------

import com.adobe.audio.format.WAVWriter;
import fr.kikko.lab.ShineMP3Encoder;

private var mp3encoder:ShineMP3Encoder;
private var rawData:ByteArray;

protected function processData():void {
	var wavData:ByteArray = convertToWAV(); //convertToWAV not defined. You have to do it yourself.

	// 128 is the default bit rate.
	// Allowed values for bitrate are: 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224,
	// 256 and 320
	mp3encoder = new ShineMP3Encoder(wav, 32); // 32 is the target bitrate
	mp3encoder.addEventListener(Event.COMPLETE, getMP3);
	mp3encoder.addEventListener(ProgressEvent.PROGRESS, updateProgress);
}

protected function updateProgress(event:ProgressEvent):void {
	trace('% completed = ' + event.bytesLoaded); // or you can show a progress bar.
}

protected function getMP3(event:Event):void {
	var mp3Data:ByteArray = mp3encoder.getMP3Data();
}


If you want to delve into the code and do something more:
========================================================
* You have to get the source code by forking or any other means.
* You'll have to download the alchemy toolkit from http://labs.adobe.com/downloads/alchemy.html
* Follow the instructions to install alchemy on your machine.
* If you have modified the source code in lib/shine, run "make" in lib/shine
  directory to generate the /lib/shine/shine.swc file. Then run the build_as3.sh
  in the project root folder to generate the bin/shineMP3_alchemy.swc
* If you have modified the actionscript source in 
  src/fr/kikko/lab/ShineMP3Encoder.as, run the build_as3.sh in the project 
  root folder to generate the bin/shineMP3_alchemy.swc

NOTES:
=======================================================
I'm not a legal expert by any stretch of imagination. You are using this code
at your own risk. Why is that and why did law come into the equation here?

* MP3 is not a free codec. http://mp3licensing.com/royalty/
* And this is an LGPL'ed code. If you link the library statically into your
application, that too will be come under LGPL or GPL(not sure which one, as i
said earlier, I am not a lawyer).

So, if you use this code and become the next big thing like Google or Facebook,
and you have lawyers knocking on your door, don't blame me; I have warned you.

shine-mp3-encoder-on-as3-alchemy's People

Contributors

sri-soham avatar

Stargazers

Ylazy avatar ROBERT MCDOWELL avatar Jia avatar Owen Edwards avatar lincx avatar Ligboy avatar Nikolay Vasilchuk avatar Nick Andrievsky avatar Stelios Tzitzikakis avatar  avatar

Watchers

 avatar  avatar ROBERT MCDOWELL avatar Joonsoo Kim avatar Nick Andrievsky avatar Anton Iacono avatar  avatar

Forkers

xiangjiabanana

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.