|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodesimian.CS<CSGeneric>
codesimian.DefaultCS
codesimian.SlowMP3
public class SlowMP3
Returns the audio data from an mp3 sound file,
after a delay from downloading and decompressing.
A window pops up while you wait and automatically closes itself when the mp3 starts.
mp3('fileNameOrURL') or mp3('fileNameOrURL' position) or mp3('fileNameOrURL' position megabyteLimit)
Default position is *(count timeIncrement).
Default megabyteLimit is 12.
Interpolates between data points in the mp3. Index (P(1).D()) can be any decimal number,
not just integers, so the sound is smooth with decimal indexs.
A faster way (this is not done yet) would be to
only uncompress the part of the mp3 being used currently,
but 8/06 I havent yet figured out how to uncompress a specific part of the mp3 instead of
linearly start to whenever it stops.
Because the uncompressed data is huge,
only a fraction (like a minute) of an mp3 can be uncompressed into the file and played.
Examples of codesimian code:
mp3(filename) or mp3(filename timeIndex) or mp3(filename timeIndex megabyteLimit)
sound(mp3("xx.mp3")) or sound(mp3("xx.mp3" count))
Example that plays sound at half speed: sound(mp3("xx.mp3" *(.5 count)))
Example that stops decompressing when 10 megabytes have been decompressed:
sound(mp3("xx.mp3" count 10))
Nested Class Summary | |
---|---|
static interface |
SlowMP3.DecompressMP3Listener
this interface should be merged with Files.DownloadListener or at least share a superinterface |
static class |
SlowMP3.DecompressMP3Thread
SlowMP3 should return fake mp3 data until this Thread gets the real data, so the sound player wont get impatient and turn off. |
Field Summary | |
---|---|
protected float |
defaultMegabyteLimit
|
protected double |
frequencyTranslation
Currently all sound is played at 22khz, but mp3s have more than 22000 sound samples per second. |
protected double |
timeIncrement
If countP()<2, there is no time index, so timeIndex is used and is incremented by timeIncrement each execution. |
protected double |
timeIndex
timeIndex is only used if P(1) does not exist (countP()<2). |
Fields inherited from class codesimian.CS |
---|
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS |
Constructor Summary | |
---|---|
SlowMP3()
|
Method Summary | |
---|---|
void |
decompressMP3()
|
static short[] |
decompressMP3(byte[] mp3Bytes,
SlowMP3.DecompressMP3Listener listener)
|
java.lang.String |
description()
a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for. |
double |
DForProxy()
Execute this CS and cast to double. |
java.lang.String |
keyword()
For the CodeSimian language as a String. CodeSimian language keyword, like "+" "*" "max" ">" etc. Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add. Some CSs might never be intended to be used in the language by their keyword. The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()". |
java.lang.Object |
L(java.lang.Class c)
can get the short[] array containing mp3 data |
double |
maxD()
maximum value D() can ever return (or any of the other primitive EXECUTE functions). |
int |
maxP()
Maximum quantity of Params |
double |
minD()
minimum value D() can ever return (or any of the other primitive EXECUTE functions). |
int |
minP()
For DForProxy(). Minimum number of parameters in param[] needed to call DForProxy(). Defines which indexs of param[] DForProxy() can use. Functions with a different number of parameters must override this. OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS. Default is 1. |
boolean |
setL(java.lang.Object o)
can set the short[] array containing mp3 data |
Methods inherited from class codesimian.DefaultCS |
---|
B, C, countP, decrementMyFuel, deleteP, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, LForProxy, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setPType, setS, setZ, start, toString, V, Z |
Methods inherited from class codesimian.CS |
---|
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, JForProxy, L, L, L, L, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double timeIndex
protected double frequencyTranslation
protected double timeIncrement
protected float defaultMegabyteLimit
Constructor Detail |
---|
public SlowMP3()
Method Detail |
---|
public double DForProxy()
CS
DForProxy
in class DefaultCS
public void decompressMP3()
public java.lang.Object L(java.lang.Class c)
L
in class CS
CS.Z()
,
CS.B()
,
CS.C()
,
CS.S()
,
CS.I()
,
CS.J()
,
CS.F()
,
CS.D()
public boolean setL(java.lang.Object o)
setL
in class DefaultCS
public int minP()
DefaultCS
minP
in class DefaultCS
public int maxP()
CS
maxP
in class CS
public double minD()
CS
minD
in class CS
public double maxD()
CS
maxD
in class CS
public java.lang.String keyword()
DefaultCS
keyword
in class DefaultCS
CS.parent()
,
CS.newInstance()
,
CS.name()
public java.lang.String description()
CS
description
in class DefaultCS
public static short[] decompressMP3(byte[] mp3Bytes, SlowMP3.DecompressMP3Listener listener)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |