SFPlayer:
Filter:
Classes (extension) | UGens > InOut | UGens > Buffer

SFPlayer : Object
ExtensionExtension

A soundfile player
Source: SFPlayer.sc

Description

SFPlayer plays sound files directly from disk. It also has a convenient -gui.

The most common use is: SFPlayer.new.gui or SFPlayer.new("/path/to/soundfile").gui. See examples below.

Class Methods

SFPlayer.new(path, outbus, server, skin, autoShowOpenDialog: true, autoBootServer: true, autoSetSampleRate: true, autoSetOutputChannels: true)

Arguments:

path

The path to a soundfile. Can be nil for choosing the file later.

outbus

The bus to output to. Defaults to 0 (the first physical output).

server

The server to use. If nil, Server.default will be used.

skin

Optionally an instance of SFPlayerSkin, controlling the color scheme of the GUI when shown.

autoShowOpenDialog

If true and no path is specified, an Open Dialog will be shown upon creating new instance to choose the file.

autoBootServer

If true and the server is not running, it will be booted automatically.

autoSetSampleRate

If true and the server is booted automatically, its sampleRate will be set to the file's sampleRate.

autoSetOutputChannels

If true and the number of channels in the file exceeds server's number of output channels, as well as the server is booted automatically, its number of output channels will be increased to match the number of channels in the soundfile.

Inherited class methods

Instance Methods

.gui(argBounds, doneAction, onCloseAction, parent)

Show a GUI of the SFPlayer. This creates an instance of SFPlayerView, stored under -view.

Arguments:

argBounds

Bounds of the gui. If nil, a default size will be used.

doneAction

Action to be performed after opening the gui and loading the soundfile into the SoundFileView.

onCloseAction

Action to be performed after closing the gui.

parent

Optionally a parent view to embed this SFPlayerView in.

Returns:

this SFPlayer (not the SFPlayerView)

.play(bufsize, addAction, target, rate)

Play the file from the current position;

.stop(updateStart: true)

Stop playing. startTime is left at the original value;

Arguments:

updateStart

If true, the cursor in the GUI and other dependants will be reset to the previous start postion.

.pause

Stop playing. startTime is updated to the current playback position.

NOTE: If pause is called when the player is stopped, it will preload the playback buffer and wait for the start of playback. This allows starting playback without additional delay on slower storage or when multiple players are synchronized together

.reset

Updates the player to the initial state (resets playback position, amp, etc.)

.view

Returns:

If the gui was created, this returns an instance of the SFPlayerView.

Synchronizing multiple players

It is possible to link multiple players together and have them start playback at the same time.

Inherited instance methods

Undocumented instance methods

.addAction

.addAction = val

.addCue(key, time, sort: true, redraw: true)

.amp

.amp_(newAmp, source)

.attRelTime

.autoBootServer

.autoBootServer = value

.autoSetOutputChannels

.autoSetOutputChannels = value

.autoSetSampleRate

.autoSetSampleRate = value

.autoShowOpenDialog

.buffer

.bufferPreloaded

.bufsize

.bufsize = val

.buildSD

.close

.cues

.curSynth

.curTime

.duplicateSingleChannel

.duplicateSingleChannel = value

.followAddAction

.followAddAction = value

.followAmp

.followAmp = value

.followOutbus

.followOutbus = value

.followPlayStopPause

.followPlayStopPause = value

.followRate

.followRate = value

.followStartTime

.followStartTime = value

.followTarget

.followTarget = value

.free

.freeBuffer(when)

.initSFPlayer(argSkin)

.isPaused

.isPlaying

.isStarting

.isStopping

.load(pathArg)

.loadBuffer(sTime: 0, completionMessage)

.loadCues(path)

.multiplyBufsizeByNumChannels

.multiplyBufsizeByNumChannels = value

.offset = newOffset

.outbus

.outbus_(newOut, updateMenu: true)

.path

.path = pathArg

.pausePlay

.playFromCue(key, idx)

.playPaused

.rate

.rate = val

.removeCue(key, sort: true, redraw: true)

.runSetup

.saveCues(path)

.server

.setCues(newCues, forSure: false)

.sf

.skin

.sortCues

.startTime

.startTime = newStartTime

.switchTargetWhilePlaying

.switchTargetWhilePlaying = value

.synthName

.target

.target = val

.update(who, what ... args)

Examples