[Help Please] Sound data and files

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
rayaman
Prole
Posts: 10
Joined: Sat May 17, 2014 6:18 pm

[Help Please] Sound data and files

Post by rayaman »

Is it possible to store a sounddata object to the disk?
I know it has a getString() method, but how would I recreate the sound data using the string data?

Thanks
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: [Help Please] Sound data and files

Post by raidho36 »

You would need to copy it byte by byte into memory of a new empty sounds data object using FFI.

You can try using codecs or PCM wav libraries for saving normal audio files.
rayaman
Prole
Posts: 10
Joined: Sat May 17, 2014 6:18 pm

Re: [Help Please] Sound data and files

Post by rayaman »

Ok thanks, that sounds doable... I think I can figure out how to work this... Would I need to use the pointer data or what? I haven't really used the FFI library before. Any tips or examples of something like this being done?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: [Help Please] Sound data and files

Post by zorg »

To clarify things a bit, you could do SoundData:getString(), and then write out that whole string into a file... thing is, it would just be a raw dump of bytes (or words, depending on whether the sounddata was 8 or 16 bit); some programs can open such raw files, but most can't.

As raidho said, löve doesn't have a way to encode sound into a playable format, however, finding or even writing a wav (riff/pcm that is) exporter is not too complicated.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
rayaman
Prole
Posts: 10
Joined: Sat May 17, 2014 6:18 pm

Re: [Help Please] Sound data and files

Post by rayaman »

hmm... Ill look into it thanks for the replies :D Ill post what I come up with on the forums
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: [Help Please] Sound data and files

Post by bartbes »

Though I can't help but wonder how you got the SoundData in the first place...
rayaman
Prole
Posts: 10
Joined: Sat May 17, 2014 6:18 pm

Re: [Help Please] Sound data and files

Post by rayaman »

Oh I am using the love-microphone module that someone created and I can play back the audio while it is in memory, but I wanted people to be able to save the audio as well. https://love2d.org/forums/viewtopic.php ... 24#p180124
Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests