[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] reading raw binary files



BTW, I solved easily in this way:

f = File("/Users/andrea/test/sig", "rb") ;
t = [] ; a = f.getFloatLE ; while {a.notNil}{t = t.add(a); a = f.getFloatLE} ;
b = Buffer.loadCollection(s, t, 1, {f.close }) ;


{PlayBuf.ar(1, b)}.scope ;


Best

-a-
 
--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - StudiUm
Università degli Studi di Torino
--------------------------------------------------

"This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." 
(Jeffrey 'The Dude' Lebowski)

On Dec 27, 2012, at 5:50 PM, Matt Kane's Brain <mkb-prime@xxxxxxxxxxxxxxxxxxx> wrote:

Sox can add the headers pretty easily.

On Dec 27, 2012 7:49 AM, "Andrea Valle" <valle@xxxxxxxxxxx> wrote:
Hi to all, 
Following some suggestions here: http://mitpress.mit.edu/books/audio-programming-book  (nice, btw)
I'm making some experiments with generation of audio signals in C, and I'm writing binary 32 floats to a file.
No header.
I'm able to open the files in Audacity, but that's a pretty boring process, so I was going to write some automated process in SC.
The Buffer help says you can read arbitrary data into bufs (as I have always assumed), but I'm not able to make SC load my files. E,g,

b = Buffer.read(s, "/Users/andrea/test/sig") ;
>
Buffer(1, nil, nil, nil, /Users/andrea/test/sig)
File '/Users/andrea/test/sig' could not be opened: File contains data in an unknown format. 
 
I guess it should be easy, but can't find a way

Thanks a lot

Best
-a-


--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - StudiUm
Università degli Studi di Torino
--------------------------------------------------

"This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." 
(Jeffrey 'The Dude' Lebowski)