File: xwavr

package info (click to toggle)
wavtools 1.3.1-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 196 kB
  • ctags: 92
  • sloc: ansic: 398; makefile: 103; tcl: 72; sh: 20
file content (110 lines) | stat: -rwxr-xr-x 3,331 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/wish
# the next line restarts using wish \
#
#exec wish "$0" "$@"    

set font -*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*
set rate 44100
set channels 2
set depth 16
set length 10
set filename "out.wav"

tk_setPalette snow3

wm title . "XWaveTools"
wm iconname . "xwavtools"



#---- Start GUI -------

#--- File ops
frame .filename -bd 2 -relief raised
pack .filename
entry .filename.data -relief sunken -width 40
label .filename.lab -text "FileName"
pack .filename.lab -side left
pack .filename.data -side right

frame .filelength -bd 2 -relief raised
pack .filelength
entry .filelength.data -relief sunken -width 14
label .filelength.lab -text "Duration (secs)"
pack .filelength.lab -side left
pack .filelength.data -side right
pack .filename .filelength -side top -fill x

.filename.data insert 0 $filename
.filelength.data insert 0 $length


#--- bottom buttons
frame .buttons -borderwidth 2
pack .buttons -side bottom -fill x -pady 2m
button .buttons.rec		-text "Record Sample"	-command startRecording
button .buttons.play	-text "Play Sample"		-command startPlaying
button .buttons.stop	-text "Stop"			-command stopRecPlay
button .buttons.set		-text "Set Mixer"		-command setXmix
button .buttons.cancel	-text "Exit"			-command "exit"
pack .buttons.rec .buttons.play .buttons.stop .buttons.set .buttons.cancel -side left -expand 1


#--- Channels ops
frame .rad1 -borderwidth 2 -relief raised
pack .rad1 -side left -fill y -pady 1m
label .rad1.channels   -text "Channels" -relief raised
radiobutton .rad1.mono -text "Mono" -variable channels -relief flat -value 1
radiobutton .rad1.stereo -text "Stereo" -variable channels -relief flat -value 2
pack .rad1.channels .rad1.mono .rad1.stereo -side top

#--- Depth ops
frame .rad2 -borderwidth 2 -relief raised
pack .rad2 -side left -fill y -pady 1m
label .rad2.depth   -text "Sampling Size" -relief raised
radiobutton .rad2.8bit -text "8bit" -variable depth -relief flat -value 8
radiobutton .rad2.16bit -text "16bit" -variable depth -relief flat -value 16
pack .rad2.depth .rad2.8bit .rad2.16bit -side top

#--- Sample Rate
frame .rad3 -borderwidth 2 -relief raised
pack .rad3 -side left -fill y -pady 1m
label .rad3.rate   -text "Sampling Rate" -relief raised
radiobutton .rad3.r1 -text " 8 khz" -variable rate -relief flat -value 8000
radiobutton .rad3.r2 -text "11 khz" -variable rate -relief flat -value 11025
radiobutton .rad3.r3 -text "15 khz" -variable rate -relief flat -value 15884
radiobutton .rad3.r4 -text "22 khz" -variable rate -relief flat -value 22050
radiobutton .rad3.r5 -text "32 khz" -variable rate -relief flat -value 32494
radiobutton .rad3.r6 -text "44 khz" -variable rate -relief flat -value 44100
pack .rad3.rate .rad3.r1 .rad3.r2 .rad3.r3 .rad3.r4 .rad3.r5 .rad3.r6 -side top -pady 1 -anchor w

pack .rad1 .rad2 .rad3 -side left -expand yes  -pady .1c -padx .1c 




# ------------------------------------
proc setXmix args {
	exec xmix
}

proc startRecording args {
	global filename depth channels rate length

    set filename [.filename.data get]    
    set length [.filelength.data get]    
	exec wavr -f $filename -r $rate -c $channels -d $depth -l $length
}

proc startPlaying args {
	global filename depth channels rate length

	exec wavp $filename
}

proc stopRecPlay args {

	exec "killall -9 wavr"
	exec "killall -9 wavp"
}