First Spear Posted March 5, 2015 Share Posted March 5, 2015 (edited) Can anyone using IntyBASIC share successful techniques to make sound? I can make dinky tones as shown in the example code, but there appears to be a large gap between that and the sound of an arrow firing and subsequently vaporizing a monster in Cloudy Mountain. ' Sound experiment program Mode 1 #contTemp = 9 #freqCurrent = 370 #wasPlayed = 0 loop: 'Is this the most performant way to read the controller? Wait If CONT1.BUTTON Then Sound 2,,0 : Wait #contTemp = CONT1.KEY Wait If #contTemp = 12 Then Gosub ContDirectionHandle If #contTemp < 12 Then Gosub ContKeypadHandle If #wasPlayed = 0 Then GoSub PlayNow Goto loop ContKeypadHandle: Procedure If #contTemp = 0 Then #freqCurrent = 220 : #wasPlayed = 0 If #contTemp = 1 Then #freqCurrent = 233 : #wasPlayed = 0 If #contTemp = 2 Then #freqCurrent = 246 : #wasPlayed = 0 If #contTemp = 3 Then #freqCurrent = 261 : #wasPlayed = 0 If #contTemp = 4 Then #freqCurrent = 277 : #wasPlayed = 0 If #contTemp = 5 Then #freqCurrent = 293 : #wasPlayed = 0 If #contTemp = 6 Then #freqCurrent = 311 : #wasPlayed = 0 If #contTemp = 7 Then #freqCurrent = 329 : #wasPlayed = 0 If #contTemp = 8 Then #freqCurrent = 349 : #wasPlayed = 0 If #contTemp = 9 Then #freqCurrent = 370 : #wasPlayed = 0 If #contTemp = 10 Then #freqCurrent = 392 : #wasPlayed = 0 If #contTemp = 11 Then #freqCurrent = 415 : #wasPlayed = 0 Print At 1 Color 11 , <6>#contTemp Print At 21 Color 5 , "000000" Wait End ContDirectionHandle: Procedure If Cont1.Up > 0 Then #freqCurrent = #freqCurrent + 1 : #wasPlayed = 0 If Cont1.Down > 0 Then #freqCurrent = #freqCurrent -1 : #wasPlayed = 0 Print At 1 Color 11 , "000000" Print At 21 Color 5 , <6>#contTemp Wait End PlayNow: Procedure Sound 2 , #freqCurrent , 12 For #spinWait = 0 to 15 Wait Next #spinWait Print At 41 Color 7 , <6>#freqCurrent Sound 2,,0 #wasPlayed = 1 End I found what I think is a workable note/frequency table at http://www.armory.com/~rstevew/Public/SoundSynth/Novelty/AY3-8910/start.html Thanks. Edited March 5, 2015 by First Spear Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/ Share on other sites More sharing options...
Kiwi Posted March 5, 2015 Share Posted March 5, 2015 There's several ways you can do sounds. You can use a pointer to data to do more complex sounds. Anyway, there's several ways that I did to do sounds.For sound channel 0, I load the data from the pointer and play back the sound in RAM. Then set sound length data. So when's that is 0 then sound is shut off. The restore and read was used for loading the level strip. So in future reference, I should have done a=shoot(SL):sound 0,a,15. Channel 1 is enemy destroy sound effect and noise channel. It runs until the volume, V is 0.Channel 2 is the shield down, power up, and stage end sound. There's 3 of them, so when S=0 then the sound is shut offHere are the source. if SL<>0 then SOUND 0,#sounddata(SL),10:SL=SL-1 if SL=0 then SOUND 0,0,0 IF S=0 then SOUND 2,0,0 if V4=0 then V4=0:SOUND 1,0,0 if V4<>0 then SOUND 1,700+W,V4:W=W+25:if W=150 then W=0:V4=V4-1 IF S=2 then SOUND 2,#S,V3:#S=#S+40: if #S>940 then V3=0:S=0 IF S=1 then SOUND 2,#S,V3:#S=#S-20: if #S<140 then V3=0:S=0 IF S=3 then SOUND 2,#S,V3:#S=#S-130: if #S<140 then V3=V3-1:#S=1000:if V3=0 then S=0 GetSound:procedure for c=0 to SL read #SOUND #sounddata(c)=#SOUND next c return end shoot: data 900,900,800,500,300,150,120,100,900,500,100 shoot2: data 200,200,210,210,220,220,230,230 shoot3: data 800,800,800,800,800,700,700,500,400,350,300,200,300,200,300,200 shoot4: data 100,200,300,100,200,300,400,100,200,300,400,500 shoot5: data 400,500,600,400,500,600,700,400,500,600,700,800 hitobject: data 400,300,200,100 2 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191578 Share on other sites More sharing options...
+nanochess Posted March 5, 2015 Share Posted March 5, 2015 The usual freq = freq + 10 or -10 or same value sounds pretty awkward. Let me share some tricks for sound: freq = freq + (freq / 16) ' Kind of exponential sound, you should limit to a time freq = freq - (freq / 16) ' Experiment with different division values for slower/faster movement. freq = freq / 2 ' Useful for laser shots, grave then acute freq = freq * 2 ' Useful for explosions, goes grave very fast (be sure to limit before it "overflows" in 4096) IF (FRAME AND 1) THEN put sound freq ELSE put sound_freq * 2 ' Kind of arpeggio effect. IF (FRAME AND 2) THEN put sound ' Cutted sound, useful to mix with other sounds 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191583 Share on other sites More sharing options...
freewheel Posted March 5, 2015 Share Posted March 5, 2015 Sound is very easy. IntyBASIC has all you need to know about how to make a sound channel play a particular frequency. Sound EFFECTS, on the other hand (which I think is what you're talking about ) are very difficult. Many if not most of the well-known sound effects on the Intellivsion are EXEC routines. It can be quite a lot of effort to turn bleeps and bloops into something vaguely resembling a real world noise. So - what you really need to experiment with is the envelope and noise generators because these are really where fancy sound effects happen. Play around with the allowable values for each, combine them with various frequencies and see what it sounds like. It's surprisingly easy to use the envelope generator to make a helicopter or other engine type noise, but surprisingly difficult to make a multi-layered realistic explosion sound. There are a couple of pretty good sound tools out there, or heck just write your own. Make something that turns on and off the envelope and noise generators, controls the various values you can feed to them, and allows you to also increase/decrease the frequency of a tone or two. One of the absolute joys of working with the Intellivision is that you have 19 possible inputs on a single controller, 38 between the two of them. That's better than some keyboards of the era! So you can make a program with some pretty snazzy control options to increase/decrease and set/clear a LOT of values, independently of each other. And then you get creative. I've spent literally hours at a time just listening to various noises, tweaking them, seeing "hey, what does this do" etc. And once you get a combination that sounds like "something", then the fun begins. Because most sound effects aren't just a single noise. You then get the fun of combining and modifying sounds. TL;DR - it's actually a hell of a lot of work to make good sounds. 3 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191711 Share on other sites More sharing options...
intvnut Posted March 6, 2015 Share Posted March 6, 2015 (edited) Just throwing my 0x02 cents in on top of what everyone else has said: One thing that surprised me when I first started studying other video games' sound effects (esp arcade games), is how many pitches actually come from the C major (A minor) scale. For example, the sound saucers make when you shoot them in SP is a rapid arpeggio of the notes F, D, B, D in a loop. Even the tank's jumping sound and bullet sounds are anchored at specific notes on the scale. So, in some sense, composing sound effects has some relation to music! (BTW, I learned about the whole key-of-C thing when watching a documentary on casinos. All of the slot machines are tuned to be in harmony with each other, to keep the noise from becoming too discordant. I believe they mentioned that video game arcades did something similar. There's some strong selection pressure to do so: If your machine's sounds clash with all the others, the operator's gonna get your machine out of there, lest it chase off customers.) I took this nifty lesson to heart when designing the sound effects for Christmas Carol. If you listen closely to its sound effects, they too are all tied back to the same musical scale. Everything from the doo-dee sound Carol makes while walking, to the scream the snowman makes when entering along with his tympani-like lumbering gait, and even the tinkling sound Carol makes after she's frozen and falls into a pile of ice. And the most blatantly musical sound effect was, of course, the couple bars of 'Silent Night' that play when you pick up a present. I actually sat down with an ECS synth keyboard to help me test out different pitch ranges to tune the feel of each effect. It took awhile to get them where dZ and I were both satisfied. I think they turned out well. This actually fits well with nanochess' suggestion to use exponential ramps. After all, the notes on the chromatic scale are equally spaced on the exponential curve 2(n/12). Edited March 6, 2015 by intvnut 3 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191880 Share on other sites More sharing options...
freewheel Posted March 6, 2015 Share Posted March 6, 2015 I believe, although I'm not sure, that C is the most overall pleasing key for the ear as well - at least to Western ears, as many of our major instruments are keyed this way. I've certainly noticed this when I design sounds and music - I find myself returning to it over and over again. Starting a tune in with a C just makes everything follow nicely. It may also be because I can only compose very simple music, and C is an easy key to write to. Don't quote me on the exact reason though; music theory classes are about 30 years behind me. Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191909 Share on other sites More sharing options...
First Spear Posted March 6, 2015 Author Share Posted March 6, 2015 Thanks to Kiwi for straightentening me out. Here is working code. Many issues addressed. Thanks sir! ' http://www.sean.co.uk/books/amstrad/amstrad6.shtm Mode 1 #soundTemp = 0 LoopMain: Wait If CONT.B0 Then GoSub TonePlay01 If CONT.B1 Then GoSub TonePlay02 Goto LoopMain TonePlay01: Procedure Print At 13 Color 0 , " " Print At 1 Color 5 , "01" Restore DataSound01 #soundTemp = 0 While #soundTemp <> 65535 Sound 2,#soundTemp,12 Read #soundTemp Wait Wend Restore DataNullState Sound 2,,0 Return End TonePlay02: Procedure Print At 13 Color 3 , "02" Print At 1 Color 0 , " " Restore DataSound02 #soundTemp = 0 While #soundTemp <> 65535 Sound 2,#soundTemp,12 Read #soundTemp Wait Wend Restore DataNullState Sound 2,,0 Return End DataNullState: DataSound01: Data 900,900,800,500,300,150,120,100,900,500,100,65535 DataSound02: Data 800,800,900,600,400,250,220,200,800,600,200,65535 Can anyone using IntyBASIC share successful techniques to make sound? I can make dinky tones as shown in the example code, but there appears to be a large gap between that and the sound of an arrow firing and subsequently vaporizing a monster in Cloudy Mountain. I found what I think is a workable note/frequency table at http://www.armory.com/~rstevew/Public/SoundSynth/Novelty/AY3-8910/start.html Thanks. 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191977 Share on other sites More sharing options...
Kiwi Posted March 6, 2015 Share Posted March 6, 2015 You are very welcome You can remove Restore DataNullState and the label. I forgot to remove that. Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3191994 Share on other sites More sharing options...
carlsson Posted March 6, 2015 Share Posted March 6, 2015 It is true that most instruments (*) are tuned in C, but that isn't the same as the music played on those instruments are in C key. Usually the key depends on the instrument's or singer's range of notes, or for the case the instrument is not perfectly well tempered, the key where the combined pitch error is the least to what you're used to hear. In the case of AY-3-8912 (**), it has 12 bit frequency resolution which depending on clock frequency results in audio frequencies from 15-27 Hz to 62-112 kHz. That should be reasonably sufficient for playing music in just about any key, although the higher pitch you aim for, the fewer values you have to choose between. (*) Wind instruments are tuned in all sorts of tones: Eb, Bb, F, C are among the most common, but there also are some in G, D, A. (**) In comparison, the SN76489 has 10 bit frequency resolution, the POKEY can be configured as 4x8 bit, 2x16 bit or 1x16 + 2x8 bit, the VIC-I has 7 bit arranged in three octaves, the SID has 16 bit, the TED in Plus/4 has 10 bit frequency resolution, not considering the number of oscillators, waveforms or envelopes each sound chip is capable of. 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3192084 Share on other sites More sharing options...
intvnut Posted March 6, 2015 Share Posted March 6, 2015 I believe, although I'm not sure, that C is the most overall pleasing key for the ear as well - at least to Western ears, as many of our major instruments are keyed this way. I've certainly noticed this when I design sounds and music - I find myself returning to it over and over again. Starting a tune in with a C just makes everything follow nicely. It may also be because I can only compose very simple music, and C is an easy key to write to. Don't quote me on the exact reason though; music theory classes are about 30 years behind me. Most modern instruments are tuned to an equal temperament scale, meaning all of the notes are fixed ratios with respect to each other, and you can transpose up/down by however many half steps at will, without really changing the character of the music. Key signature matters little to the sound of the music, other than where you bump into the ends of the range for each instrument (or singer's voice, as the case may be). There are other scales, though, which place the notes slightly differently. In particular, instruments were tuned rather differently in Bach's time. Key signature actually changes the sound of the music. Don't look to me for the music theory, though. I only learned about different tunings and scales after getting into Wendy Carlos. (Beauty in the Beast sounds remarkably strange on first listen, and really plays with the tunings.) She provides intriguing descriptions of her tunings that I then used as a jumping off point to many hours lost on Wikipedia. (For example... look up what a circle of fifths is. It's not a drinking game!) Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3192145 Share on other sites More sharing options...
intvnut Posted March 6, 2015 Share Posted March 6, 2015 I found what I think is a workable note/frequency table at http://www.armory.com/~rstevew/Public/SoundSynth/Novelty/AY3-8910/start.html Here's the note table I use for the Intellivision (NTSC and PAL): http://spatula-city.org/~im14u2c/intv/jzintv-1.0-beta4/examples/synth/notes.asm Also, here is the C program that generated that table. It shows the math behind the conversion, so you could conceivably write a program of your own to generate a note table in whatever format you desire: http://spatula-city.org/~im14u2c/intv/jzintv-1.0-beta4/examples/synth/notes.c 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3192282 Share on other sites More sharing options...
First Spear Posted March 10, 2015 Author Share Posted March 10, 2015 Can anyone post a working sample of how to "play noise" using IntyBASIC? I have got the basics of sound effect generation but SOUND 4 is still a bit of a mystery. In the end I want to play the sound of things splashing in the water (think a salvo missing a ship in Sea Battle) but to get started I would be great to learn how to play a moment of white noise... I did see "SOUND 4" used in the gosub source (thanks!) but its usage is interwoven into other stuff. Thanks. Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194554 Share on other sites More sharing options...
intvnut Posted March 10, 2015 Share Posted March 10, 2015 (edited) Can anyone post a working sample of how to "play noise" using IntyBASIC? I have got the basics of sound effect generation but SOUND 4 is still a bit of a mystery. In the end I want to play the sound of things splashing in the water (think a salvo missing a ship in Sea Battle) but to get started I would be great to learn how to play a moment of white noise... I did see "SOUND 4" used in the gosub source (thanks!) but its usage is interwoven into other stuff. There isn't much to this demo. Just spent 10 minutes whipping it up. ' Simple noise demo. J. Zbiciak 2015 ' ' Documentation for SOUND 4: ' ' SOUND 4, noise_period, tone_noise_enables ' ' Noise period goes from $00 to $1F. $01 is highest pitch, $1F is nearly ' the lowest pitch. $00 is actually the lowest pitch. This demo writes ' $20 to get the lowest pitch; the hardware converts that to $00 for you. ' ' The tone_noise_enables byte has 6 bits. ' ' Bit 0 Tone enable for channel A. 0 enables, 1 disables ' Bit 1 Tone enable for channel B. 0 enables, 1 disables ' Bit 2 Tone enable for channel C. 0 enables, 1 disables ' Bit 3 Noise enable for channel A. 0 enables, 1 disables ' Bit 4 Noise enable for channel B. 0 enables, 1 disables ' Bit 5 Noise enable for channel C. 0 enables, 1 disables ' ' Enabling noise and tone together on the same channel mixes them by ' multiplying the noise with the tone. The result, for low pitched ' tones, is a gritty or choppy sound. ' ' This demo illustrates both noise on its own, and noise combined with tone. ' again: CLS WAIT PRINT AT 125, "NOISE ONLY" FOR period = 1 to $20 SOUND 4, period, &110001 ' Noise only on channel A SOUND 0, $0000, 15 ' volume 15: nice and loud WAIT : WAIT : WAIT WAIT : WAIT : WAIT NEXT period PRINT AT 124, "NOISE & TONE" FOR period = 1 to $20 SOUND 4, period, &110000 ' Noise and tone on channel A SOUND 0, $0000, 15 ' volume 15: nice and loud WAIT : WAIT : WAIT WAIT : WAIT : WAIT NEXT period GOTO again noise.bin noise.bas Edited March 10, 2015 by intvnut 2 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194583 Share on other sites More sharing options...
First Spear Posted March 10, 2015 Author Share Posted March 10, 2015 Why isn't noise on Channel A "111011" instead of "110001" ? The demo clearly works but why doesn't "111011" mean enable noise channel A only? I have music playing so A&B are unavailable anyway, so I played with the bits to get noise/tone on Channel C only and made a mess. Thanks. There isn't much to this demo. Just spent 10 minutes whipping it up. [snip] ' Bit 0 Tone enable for channel A. 0 enables, 1 disables ' Bit 1 Tone enable for channel B. 0 enables, 1 disables ' Bit 2 Tone enable for channel C. 0 enables, 1 disables ' Bit 3 Noise enable for channel A. 0 enables, 1 disables ' Bit 4 Noise enable for channel B. 0 enables, 1 disables ' Bit 5 Noise enable for channel C. 0 enables, 1 disables [snip] Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194638 Share on other sites More sharing options...
intvnut Posted March 10, 2015 Share Posted March 10, 2015 (edited) Why isn't noise on Channel A "111011" instead of "110001" ? The demo clearly works but why doesn't "111011" mean enable noise channel A only? I have music playing so A&B are unavailable anyway, so I played with the bits to get noise/tone on Channel C only and made a mess. It's maybe better understood as "xx0xx1" and "xx0xx0", where the 'x' aren't relevant to the demo and could be zero OR one, as long as those channels' volumes are 0. ie. I didn't bother with Channel B or Channel C; I just left them at their default of 'tone enabled, noise disabled', but really they didn't factor into the demo. To move the demo to channel C, then the patterns become 0xx1xx for noise-only, and 0xx0xx for noise-and-tone on Channel C. If you have music playing on A and B, then you want &011100 for "noise on C, tone on A and B." I'm not sure what happens if the music contains anything that needs the noise channel. Edited March 10, 2015 by intvnut 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194654 Share on other sites More sharing options...
intvnut Posted March 10, 2015 Share Posted March 10, 2015 (edited) Why isn't noise on Channel A "111011" instead of "110001" ? The demo clearly works but why doesn't "111011" mean enable noise channel A only? Also... 111011 just enables tone on channel C, and disables everything else. If you just want noise on channel A, and everything else disabled, that's 110111. The bits are numbered right to left: 543210. Don't blame me for the numbering. It's standard "little endian" numbering. Edited March 10, 2015 by intvnut 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194677 Share on other sites More sharing options...
First Spear Posted March 10, 2015 Author Share Posted March 10, 2015 Little endian. I should have looked at/for that before I asked. Thanks intvnut! Also... 111011 just enables tone on channel C, and disables everything else. If you just want noise on channel A, and everything else disabled, that's 110111. The bits are numbered right to left: 543210. Don't blame me for the numbering. It's standard "little endian" numbering. Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194741 Share on other sites More sharing options...
First Spear Posted March 10, 2015 Author Share Posted March 10, 2015 While looking for something else related to AY-3-89xx sound, I ran into a link describing a potential method for playing waveforms from the PSG on the MSX. Of course I have no clue if it is realistic on the Intellivision, just thought I'd share. 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194846 Share on other sites More sharing options...
intvnut Posted March 10, 2015 Share Posted March 10, 2015 (edited) While looking for something else related to AY-3-89xx sound, I ran into a link describing a potential method for playing waveforms from the PSG on the MSX. Of course I have no clue if it is realistic on the Intellivision, just thought I'd share. Many years ago, 1999 to be precise, I produced the "Groovy" demo using a variant of this technique. Since then, Arnauld has improved on it somewhat. (Search for 'phunk' on INTVPROG.) I've actually played with the Viterbi-based encoder that's floating around. The main issue with playing samples in this way is that it takes tons of ROM. And the CPU is too slow to allow for more advanced compression, sadly. Also, to get good sound quality, you need to disable the display. [EDIT: Here's Arnauld's original "Don't Phunk With My PSG" post on INTVPROG. Follow that thread to see how it evolved. As I recall 'phunk2' sounds pretty good on a real Inty. It just eats gobs of ROM for a sample that's only a few seconds long.] groovy.zip Edited March 10, 2015 by intvnut 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194894 Share on other sites More sharing options...
First Spear Posted March 10, 2015 Author Share Posted March 10, 2015 I ripped some of the music playing from the IntyBASIC sample code and added stuff to make noise play on button push. I am trying to make a sound similar to the hero getting kicked in Tropical Trouble. Whether Line 6 (starting the music play) is enabled, or not, the noise does not play correctly and the code never reaches line 36. Help? Mode 0,0,0,0,0 #soundTemp = 1 CLS Wait Play Simple Play Music01 Wait LoopMain: Wait If CONT.B2 Then GoSub TonePlay02 Goto LoopMain TonePlay02: Procedure Print At 23 Color 5 , "On " Restore NoiseRoll #soundTemp = 1 Sound 4 , #soundTemp , &011100 While #soundTemp <> 65535 Read #soundTemp Sound 4 , #soundTemp , &011100 Read #soundTemp Sound 0, $0000, #soundTemp For #spinWait = 0 to 5 Wait Next #spinWait Wend Sound 0, $0000, 15 Sound 4, $0000, &011100 Restore DataNullState Wait Sound 4 , #soundTemp , &011100 Wait Sound 4, $0000, &011100 Wait Print At 23 Color 5 , "Off" Return End NoiseRoll: Data $3FF , $0E , $3C7 , $0E , $390 , $0E , $35D , $0D , $32D , $0D , $2FF , $0C , $2D4 , $0C , $2AB , $0B , $285 , $0B , $261 , $0B , $23F , $0A , $213 , $0A , $1FF , $09 , $1E3 , $09 , $1C8 , $08 , $1AE , $08 , 65535 DataNullState: Music01: DATA 7 MUSIC F4,- MUSIC S,- MUSIC A4,- MUSIC S,- MUSIC F4,- MUSIC S,- MUSIC C5,- MUSIC S,- MUSIC F4,- MUSIC S,- Music Repeat Thanks. It's maybe better understood as "xx0xx1" and "xx0xx0", where the 'x' aren't relevant to the demo and could be zero OR one, as long as those channels' volumes are 0. ie. I didn't bother with Channel B or Channel C; I just left them at their default of 'tone enabled, noise disabled', but really they didn't factor into the demo. To move the demo to channel C, then the patterns become 0xx1xx for noise-only, and 0xx0xx for noise-and-tone on Channel C. If you have music playing on A and B, then you want &011100 for "noise on C, tone on A and B." I'm not sure what happens if the music contains anything that needs the noise channel. muno.bas Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194924 Share on other sites More sharing options...
+nanochess Posted March 10, 2015 Share Posted March 10, 2015 I ripped some of the music playing from the IntyBASIC sample code and added stuff to make noise play on button push. I am trying to make a sound similar to the hero getting kicked in Tropical Trouble. Whether Line 6 (starting the music play) is enabled, or not, the noise does not play correctly and the code never reaches line 36. Help? Mode 0,0,0,0,0 #soundTemp = 1 CLS Wait Play Simple Play Music01 Once you activate PLAY SIMPLE the music tracker takes control of SOUND 0, SOUND 1 and SOUND 4, you can edit these but them will be resetted each frame to the current music. This is the cause I've implemented PLAY NONE so you can retake control of SOUND 4 for explosions and similar. 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194926 Share on other sites More sharing options...
intvnut Posted March 10, 2015 Share Posted March 10, 2015 I ripped some of the music playing from the IntyBASIC sample code and added stuff to make noise play on button push. I am trying to make a sound similar to the hero getting kicked in Tropical Trouble. Whether Line 6 (starting the music play) is enabled, or not, the noise does not play correctly and the code never reaches line 36. Help? In addition to nanochess' observations, I have some of my own. You're reading pairs of values from the DATA, and testing the second value of each pair for 65535 after attempting to put the data into SOUND statements. This is most assuredly not what you want. See potential fix below. You're putting strangely large values into the noise period ($3FF, $3C7, etc.). I'm not sure you've hooked the data to what you think you have. Noise periods range from $00 to $1F. (or $01 .. $20 if you prefer... it's actually easier to reason about them with that range.) Here's one way to fix the loop termination condition for your WHILE / WEND: Read #soundTemp ' read initial value outside the loop While #soundTemp <> 65535 Sound 4, #soundTemp , &011100 Read #soundTemp Sound 0, $0000, #soundTemp For #spinWait = 0 to 5 Wait Next #spinWait Read #soundTemp ' read value for next iteration just before end of loop Wend 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194931 Share on other sites More sharing options...
First Spear Posted March 10, 2015 Author Share Posted March 10, 2015 So the usage pattern is Play music Stop music Play noise channel (ie, play an explosion) Start music over ? Once you activate PLAY SIMPLE the music tracker takes control of SOUND 0, SOUND 1 and SOUND 4, you can edit these but them will be resetted each frame to the current music. This is the cause I've implemented PLAY NONE so you can retake control of SOUND 4 for explosions and similar. Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3194933 Share on other sites More sharing options...
+nanochess Posted March 11, 2015 Share Posted March 11, 2015 So the usage pattern is Play music Stop music Play noise channel (ie, play an explosion) Start music over ? That's right In fact selecting PLAY NONE only deactivates the usage of PSG chip, using again PLAY SIMPLE will restart music in the right time 1 Quote Link to comment https://forums.atariage.com/topic/235906-fondling-the-ay-3-8912-in-intybasic/#findComment-3195225 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.