Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Reading and writing narray/sound data to file
Jon Hope
2/17/2009 2:00:00 AM
Hi,
I was wondering if anyone could help.
I'm writing a program that analyses and processes audio in Ruby, using
the audio/sndfile library and narray. Currently I'm analysing a file and
storing the analysis data, an Audio::Sound class, directly into a file
like so:
sf = Audio::Soundfile.open(self.full_filename)
an_file = sf.readf_float(sf.frames)
File.open(self.full_filename + ".anl","w") do |out|
out << an_file
end
So now I have the data in this file stored directly as it is stored in
the an_file NArray.
My problem is that I want to crack open this file and load it directly
into a an Audio::Sound NArray. File.read and IO.read seem to load the
data as one giant string, even if I've previously declared that the
variable i'm loading it into is an Audio::Sound. Is there no way to
simply dump the data as-is?
Thanks
--
Posted via
http://www.ruby-...
.
1 Answer
Jon Hope
2/17/2009 3:13:00 AM
0
Having been able to declutter my brain I'm guessing I maybe should use
the Marshal module to serialize the data before saving, then use Marshal
to load it in situ?
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Reading and writing narray/sound data to file
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password