10. Contents 2 -------- 3 4 1. VM options relating to sound 5 2. Configuring sound support in Squeak 6 3. Sound system-specific notes 7 3.1. Open Sound System 8 3.1.1 Possible Problems with OSS 9 3.2. Network Audio System 10 3.3. SunOS/Solaris 11 4. The future of Squeak sound on Unix 12 13 141. VM options relating to sound 15 ---------------------------- 16 17Squeak includes primitives to modify the recording and playback 18levels. These primitives are sometimes invoked automatically on your 19behalf by "helpful" code in the image. (E.g., the recording level is 20set to 50% whenever the SoundRecorder is started.) Many people 21(including myself) find this to be totally unnacceptable behaviour; 22mixer settings are the responsibility of an (external) mixer program 23and Squeak has no business whatsoever fiddling with them. 24 25If the VM is started with the option `-nomixer' (or if the variable 26SQUEAK_NOMIXER is set in the environment) then the primitives which 27write mixer levels are disabled. (The image will think they succeed 28but in fact they do nothing at all.) 29 30 312. Configuring sound support in Squeak 32 ----------------------------------- 33 34The `configure' script should figure out which sound support to use 35(if any) all by itself. It looks for sound support in this order: 36 37 Open Sound System (or Linux native sound) 38 SunOS/Solaris 39 Network Audio System 40 41and chooses the first one it finds. If it doesn't find any of the 42above then the VM will still compile but sound support will be 43disabled. 44 45If you have more than one kind of sound support on your system (Sparc 46systems might have all three installed) then you can specify which one 47to use explicitly, like this: 48 49 .../configure --with-audio=oss 50or .../configure --with-audio=sun 51or .../configure --with-audio=nas 52or .../configure --with-audio=none 53 54The default (not shown in the above list) is `auto' which means: "use 55the first of the above sound systems that appears to be available". 56Specifying `none' turns off sound support in the VM even if it is 57available. 58 59If you explicitly choose the desired sound support this way but 60`configure' cannot find the necessary header files then sound support 61will be disabled totally (i.e., `configure' isn't about to hassle 62itself with hunting for alternatives when the particular support you 63asked for is unavailable). 64 65 663. Sound system-specific notes 67 --------------------------- 68 69Below are some notes on the different sound systems supported in 70Unix Squeak. 71 723.1. Open Sound System 73 74Full support for playback and recording is implemented and should work 75perfectly. Full-duplex (simultaneous recording and playback) should 76work on devices that support it. (You'll need to change 77`canRecordWhilePlaying' in the image preferences, and then fix all the 78bugs in the SoundPlayer and SoundRecorder which effectively prevent 79the latter from ever starting up when the former is active.) 80 81Note that OSS is available in three flavours: 82 83 1. Linux native sound drivers (bundled with the kernel). Many of 84 these are hopelessly broken. I've had bad experiences on both 85 PowerMac (awacs chip) and stock PC hardware (using the NM256 codec 86 and AC97 mixer chips). Whether the OSS support works for you 87 largely depends on how well your particular sound drivers are 88 implemented. 89 90 2. Commercial version (http://www.opensound.com). I've no idea how 91 well these work. (I refuse to pay for software of any kind.) 92 Experience reports (either good or bad) would be appreciated. 93 94 3. The snd-pcm-oss compatibility module in the ALSA (Advanced Linux 95 Sound Architecture) drivers (http://www.alsa-project.org). Squeak 96 sound works flawlessly with this driver. (This isn't surprising: 97 after 10 days of total failure to make the Linux native OSS support 98 work I installed ALSA and finished the work using snd-pcm-oss.) If 99 you experience any problems at all with either the Linux native 100 sound or commercial OSS then you are strongly encouraged to switch 101 to ALSA instead. 102 103You might also consider turning on `soundStopWhenDone' in the image 104preferences since this will make Squeak much friendlier towards any 105other sound applications or daemons that might want to make noises 106from time to time and which would otherwise find /dev/dsp to be 107unavailable after Squeak has played its first sound. 108 1093.1.1 Possible Problems with OSS 110 111Ned Konz discovered that it's sometimes necessary to tell Linux (using 112ALSA and OSS compatibility modules) that Squeak wants to open the 113sound device in non-blocking mode. If sound output in Squeak seems to 114be playing things ``on top of themselves'' then you might want to try 115the following (or something similar) as root to see if it cures the 116problem: 117 118 # echo "squeak 0 0 block" > /proc/asound/card0/pcm0p/oss 119 1203.2. Network Audio System 121 122Support for playback and recording is implemented. Playback should 123work perfectly but I've had some problems making recording work. 124(I've had trouvle with the NAS utility `aurecord' too, so the fault is 125not necessarily with Squeak.) 126 127The latest source for the NAS daemon and utilites can be found at: 128http://www.radscan.com/nas.html. (You'll have to compile it for 129yourself.) 130 131Note that NAS is broken on big-endian Linux machines. I've patched 132the daemon to fix this. If you want the patches, send me email 133(mailto:ian.piumarta@squeakland.org). 134 1353.3. SunOS/Solaris 136 137The support hasn't been tested in ages. I haven't a clue if it still 138works. 139 140 1414. The future of Squeak sound on Unix 142 ---------------------------------- 143 144Direct support for the ALSA drivers is on the TO-DO list. 145 146Plans are afoot to add "modules" to the Unix VM. This will make many 147configure-time options (such as sound support, window support, etc.) 148irrelevant. Instead `configure' will figure out what's available, 149compile support for everything into separate modules, and then leave 150you to pick which one(s) you want to use at run time. 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230The remainder of this file isn't for reading. It's here in case you 231have problems with OSS support. Turn on `#define DEBUG' near the top 232of `sqUnixSoundOSS.c' and recompile. In the "more about music" 233project you can record and then playback a sound and the OSS code will 234tell you what it's doing, which should be something like the 235following. 236 237[piumarta@emilia current]$ date 238Mon May 27 20:34:52 CEST 2002 239[piumarta@emilia current]$ bld/squeak Squeak3.1c-4478 240sound: stop 241sound: start recording 242sound: /dev/dsp: opened with mode 0 243sound: /dev/dsp: driver formats (1f9): MU_LAW U8 S16_LE S16_BE S8 U16_LE U16_BE 244sound: /dev/dsp: driver capabilities (3201): REALTIME TRIGGER MMAP 245sound: /dev/dsp: trying format 20: S16_BE 246sound: /dev/dsp: selected driver format 20: S16_BE 247sound: /dev/dsp: requesting 1 channels 248sound: /dev/dsp: using 1 channels 249sound: /dev/dsp: driver: 2 bytes/frame 250sound: /dev/dsp: squeak: 2 bytes/frame 251sound: /dev/dsp: 11025 samples/sec 252sound: /dev/dsp: fragment size set to 2048 (1102 frames requested in 1 channels) 253sound: input conversion: none (0x10016af4) 254sound: output conversion: none (0x10015cb0) 255sound: /dev/dsp: aio enabled, semaphore 2 256sound: /dev/mixer: opened with mode 2 257sound: /dev/mixer: available devices: vol speaker line mic cd igain 258sound: /dev/mixer: rec: device not available 259sound: /dev/mixer: igain: level set to 50% + 50% 260sound: stop recording 261sound: /dev/dsp: aio disabled 262sound: /dev/dsp: device closed 263sound: stop recording 264sound: stop recording 265sound: stop 266sound: start 267sound: /dev/dsp1: No such file or directory 268sound: /dev/dsp: opened with mode 1 269sound: /dev/dsp: driver formats (1f9): MU_LAW U8 S16_LE S16_BE S8 U16_LE U16_BE 270sound: /dev/dsp: driver capabilities (3201): REALTIME TRIGGER MMAP 271sound: /dev/dsp: trying format 20: S16_BE 272sound: /dev/dsp: selected driver format 20: S16_BE 273sound: /dev/dsp: requesting 2 channels 274sound: /dev/dsp: using 2 channels 275sound: /dev/dsp: driver: 4 bytes/frame 276sound: /dev/dsp: squeak: 4 bytes/frame 277sound: /dev/dsp: 22050 samples/sec 278sound: /dev/dsp: fragment size set to 8192 (2644 frames requested in 2 channels) 279sound: input conversion: none (0x10016af4) 280sound: output conversion: none (0x10015cb0) 281sound: /dev/dsp: aio enabled, semaphore 2 282sound: stop 283sound: /dev/dsp: aio disabled 284sound: /dev/dsp: device closed 285sound: stop 286[piumarta@emilia current]$ 287