Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition save format #2

Closed
Misty418 opened this issue Jun 4, 2016 · 2 comments
Closed

Composition save format #2

Misty418 opened this issue Jun 4, 2016 · 2 comments

Comments

@Misty418
Copy link
Member

Misty418 commented Jun 4, 2016

For now, here are the composition informations we save.

{
 bpm: int,
 files: [ { name: string, size: int, type: string }, ... ],
 tracks: [ { id: int, isOn: bool }, ... ],
 samples: [ { uifile: string, duration: float, offset: float, when: float }, ... ]
}

Some informations are missing like filters.
We have to think about how we will save it and the webaudio nodes.
But for now it's not a problem since we don't use filters yet.

Here's an example:

{
 "bpm": 120,
 "files": [
  {
   "name": "128bpm - buffalonugaluss-blerg-bass.wav",
   "size": 2646178,
   "type": "audio/wav"
  },
  {
   "name": "140 bpm - siknoiz-the-water.wav",
   "size": 604948,
   "type": "audio/wav"
  },
  {
   "name": "150bpm - corruptionedm-another-generic-dubstep-beat.wav",
   "size": 1129138,
   "type": "audio/wav"
  }
 ],
 "tracks": [
  {
   "id": 0,
   "name": "Bass",
   "isOn": true
  },
  {
   "id": 1,
   "name": "Water",
   "isOn": true
  },
  {
   "id": 2,
   "name": "Beat",
   "isOn": true
  }
 ],
 "samples": [
  {
   "uifile": "128bpm - buffalonugaluss-blerg-bass.wav",
   "duration": 4.25,
   "offset": 10.75,
   "when": 1
  },
  {
   "uifile": "140 bpm - siknoiz-the-water.wav",
   "duration": 6.857142857142857,
   "offset": 0,
   "when": 0
  },
  {
   "uifile": "150bpm - corruptionedm-another-generic-dubstep-beat.wav",
   "duration": 6.4,
   "offset": 1.5,
   "when": 2
  }
 ]
}
@mr21
Copy link
Member

mr21 commented Jun 8, 2016

Great!

I think it can be a good idea if we try to compress the file.
The most important is to know there will be only one "bpm", only one "files", "tracks" and "samples", but for the others, they will be numerous!
So I suppose it will be better if we stock the informations with array.

{
 bpm: int,
 files: [ [ name(string), size(int) ], ... ],
 tracks: [ [ id(int), toggle(bool) ], ... ],
 samples: [ [ fileId(int), when(float), offset(float), duration(float) ], ... ]
}

An another great gain of space is to use the file.id instead of the file.name.

The id of the tracks is because we don't save all the unused tracks right?

We have to save the track.id of each sample also.

@mr21
Copy link
Member

mr21 commented Jun 8, 2016

We also have to stock a "timestamp" (in seconds, not ms) to let we all the possibility to manage the futur deprecated save files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants