Page 1 of 3

PadSound (*fixed MS Sound Recorder bug problem*)

Posted: Sat Oct 15, 2005 4:27 am
by 7feet
Since we need more audio stuff, I figured I'd make some. Here's the first little bit.

PadSound v1.03 (zip file) (*link updated 12/10/05 with fix to properly set new soundtrack*)(*Updated again 7/30/06, forgot to include a function - duh*)

(*Updated again 8/4/06 - workaround for stupid Windows Sound Recorder bug - sheesh!)

Unzip somewhere in your Moho>Scripts>Menu folder.

But what is it? It adds silence to the beginning of the audio file you choose so that it will start playing at the current frame. The file is saved with the same name as the one you choose, with "PADDED" added to the end of the filename. It's supposed to then assign it as the soundtrack, but there's a wee bug (I think) with a new script function, so that part isn't working at the moment. It's still in the script, so as soon as LM get's it fixed (or tells me I'm an idiot and what I did wrong) it'll work fine. But for now, you have to reload the new file as the soundtrack by hand.

Still, it's handy and takes a lot of the thinking out of the process, and leaves it for important stuff.

Restrictions:
:!: The file must have a ".wav" file extension
:!: Only works with .WAV files, and the must be uncompressed, i.e. no ADPCM, MP3's with WAV headers, etc.
:!: The new file is processed in memory, so truly huge files may tax the RAM on your system, but I truly doubt that it would get to that point for this purpose. Unless you want to use it to pad a 40 minute soundtrack, it should be just fine.
:?: Haven't tried it on a Mac, so though I think it's good I haven't tested the byte order code for Motorola processors. Somebody'll tell me pretty quick if I muck it up, I'm sure.

I'll have a version that will let you mix the sound into the currently chosen soundtrack, but for now this is a taste. I'm pretty confidant it's solid, but let me know if anything screwy happens. Enjoy.

Oh,yeah, there's also a lot of functions in there that aren't used yet, for the mixing. Normalizing (peak,average and RMS), filters (hi/lo/bandpass, notch) and EQ (hi/lo shelf, single frequency peak. If anyone else (okay, I know it's unlikely) want's to muck around with them, have at it.

Posted: Sat Oct 15, 2005 4:50 am
by ulrik
Hi 7feet!

Thanks for the script, it works as it should running osx 10.4.2 on macintosh, the file get created wih "padded" assigned in the file name :D

Posted: Sat Oct 15, 2005 5:11 am
by 7feet
Coolness. I thought it was good to go, but the confirmation is welcome. I'm feeling like I'm on a bit of a scripting roll, so I may have a rough mixer by the end of the day. No guarantees, y'know, but I have a feeling...

Posted: Sat Oct 15, 2005 5:16 am
by Rai López
...WHAT A DAY!!! :D 7feet, really you never rest/sleep! And now I'm SO intrigated about that mixer SUPER script proyect that I'll neither can do it!!! :x Jajaj... THANK YOU very much for all! I can't imaginate how you can get something like this, but I think this can change (for me at least) the way to work with Moho at last! I mean, if finally you get it (PLEASE God :roll: ), It'd be possible start with the proyects directly in Moho, since the first idea??? Wow... :!: I mean (again), start storyboarding (YOO-HOOO!!! :D ) with the possibility of basic sound set up/stablisment and syncronism) and go on working in the same scene proyect practically to the end! I've been waiting for someting like this since I knew Moho and I'm mad of HAPPY! :D I only HOPE that you (and LM) can easily resolve all that inconveniences that you are talking... GOOD LUCK for my part! (SORRY, jaja... I can't do much more :roll: ) and have a good rest! (...definitely I'll can't! :x ) ...jaja, CIAO! :D

PS: ...By the way, sorry too for all that emoticons! But I've can't avoid it!!! :D :D :D

Posted: Sat Oct 15, 2005 6:23 am
by ulrik
7feet wrote:Coolness. I thought it was good to go, but the confirmation is welcome. I'm feeling like I'm on a bit of a scripting roll, so I may have a rough mixer by the end of the day. No guarantees, y'know, but I have a feeling...
Ohhhh....that sounds great, I'm excited about the mixer

:D :D :D

Posted: Sat Oct 15, 2005 6:26 am
by cribble
very handy script, really handy for some of the stuff i'm working on. Thanks alot.

Posted: Thu Dec 08, 2005 5:11 am
by Rai López
HI! Now that LM seem have resolved the SetSountrack issue, any new about the waited mixer? Now when I run the large PadSound version (that with all that marvelous lines of code) I get the folow error in LUA Console: sf PadSound.lua:114: attempt to call method 'SetSoundtrack' (a nil value) and is not possible to do with it nothing more than, as always (that is very good), Pad the Sound... Uf, and I'm SO intrigated about all this :roll: ..BYE! (and THANKS :))

Re: PadSound

Posted: Thu Dec 08, 2005 2:34 pm
by Rasheed
I have no comment on the script, but want to let you know about alternatives.

It is very feasable to edit sound outside Moho, e.g. in Audacity, a freeware application available for Win, Mac and Linux. Specialized sound applications offer more functionality than a Lua script could ever hope to do. Another very powerful (Mac-only) app for sculpting sound is Soundhack.

However, after some pondering on this, you have given me a good idea. For more precision, I could use Apple's very user-friendly Garageband, which has a built-in metronome. Using 180 bpm and a 4/4 measure, you have 8 frames per beat, or 1 frame per eighth beat. I'm sure there are comparable apps for Windows and Linux, although probably not as userfriendly as Garageband.

Music and animation are so compatible :D

And BTW, 7feet, you will be glad to read that Apple is switching to Intel processors, probably starting from January 2006. So, after everyone has swiched to the new IntelMacs, we will not have these bigendian/little-endian incompatibility issues between X86 and Motorolla's G4 or IBM's G5 anymore.

Posted: Fri Dec 09, 2005 12:10 am
by 7feet
Rasheed - Of course there are better solutions than I could put in a script (although I've already written most of the basic functions for mixing, eq's and filters, that sorta stuff), but that's not really what I was going for. In my view, a mixer inside of Moho would allow you to drop in various sounds, music, dialog, all that stuff, to use as a guide track to make you're proper soundtrack (with a function to output a dopesheet so you could rebuild it in a proper multitrack like Audacity. Being able to add sound elements, on the fly, inside of Moho while you are animating would be a Cool Thing. It doesn't have to be perfect. It just has to let you rough out a soundtrack so you can see how everything times out.

Even if traditionally animation soundtracks are recorded before any animation is actually done, I think that Moho lends itself to a bit more of an "improv" style of animating.

Ramón - the new shop I started at is in complete freakout mode with multiple huge jobs overdue and big money clients on the warpath, so I can't look at this until the weekend. But I'll figure it out, have no fear.

Posted: Fri Dec 09, 2005 11:55 am
by Rai López
...Thank you Rasheed, of couse I know about all that alternatives, and, of course too, I'll use one of they to edit my sounds propertly, but I always have been very interesed about can put some basic sounds in my Moho animations just where I want to can make changes (as 7feet sais) "on the fly" and have some control about timing and quick decissions... I'm talking about (i.e.) storyboarding or for make the "sketchs/roughs" of the fist idea to see and listen how it result and make some basic time adjustments if dislike... Of course, the details, effects, and complex mixings would be made in any other specialized app how is natural ;) ...Well, now --> :D :D :D 7feet! NO FEAR! But very happy instead :D ...GOOD LUCK with all that jobs and THANK YOU as if you get do it as if not! :) ...CIAO!

Posted: Fri Dec 09, 2005 12:37 pm
by Rasheed
Well, it would be nice if it was possible to script an external audio app from within Moho. That would solve a lot of the problems of synchronizing sound on the fly.

RealMacSoftware has an (Apple) scriptable audio editor for the Mac:
AudioExpress

But I'm sure other OSes have similar scriptable audio editors.

Alternatively, there are also scriptable audio players, that will allow you to create (and modify) a script when and how to play sounds. You can record sounds separately, script them to play at certain times and have Moho start the script with a Lua script. Once you have the final mix, you can record it externally and save it as a WAVE or AIFF file to use in Moho or a video editor.

There are a lot of ways to tackle this problem, it seems.

Posted: Fri Dec 09, 2005 11:40 pm
by 7feet
Ramón, and anybody else who cares - the SetSounstrack thing was a very minor syntax thing, the link at the top now points to the fixed update (v 1.01).

Posted: Sat Dec 10, 2005 11:17 am
by Rai López
...WHAT A QUICK GUY!!! Thank you very much! But only one thing... Well, I run the script and import my *.wav file where I want (that is FUNTASTIC! :D), then I can't do nothing more, so... what more things can I do with it? I mean, the script contains a lot of lines of code that must have some utility, isn't? How can I acces to this "hidden" features? PLEASE 7feet, tell us the trick! :D Or am I missing something...? Well, anyway THANKS again! :)

Posted: Sat Dec 10, 2005 12:14 pm
by ulrik
Thanks a lot 7feet for this update! :D

Posted: Sat Dec 10, 2005 1:07 pm
by 7feet
Ramón -

All that extra stuff is in there because I was going to use this as the base for the mixer. It's not doing anything right now. It was all stuff that was in the utility library I thought would be a good idea but that turned out to be to much of a pain, so I converted all the functions I would need for sound stuff and dropped it in there.

The first thing I'm gonna do is throw in an option to pad a particular file, and then mix it into the current soundtrack. Doesn't give you as many options as I'm planning on, but it will give you a set of files you can directly drop into a multitrack (the basic, unmodified soundtrack file plus all the padded files). That should work for the moment.

The way I plan to have it work in the end -
-- You can now (in 5.3) tell where the .moho file is on the computer, all of the audio files will be copied to the project directory (if they're not already there). I have functions for basic audio processing (normalize, volume, filters and EQs, pan) so if you use those an additional processed copy will be made.
-- Also in the project folder will be a text file that will will have a list of all the files used, what frame (or frames if the are used several times) they are at, and maybe they were processed in each instance. Since it would be a text file, I guess you could use this as your dopesheet for another mixer.
-- When you add, remove, or move/modify a sound, the script will recompute the whole mixed soundtrack file and assign that to the soundtrack. If there are lots and lots of files it might end up taking a few seconds to process, but that's the way it goes. But you should be able to make changes easily enough that, if you don't need to do tons of tweaking you might actually have a soundtrack you can use for the final project.

One thing I'm not really planning on is doing a lot of converting of sample rates and bit depth. Unless I find it personally necessary, it's gonna be pretty much 44.1 mHz stereo wave files. If the files are 44.1 mono, I'll do that conversion to stereo, but the code for most up/downsampling is often pretty hairy, and I just don't want to do it. So you would have to convert any other format audio files to this one (in another app) before you can use them. But that's pretty small potatoes.

Any other suggestions on what might be useful in it, or a way to work it, are welcome. Just don't get too nuts, there are only so many hours in the day.