Snd's Initialization File
Snd can be customized and extended; see
here. There is an initialization file,
called "
". This is an optional file containing any
customizations or extensions that need to be loaded whenever Snd
starts.
An example of a "
" init file with customization an
extensions could be something like:
(more below : ยง9.13.9)
;; options:
;; ========
(set! *load-path* (cons "." (cons "/usr/lib64/snd/scheme" *load-path*))) ;; Snd's scheme path
(set! (window-width) 600) ;these set the initial window size
(set! (window-height) 400)
(set! (window-x) 160)
(set! (window-y) 0)
(if (provided? 'snd-motif) ;Motif and Gtk use different font naming conventions
(begin
(set! *listener-font* "9x15")
(set! *axis-label-font* "-*-times-medium-r-normal-*-18-*-*-*-*-*-*-*")
(set! *axis-numbers-font* "9x15"))
(begin
(set! *listener-font* "Sans 10")
(set! *axis-label-font* "Times Medium 14")
(set! *axis-numbers-font* "Sans 10")))
(set! *listener-prompt* "> ") ;change listener prompt from the default ">" to ":"
;; (set! (show-listener) #t) ;include the listener window initially
(define beige (make-color 0.96 0.96 0.86))
(define blue (make-color 0 0 1))
(set! *selected-graph-color* beige) ;selected graph background is beige
(set! *selected-data-color* blue) ;selected graph data is blue
(set! *save-dir* "/zap/") ;save-state files are placed in /zap/snd
(set! *temp-dir* "/zap/") ;temp files are placed in /zap/tmp
;;; (set! *peak-env-dir* "/zap")
;; load extensions:
;; ================
;; (if (not (provided? 'snd-extensions.scm)) (load "extensions.scm"))
(if (not (provided? 'snd-selection.scm)) (load "selection.scm"))
;; (if (not (provided? 'snd-hooks.scm)) (load "hooks.scm"))
(load "hooks.scm")
(load "extensions.scm")
(load "dsp.scm")
hook-push after-open-hook ;if sound has many chans, use just one pane for all
(lambda (hook)
(let ((snd (hook 'snd)))
(if (> (channels snd) 4)
(set! (channel-style snd) channels-combined)))))
;;
;; customization:
;; ==============
;;
;; (set! (show-controls) #t)
(set! *with-inset-graph* #t) ;display an overview of the current window in the upper right
(set! *with-pointer-focus* #t) ;automatically focus on (activate) the widget under the mouse
(set! *selection-creates-region* #f) ;turn off automatic region creation
;; (set! (enved-clip?) #t)
;; (set! (enved-wave?) #t)
(set! *show-y-zero* #t)
;;
;;;; bound keys: these keys use the meta-key combination.
;;
(bind-key "End" 0
(lambda()
"view full sound"
(set! (x-bounds) (list 0.0 (/ (framples) (srate))))))
;;
(bind-key #\r 0
(lambda()
"update sound"
(update-sound)
keyboard-no-action))
;;
(bind-key #\c 0
(lambda()
"appply controls"
(apply-controls)
keyboard-no-action))
;;
(bind-key #\n 0
(lambda()
"scale to normalize to 0.8"
(scale-to 0.8)
keyboard-no-action))
;;
(bind-key #\w 0
(lambda()
"save sound as wav-riff file"
(save-sound-as "test.wav" :sample-type mus-lshort :header-type mus-riff)
;; (scale-to 0.8)
keyboard-no-action))
;;
(bind-key #\v 0
(lambda()
"save sound as wav-riff file 32 bits little endian"
(save-sound-as "new.wav" :sample-type mus-lint :header-type mus-riff)
;; (scale-to 0.8)
keyboard-no-action))
;;
(bind-key #\u 0
(lambda()
"up scale sample rate and save sound as wav-riff file"
(src-sound (/ 48000 44100) 5)
(save-sound-as "upsrc.wav" :srate 48000 :sample-type mus-bfloat :header-type mus-riff)
keyboard-no-action))
|
|
If you dig into this file, there are three sections namely, options,
extensions, and customization. Try to focus on the comments on the
lines and options and extensions are self explanatory. However, the
bound keys below customization deserve some explanation. Almost any
function or any aspect on Snd can be customized. Here we are assigning
keys to Snd functions, they work just like Emacs key bindings but in
this case, they only use the meta-key combination. Below some
descriptions to the assigned bind-key combinations:
- meta-end :: view entire waverform of sound on screen
- meta-r :: update changes to soundfile
- meta-c :: apply manipulation on controls to soundfile
- meta-n :: normalize or scaled entire amplitude to 0.8
- meta-w :: save sound as a “WAV” (riff) soundfile.
- meta-v :: save sound as a 32 bits little endian “WAV” (riff) soundfile
- meta-u :: up-scale sample rate and save sound as wav-riff file
Tons of other functions on Snd can be customized to particular needs
this way. Start from HERE.
© Copyright 2001-2022 CCRMA, Stanford University. All rights reserved.
Created and Mantained by Juan Reyes