December 3, 2004, 12:00 am
SFP : Sound File Player -- A Decorator pattern sound file editing system (for sc2)
/code/SC/SFP.sea.hqx
simplest usage:
SFP(":SoundFiles:pathname").play
every SFP object supports the .ar(startTime,endTime) message.
* _SFPPlayer_(path) has an actual concrete SoundFile.
other SFP objects play the SFP 'beneath' them and respond to objects on 'top' of them in a transparent manner.
so a SFPSkip object skips its section as though the section was never there, and acts identical to an SFP or any other AbstractSFP subclass.
an SFPLoop can be layered on top of that, and loops as though the sound file had been edited and the skipped section never existed.
* _SFPLoop_(sfp,start,end,repeats)
loops over the section
* _SFPRepeats_ -
play till section, repeat the section n times, play till end of file ( will upload soon )
* _SFPSkip_(sfp,start,end)
skips the section
* _SFPClip_(sfp,start,end,fadein,fadeout,curvein,curveout )
plays only this section, with the given fade and curve settings
* _SFPfunc_(sfp,function)
plays the file through a function. this works especially well
with Patch (sorry, coming soon), which enables complex paramater definitions to be stored to disk.
* _SFPSeq_(listOfSFPs)
plays each of the SFPs in sucession. see also Pattern support below.
skipped= SFPSkip(
SFPPlayer(":sounds:long_track.aiff"),
start,end);
looped = SFPLoop(skipped,loopstart,loopend);
tweaked = SFPFunc(looped,tweakFunction);
{
// play it from the start
tweaked.ar
}.play
or
tweaked.play(10,30); // play seconds 10 to 30
or
SFPClip.new(
SFPSkip.new(
SFPSkip.new(
SFPPlayer.new(
"HD:Desktop Folder:album:lust.3 idr",
96
),
1.03645e+06,
2.97296e+06
),
2.21946e+06,
2.64668e+06
),
26460,
1.07604e+07,
0.2,
2,
-4,
-4
)
many more are possible... if you build one, let me have it. that's the rule.
ideas:
* effect on just a specified area, (cross) fade in and fade out.
* play one SFP, then crossfade to another during the selected area.
* vari-speed playback
* SFPSilence
* random crossfades over a section
* SFPReplace - replace the section with another sound file
* SFPEfx - add efx during section
* SFPFade - fade up to start, fade down from end
* SFPDip - dip levels during section
* SFPExposeSection - play the section only, otherwise silent
* SFPPlayAt - play the underlying at the section
* SFPSpawner - select sections and launch multiples
* SFPScramble - random overlaps over underlying
* SFPLoopTransport - trig on key stroke
GUI
send the .topGui message to your top level SFP object, a FlowLayout will be created and everything put up on the gui.
eventually i will put in a system to hide/expose the guiBody.
I am working with files that have 8 or 9 layers on them, and that stretches to two pages.
(FlowLayout creates new pages when you overflow).
the SFP objects each have a guiClass method that returns its appropriate gui class.
.topGui, .gui and .smallGui can still be sent to the SFP itself, and it will instantiate a guiClass and send the message on to that.
Pattern support
All SFP objects can be placed in patterns!
Prand([
skipped,looped,tweaked
],inf)
each object returns an event that lasts for its duration
also included is SFPSeq(listOfSFPs) which allows sublocating within the list of snd files.
Convienience
Even when not layering or editing, just using SFP to play sound files is very convienient.
SFP(pathName).ar
Rgds!