Expand description

Floaout

Crate API

Floaout is the next-generation audio format.

Bubble File Format Specification

Metadata

NameType (Bytes)Description
Spec Versionu8 (1)Version of Bubble File Format Specification.
Bubble IDu128 (16)Bubble ID of this file. The value is 0 if the Bubble is undefined. If it is not 0, it must be based on the ID managed by bkbkb.net.
Bubble Versionu16 (2)Version of Bubble
Framesu64 (8)Number of frames
First Head Absolute Frameu64 (8)First Head Absolute Frame
Samples Per Secf64 (8)Samples per sec
LpcmKindu8 (1)LpcmKind
BubSampleKindu8 (1)BubSampleKind
Name Sizeu8 (1)Name Size (0~255)
NameStringName (UTF-8)
CRC-32K/4.2u32 (4)Max length at Hamming Distance 4 is 2147483615 (bits). And max length at Hamming Distance 6 is 6167 (bits).

LpcmKind

VariantDescriptionValue (Type)
F32LEf32 Little Endian0 (u8)
F64LEf64 Little Endian1 (u8)

BubSampleKind

VariantDescriptionValue
LpcmLpcm0
ExprExpr1

CRC

Algorithm::<u32> {
    endian: Endian::Little,
    poly: 0x93a409eb, // CRC-32K/4.2
    init: 0xffffffff,
    refin: true,
    refout: true,
    xorout: 0xffffffff,
    residue: 0x76e908ce,
}

Each Sample

| Bubble Sample | | BubbleSample |

Bubble Sample

NameType (Bytes)Description
Bubble Functions sizeu16 (1)Bubble Functions size
Bubble’s absolute X coordinateSumBubble’s absolute X coordinate (X_0)
Spacechar (1)’ ’
Bubble’s absolute Y coordinateSumBubble’s absolute Y coordinate (Y_0)
Spacechar (1)’ ’
Bubble’s absolute Z coordinateSumBubble’s absolute Z coordinate (Z_0)
Spacechar (1)’ ’
DomainOrOrExpr
Spacechar (1)’ ’
VolumeSum
Space or Emptychar (1)’ ’ if there is another
Foot Relative Frameu64 (8)Number of frames at the end of BubFnsBlock.
Next Head Relative FrameOption<u64> (8)Number of frames at the start of the next BubFnsBlock. None if 0.
Sample DataSample Data
CRC-32K/4.2u32 (4)After every foot frames. From the previous CRC.

Sample Data

Lpcm
NameType (Bytes)Description
Samplef32 or f64 (4 or 8)depends on LpcmKind
Expr
NameType (Bytes)Description
Expr Sizeu16 (2)Expr Size
ExprSumExpr

Keywords

Variables
KeywordDescription
XSpeaker’s absolute X coordinate
YSpeaker’s absolute Y coordinate
ZSpeaker’s absolute Z coordinate
xx = X - X_0 (X_0 is Bubble’s absolute X coordinate). Speaker’s relative X coordinate.
yy = Y - Y_0 (Y_0 is Bubble’s absolute Y coordinate). Speaker’s relative Y coordinate.
zz = Z - Z_0 (Z_0 is Bubble’s absolute Z coordinate). Speaker’s relative Z coordinate.
NAbsolute frame n. Number of frames starting from the file. (as f64)
nRelative frame n. Number of frames starting from at the start of BubFnsBlock.(as f64)
FFrames (as f64)
SSamples per sec
Constants
KeywordDescription
EEuler’s number
PIPi
Functions
KeywordDescription
sinSine
cosCosine
tanTangent
lnThe natural logarithm of the number.
lgThe base 2 logarithm of the number.
Others
KeywordDescription
bb???????? f64

Punctuation

SymbolName
+Plus
-Minus
*Star
/Slash
&&AndAnd
==EqEq
!=Ne
>Gt
<Lt
>=Ge
<=Le

Delimiters

SymbolName
Space
,Comma
( )Parentheses

Syntax

// BubFns
BubFns = BubFn ZeroOrMoreBubFns / f
ZeroOrMoreBubFns = SpaceAndBubFn ZeroOrMoreBubFns / ()

SpaceAndBubFn = Space BubFn / f

// BubFn
// BubFn = Sum Space Sum Space Sum Space OrOrExpr Space Sum
BubFn = SumAndSpace BubFn1 / f
BubFn1 = SumAndSpace BubFn2 / f
BubFn2 = SumAndSpace BubFn3 / f
BubFn3 = OrOrExprAndSpace BubFn4 / f
BubFn4 = Sum () / f

SumAndSpace = Sum Space / f
OrOrExprAndSpace = OrOrExpr Space / f

// OrOr Expr
OrOrExpr = AndAndExpr OrOrExpr1 / AndAndExpr
OrOrExpr1 = OrOr OrOrExpr / f

OrOr = "||" () / f

// AndAnd Expr
AndAndExpr = ComparisonExpr AndAndExpr1 / ComparisonExpr
AndAndExpr1 = AndAnd AndAndExpr / f

AndAnd = "&&" () / f

// Comparison Expr
ComparisonExpr = Sum ComparisonExpr1 / f
ComparisonExpr1 = Comparison Sum / f

Comparison = EqEq () / Comparison1
Comparison1 = Ne () / Comparison2
Comparison2 = Ge () / Comparison3
Comparison3 = Le () / Comparison4
Comparison4 = Gt () / Comparison5
Comparison5 = Lt () / f

EqEq = "==" () / f
Ne = "!=" () / f
Ge = ">=" () / f
Le = "<=" () / f
Gt = '>' () / f
Lt = '<' () / f

// Sum
Sum = Term ZeroOrMorePlusOrMinusAndTerms / f
ZeroOrMorePlusOrMinusAndTerms = PlusOrMinusAndTerm ZeroOrMorePlusOrMinusAndTerms / ()
PlusOrMinusAndTerm = PlusOrMinus Term / f

// Term
Term = Factor ZeroOrMoreStarOrSlashAndFactors / f
ZeroOrMoreStarOrSlashAndFactors = StarOrSlashAndFactor ZeroOrMoreStarOrSlashAndFactors / ()
StarOrSlashAndFactor = StarOrSlash Factor / f

// Factor
Factor = PlusOrMinus Factor / Power

// Power
Power = Atom PowerAndFactor / Atom
PowerAndFactor = '^' Factor / f

// Atom
Atom = ExprInParentheses () / Atom1
Atom1 = FloatLiteral () / Atom2
Atom2 = IntegerLiteral () / Atom3
Atom3 = Function () / Atom4
Atom4 = Variable () / Atom5
Atom5 = Constant () / f

// Variable
Variable = UppercaseX () / Variable1
Variable1 = UppercaseY () / Variable2
Variable2 = UppercaseZ () / Variable3
Variable3 = LowercaseX () / Variable4
Variable4 = LowercaseY () / Variable5
Variable5 = LowercaseZ () / Variable6
Variable6 = UppercaseN () / Variable7
Variable7 = LowercaseN () / Variable8
Variable8 = UppercaseF () / Variable9
Variable9 = UppercaseS () / f

UppercaseX = 'X' () / f
UppercaseY = 'Y' () / f
UppercaseZ = 'Z' () / f
LowercaseX = 'x' () / f
LowercaseY = 'y' () / f
LowercaseZ = 'z' () / f
UppercaseN = 'N' () / f
LowercaseN = 'n' () / f
UppercaseF = 'F' () / f
UppercaseS = 'S' () / f

// Constant
Constant = E () / Constant1
Constant1 = Pi () / f

E = 'E' () / f
Pi = "PI" () / f

// Function
Function = Sine () / Function1
Function1 = Cosine () / Function2
Function2 = Tangent () / Function3
Function3 = Ln () / Function4
Function4 = Lg () / f

Sine = "sin" Factor / f
Cosine = "cos" Factor / f
Tangent = "tan" Factor / f
Ln = "ln" Factor / f
Lg = "lg" Factor / f

// Delimiters
ExprInParentheses = '(' ExprAndClose / f
ExprAndClose = Sum ')' / f

// Integer
IntegerLiteral = DecLiteral () / f

// Float
FloatLiteral = DecLiteral PointAndDecLiteral / BytesF64Literal
PointAndDecLiteral = '.' DecLiteral / f

BytesF64Literal = 'b' ???????? / f

// Dec
DecLiteral = DecDigit ZeroOrMoreDecDigits / f
ZeroOrMoreDecDigits = DecDigit ZeroOrMoreDecDigits / ()

DecDigit = '0' () / DecDigit1
DecDigit1 = '1' () / DecDigit2
DecDigit2 = '2' () / DecDigit3
DecDigit3 = '3' () / DecDigit4
DecDigit4 = '4' () / DecDigit5
DecDigit5 = '5' () / DecDigit6
DecDigit6 = '6' () / DecDigit7
DecDigit7 = '7' () / DecDigit8
DecDigit8 = '8' () / '9'

// Others
PlusOrMinus = Plus () / PlusOrMinus1
PlusOrMinus1 = Minus () / f
Plus = '+' () / f
Minus = '-' () / f

StarOrSlash = Star () / StarOrSlash1
StarOrSlash1 = Slash () / f
Star = '*' () / f
Slash = '/' () / f

Space = ' ' () / f

Floaout File Format Specification

Metadata

NameType (Bytes)Description
Spec Versionu8 (1)Version of Floaout File Format Specification.
Floaout IDu128 (16)Floaout ID of this file. The value is 0 if the song is undefined. If it is not 0, it must be based on the ID managed by bkbkb.net.
Floaout Versionu16 (2)Version of Floaout
Bubblesu16 (2)Number of Bubbles
Framesu64 (8)Number of frames
Samples Per Secf64 (8)Samples per sec
LpcmKindu8 (1)LpcmKind
Title Sizeu8 (1)Title Size (0~255)
TitleStringTitle (UTF-8)
Artist Sizeu8 (1)Artist Size (0~255)
ArtistStringArtist (UTF-8)
CRC-32K/4.2u32 (4)Max length at Hamming Distance 4 is 2147483615 (bits). And max length at Hamming Distance 6 is 6167 (bits).

Each Bubble

Bubble Files will be ‘i.bub’ (i = 0, … , Bubbles - 1)

NameType (Bytes)Description
File Name Sizeu8 (1)File Name Size (0~255)
File NameStringBubble File Name without “.bub” (UTF-8)
Bubble Starting Framesu16 (2)Number of Bubble Starting Frames
Bubble Starting Frameu64 (8)Bubble Starting Frame
Bubble Starting Frameu64 (8)Bubble Starting Frame
CRC-32K/4.2u32 (4)From the previous CRC.

Library License

Format License

  • Except modify or derive from these formats specification, anyone can use or create these formats the way each wants.

  • these formats = { Bubble, Floaout }

(As a precaution, copyrights and other intellectual property rights belong to the artists and their associates.)

TODO

  • Use generic type in Color and Space.
  • Add read_bub_fns_block in BubFrameReader
  • error handling
  • Clarify whether #[derive(Order)] is needed
  • Add Position field in BubfnsInterpreter
  • Check file is supported version or not
  • Parallel computing
  • Add Functions like pow, sinh, …

Re-exports

pub use crate::colors::Rgb;
pub use crate::colors::Rgba;
pub use crate::coord::BubFnsCoord;
pub use crate::coord::Coord;
pub use crate::crc::CRC_32K_4_2;
pub use crate::lpcm::Frame;
pub use crate::lpcm::LpcmKind;
pub use crate::lpcm::Sample;
pub use crate::space::OaoSpace;
pub use crate::space::OaoSpaces;

Modules

Enums

FrameIOKind

Traits

Frame Reader

Frame Writer

Metadata

Reader

Writer