Re: Aup3 and blockfiles

Petr Pařízek via audacity-devel <[email protected]>
Newsgroups gmane.comp.audio.audacity.devel
Message-ID <[email protected]>
Freddyjohn writes:

<<<<<

Hello, I am writing an application similar to audacity for android. I am 
currently working on the data structure to support editing. I was 
studying the old format with what I think was B-tree inside xml 
doc until I read the articles about 3.0 yesterday. It is a lot easier 
to reverse. But one thing I ask out of Curiosity, what is with the 
encoding for the block files? It looks like the samples are aligned in 
some pattern. If you drop the output of these files into HxD for example.

It’s like this with spacing increasing linearly
s1.s2
s100..s101
s200...s201
If you unpack these bytes as 32 bit float and graph the samples it looks 
like audio data. But if I multiply each sample by 32767 and throw on a 
wav header it sounds like the bytes are offset(very horrible noise you 
don’t want to be familiar with). So is there more going on in a 
blockfile than just raw audio data? If so why?
 >>>>>

I've tried it with a simple two-track project and here's what I've been 
able to find:
- The data is indeed written as standard 32-bit IEEE float.
- To find the start of the first sample, I had to skip an odd number of 
bytes, which meant that when loading the file as raw data (including all 
the headers), the number of skipped bytes had to be one more than a 
multiple of 4.
-That's why many editors are unable to play it correctly because, for 
32-bit data, they only allow skipping a number of bytes that is a 
multiple of 4.
- Surprisingly, when data from one track finish and data from another 
track begin, the byte offset changes. Therefore, when I skipped one 
byte, the first track sounded okay. When I skipped 0 bytes (i.e. loaded 
the entire thing), the second track sounded okay.
-From that I'm gathering (not verified yet but I can do that if someone 
desires) that if my project had one more track, it would probably load 
correctly if I chose to skip 3 bytes.

Petr



-- 
Tento e-mail byl zkontrolován na viry programem AVG.
http://www.avg.cz

_______________________________________________
audacity-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
get.py (application/octet-stream, 367 B)
import sqlite3

db=sqlite3.connect("three.aup3")
cur = db.cursor()
num_blocks=len(cur.execute("SELECT blockid FROM sampleblocks").fetchall())


for i in range(1,num_blocks+1):
  block_bytes=cur.execute('SELECT samples FROM sampleblocks WHERE blockid = '+ str(i)).fetchall()[0][0]
  open(str(i),'x')
  with open(str(i),'wb') as f:
    f.write(block_bytes)
Attached Message Part (text/plain, 2 B)

    
Attached Message Part (text/plain, 179 B)
_______________________________________________
audacity-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.