palette/sndfilenet [ Classes ]
[ Top ] [ palette ] [ Classes ]
NAME
sndfile-palette File: sndfilenet.lsp Class Hierarchy: named-object -> linked-named-object -> sclist -> circular-sclist -> assoc-list -> recursive-assoc-list -> palette -> sndfile-palette -> sndfilenet Version: 1.0.10 Project: slippery chicken (algorithmic composition) Purpose: Implementation of the sndfilenet class which extends sndfile-palette to add functionality for loading and playing sounds within MaxMSP. Author: Michael Edwards: m@michael-edwards.org Creation date: 23rd October 2017, Essen $$ Last modified: 18:09:33 Sat Nov 18 2017 CET SVN ID: $Id$
sndfilenet/(setf next-sfe) [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DATE
October 21st 2017, Essen
DESCRIPTION
A setf :after method. Set the next-sfe slot to be a sndfile-ext object. If it is already, leave it as is. If it's an integer, assume it's a cue number and get the right object, otherwise get the object with this ID. If this is causing problems, use (setf (slot-value sfn 'next-sfe) ... ) If we're trying to set using a reference/id like '(group1 snd3) then it will have to be a two-element list.
SYNOPSIS
(defmethod (setf next-sfe) :after (value (sfn sndfilenet))
sndfilenet/analyse-followers [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DESCRIPTION
Using the followers slots of each sndfile in the palette, go through each sndfile in the palette and generate a large number of following sounds, i.e. emulate max-play. The results of the follow-on process are then analysed and a warning will be issued if any sndfile seems to dominate (defined as being present at least twice as many times as its 'fair share', where 'fair share' would mean an even spread for all the sound files in the palette).
ARGUMENTS
- The sndfilenet object.
OPTIONAL ARGUMENTS
- integer: How many times to repeat the generation process. Default = 1000. - T or NIL for verbose warnings: if T, the emulation list of sound files will be printed. Default NIL.
RETURN VALUE
T or NIL depending on whether the analysis detects an even spread or not.
SYNOPSIS
(defmethod analyse-followers ((sfn sndfilenet) &optional (depth 1000) verbose)
sndfilenet/auto-cue-nums [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DESCRIPTION
Set the cue-num slot of every sndfile-ext object in the palette to be an ascending integer starting at 2. NB If a sndfile has it's :use slot set to NIL it won't be given a cue number.
ARGUMENTS
- a sndfilenet object.
RETURN VALUE
The cue number of the last sndfile-ext object.
SYNOPSIS
(defmethod auto-cue-nums ((sfn sndfilenet))
sndfilenet/auto-followers [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DATE
October 20th 2017
DESCRIPTION
Automatically generate follower sound files for every sound file in the palette. These are a mixture of the other files in the same group plus one from another group, so that we'll move through.
ARGUMENTS
- a sndfilenet object
RETURN VALUE
T
SYNOPSIS
(defmethod auto-followers ((sfn sndfilenet))
sndfilenet/get-snd-with-cue-num [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DATE
December 21st 2012
DESCRIPTION
Return the (first, but generally unique) sndfile object which has the given cue-num slot.
ARGUMENTS
- the sndfilenet object. - the cue number (integer).
RETURN VALUE
The sndfile/sndfile-ext object with the given cue number or NIL if it can't be found.
SYNOPSIS
(defmethod get-snd-with-cue-num ((sfn sndfilenet) cue-num)
sndfilenet/make-sfn [ Functions ]
[ Top ] [ sndfilenet ] [ Functions ]
DESCRIPTION
Make a sndfilenet object. This object is a simple palette which checks to make sure that all of the sound files in a given list exist for each given ID. Sound files are given as as single names, without the path and without the extension. These can be given using the optional keyword arguments <paths> and <extensions>. NB Although this class is a palette and therefore a subclass of recursive-assoc-list, the sound lists in this case cannot be nested beyond a depth of two (as in example below).
ARGUMENTS
- An ID for the palette. - A list of lists that contains IDs for the names of one or more groups of sound files, each paired with a list of one or more names of existing sound files. The sound file names themselves can be paired with keywords from the sndfile class, such as :start, :end, and :frequency, to define and describe segments of a given sound file.
OPTIONAL ARGUMENTS
keyword arguments: - :paths. A list of one or more paths to where the sound files are located. - :extensions. A list of one or more sound file extensions for the specified sound files. The default initialization for this slot of the sndfilenet already contains ("wav" "aiff" "aif" "snd"), so this argument can often be left unspecified. - :warn-not-found. T or NIL to indicate whether a warning should be printed to the Lisp listener if the specified sound file cannot be found. T = print warning. Default = T.
RETURN VALUE
Returns NIL.
EXAMPLE
;;; NB won't work unless you change /path/to/ below (let ((msfn (make-sfn 'sfn-test '((sndfile-group-1 (test-sndfile-1)) (sndfile-group-2 (test-sndfile-2 test-sndfile-3 (test-sndfile-4 :frequency 261.61))) (sndfile-group-3 ((test-sndfile-5 :start 0.006 :end 0.182) test-sndfile-6))) :paths '("/path/to/sound-files-dir-1/" "/path/to/sound-files-dir-2/")))))
SYNOPSIS
(defun make-sfn (id sfn &key paths (extensions '("wav" "aiff" "aif" "snd")) auto-freq with-followers (warn-not-found t))
sndfilenet/max-play [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DESCRIPTION
This generates the data necessary to play the next sound in the current sound's followers list. See the sndfile-ext method for details.
ARGUMENTS
- The sndfilenet object. - The fade (in/out) duration in seconds. - The maximum loop duration in seconds. - The time to trigger the next file, as a percentage of the current sndfile-ext's duration.
OPTIONAL ARGUMENTS
- whether to print data to the listener as it is generated. Default = NIL.
RETURN VALUE
A list of values returned by the sndfile-ext method.
SYNOPSIS
(defmethod max-play ((sfn sndfilenet) fade-dur max-loop start-next &optional print)
sndfilenet/osc-send-cue-nums [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DESCRIPTION
Send via OSC the cue number of each sound file in a form that a Max sflist~ can process and store (which will include the path and start/stop data: see sndfile-ext::max-cue for details). E.g. preload 231 triplet-mphonic-001.wav 0. 3300.612305 0 1. Note that the individual preload data is sent by this method explicitly over the UDP network. This means you'll need a [udpreceive] somewhere in the max patch to catch these and that [osc-sc-eval] won't send these out of its outlet, rather the number of cues will be output there. Also note that the usual IDs prepended to results from osc-eval are not included in the preload sent over UDP so a separate parser looking for this data will be needed, e.g. [udpreceive 8091][fromsymbol][route preload][prepend preload][sflist~ mysfl]
ARGUMENTS
- the sndfilenet object.
RETURN VALUE
The number of cue numbers sent. NB This is not the same as the last cue number as cues start from 2.
SYNOPSIS
#+(and darwin sbcl) (defmethod osc-send-cue-nums ((sfn sndfilenet))
sndfilenet/reset [ Methods ]
[ Top ] [ sndfilenet ] [ Methods ]
DESCRIPTION
Reset the followers' slot circular list to the beginning or to <where>
ARGUMENTS
- the sndfilenet object.
OPTIONAL ARGUMENTS
- an integer to set the point at which to restart. This can be higher than the number of followers as it will wrap. Default = nil (which equates to 0 lower down in the class hierarchy). - whether to issue a warning if <where> is greater than the number of followers (i.e. that wrapping will occur). Default = T.
RETURN VALUE
T
SYNOPSIS
(defmethod reset ((sfn sndfilenet) &optional where (warn t))