Soundfiler will display the contents of a sound file, or a function table containing a sound file (GEN01 tables). This is a fast waveform viewer that allows users to select regions of the waveform. Unlike the table widget, soundfiler can only display one waveform at a time.

soundfiler channel("start", "length"), file("filename"), scrubberposition(val), tablenumber(val), zoom(val), active(val), alpha(val), bounds(x, y, width, height), colour("colour"), identchannel("channel"), rotate(radians, pivotx, pivoty), visible(val), tofront(), widgetarray("chan", number),

Specific Identifiers

channel("start", "length") The soundfiler widget takes two channel parameters which relate to the currently selected region. The first channel will provide the starting position, in samples, of the selected region. The second channel will be the total length of the selected audio in samples.

file("filename") Sets a file for the table to display. Unlike the tablenumber() identifier, which depends on the existence of a valid function table, file() will simply display a file from disk. This can be useful if you are using one of Csound's file reading opcodes. If a full file path is not given, file() will search in the current directory, i.e., the directory that contains the csd file that is open. It is best to keep all files in the same directory as your csd file, but if you wish to keep them in a sperate folder you can pass a full path to the file() identifier.

scrubberposition(val) Sets the scrubber position where val is an integer value in samples, or steps if dealing with a stringsequencer widget. If you wish to update the scrubberposition in real time use an identchannel identifier.

tablenumber(val) Sets the table/tables to be displayed. If multiple tables are specified the tables will be superimposed on top of each other. If multiple tables are specified with a colon between then the tables will be stacked on top of each other along the Y-axis, e.g., tablenumber(1:2:3:4).

zoom(val) Sets the initial zoom value. Passing a -1 to zoom will cause the zoom buttons to disappear.

Common Identifiers

active(val) Will deactivate a control if 0 is passed. Controls which are deactivate can still be updated from Csound.

alpha(val) A value between 0 and 1 will set the alpha blend value for the entire component. Can be useful if you need to fade widgets in and out.

bounds(x, y, width, height) integer values that set position and size on screen(in pixels).

colour("colour") This sets the main colour. Any CSS or HTML colour string can be passed to this identifier. The colour identifier can also be passed an RBG, or RGBA value. All channel values must be between 0 and 255. For instance colour(0, 0, 255) will create a blue, while colour(0, 255, 0, 255) will create a green with an alpha channel set to full.

identchannel("channel") Sets the channel which data is sent and retrieved from Csound. When used with a chnset opcode users can override widget attributes. See Identifier channels

rotate(radians, pivotx, pivoty) Rotates the widget by a number of radians(2xPI=full rotation). pivotx and pivoty will determine the rotation pivot points, where 0, 0 represents the component's top-left position.

visible(val) A value of 0 will cause the widget to become invisible. Widgets have their visibility set to 1 by default.

tofront() Brings a widget to the front of the z order. This identifier takses no arguments and is only intended for use with identifier channels.

widgetarray("chan", number) Creates a number of widgets in a single pass. See Widget arrays


form size(400, 500), caption("Soundfiler"), size(400, 300), colour(220, 220, 220), pluginID("def1")
soundfiler bounds(10,10, 380, 200), identchannel("soundfilerIdent")
filebutton bounds(10, 215, 100, 30), channel("openFile"), text("Browse")
-n -d -+rtmidi=NULL -M0 -m0d --displays
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

seed 0 

;basic usage
instr 1
    SFile chnget "openFile"
    if changed(SFile) == 1 then
        SIdentString sprintfk "file(\"%s\")", SFile
        chnset SIdentString, "soundfilerIdent"

;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 z