Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!psuvax1!psuvm!dbngmd13!dmswwu1c!zvd007 From: ZVD007@DMSWWU1C.BITNET (Ulrich Kuehn) Newsgroups: comp.sys.atari.st.tech Subject: Re: How do you play Sound Samples ? Message-ID: <91122.134051ZVD007@DMSWWU1C.BITNET> Date: 2 May 91 13:18:49 GMT References: <1991May2.012642.26008@cs.cmu.edu> Lines: 28 Organisation: Westfaelische Wilhelms-Universitaet, Muenster, Germany In article <1991May2.012642.26008@cs.cmu.edu>, redmond+@cs.cmu.edu (Redmond English) says: > >How can I play digitised sound samples from a program ? I've >downloaded a number of *.SND samples, and a program that plays them, >but I'd like to load them into my program and play them myself. > >I can handle background tasks using interrupts, so I don't need >details of that, but what do I actually *do* with all those numbers ? > These soundfiles contain 8-bit-sampled sounds with 0 as the lowest an 255 as th e highest value. To play such a sound, you "only" have to use the internal soundship as a D/A-converter. To do so, set all the delay-values in the registe rs 0 to 5 of the soundship to 0 (the highest frequency it can play) an then turn it off (it has really to be off, otherwise there are interferences in the sound). Install then an interrupt-routine that gets every time it's called a byte from the soundfile (which hab been read somewhere into memory), then converts it with a table, because the soundship has only 4 levelcontrolbits per voice and it's not linear. You can get this table by analysing one off those soundplayers while playing a sound, they often use the timer-a-interrupt. There you can also see a playing routine. After converting, all you have to do, is put the 3 values for the 3 voices into the right registers ( I think it's 8 to 11) When using the DMA-sound of the STE, remember that these sounds range from -128 to 127 (signed), so you have to convert them before playing. U. Kuehn