+Gemintronic Posted December 18, 2021 Share Posted December 18, 2021 So, I've resorted to using nibbles in my upcoming 4 player game. The sound engine uses a nibble for sound type and another nibble for duration. That means 16 sounds at various lengths for only one 8-bit variable! No gosubs or functions as I'm unsure how much more overhead nibbles take. Use FIRE to play back current sound. LEFT or RIGHT to change sound and play it. Usual disclaimer: My code sucks. Very much open to feedback. I hope it gives people a feel for what a nibble based sound effect engine can look like. sounds6.bas sounds6.bin 4 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/ Share on other sites More sharing options...
KevKelley Posted December 20, 2021 Share Posted December 20, 2021 I am curious. The sounds are cool. My son saw me playing the .bin and asked if I was playing a dishwasher game because one of the noises sounds like our new dishwasher. 1 2 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4969555 Share on other sites More sharing options...
+Karl G Posted December 20, 2021 Share Posted December 20, 2021 5 minutes ago, KevKelley said: I am curious. The sounds are cool. My son saw me playing the .bin and asked if I was playing a dishwasher game because one of the noises sounds like our new dishwasher. That does sound like a potential KevKelley title! 1 2 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4969556 Share on other sites More sharing options...
KevKelley Posted December 20, 2021 Share Posted December 20, 2021 8 hours ago, Karl G said: That does sound like a potential KevKelley title! You got me listening to my dishwasher and loading it thinking how I can make a game out of it! I have to show some constraint and work on my other projects first! But this nibble thing might be what I was looking for. One thing I keep putting off is sound and I hate the idea of wasting full variables for sounds. That is why many of my games end up tying the AUDF0, C0, V0 to things like coordinates or pixel heights or whatever. 2 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4969902 Share on other sites More sharing options...
+Gemintronic Posted December 21, 2021 Author Share Posted December 21, 2021 My biggest regret is not finding a good Atari Adventure Dragon roar. I even tried perusing the Adventure source and couldn't figure out how to implement it. If anyone has a clue what settings to use I'd greatly appreciate the help. Here is the current "roar" code: sound13 rem Roar I Guess AUDV0 = 3 : AUDC0 = 8 : AUDF0 = temp2 goto after_sound_event Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970149 Share on other sites More sharing options...
KevKelley Posted December 21, 2021 Share Posted December 21, 2021 3 hours ago, Gemintronic said: My biggest regret is not finding a good Atari Adventure Dragon roar. I even tried perusing the Adventure source and couldn't figure out how to implement it. If anyone has a clue what settings to use I'd greatly appreciate the help. Here is the current "roar" code: sound13 rem Roar I Guess AUDV0 = 3 : AUDC0 = 8 : AUDF0 = temp2 goto after_sound_event Are you trying to copy the sound from adventure or just make a good road based on that? Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970247 Share on other sites More sharing options...
+Gemintronic Posted December 21, 2021 Author Share Posted December 21, 2021 1 hour ago, KevKelley said: Are you trying to copy the sound from adventure or just make a good roar based on that? I'm not ashamed to admit I wanted it as close as possible. But, now it's on my bucket list to understand the Adventure sound engine. I'll keep studying 6502 assembly until it makes sense I found something more akin to a roar like this: sound13 rem Roar AUDV0 = temp2&7 : AUDC0 = counter&2 : AUDF0 = temp2&27 goto after_sound_event Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970318 Share on other sites More sharing options...
KevKelley Posted December 21, 2021 Share Posted December 21, 2021 12 minutes ago, Gemintronic said: I'm not ashamed to admit I wanted it as close as possible. But, now it's on my bucket list to understand the Adventure sound engine. I'll keep studying 6502 assembly until it makes sense I found something more akin to a roar like this: sound13 rem Roar AUDV0 = temp2&7 : AUDC0 = counter&2 : AUDF0 = temp2&27 goto after_sound_event Just curious. What is "temp2&7" ? What does the "&7" part do? Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970321 Share on other sites More sharing options...
+Gemintronic Posted December 21, 2021 Author Share Posted December 21, 2021 8 minutes ago, KevKelley said: Just curious. What is "temp2&7" ? What does the "&7" part do? My uninformed impression is that it's functionally the same as modulus. So, if you want to limit the results to 0-7 then you'd go variable&7 temp2 is storing the duration nibble when inside the sound engine code. It's also being slowed down by a quarter. So, I'm using it as a less rapidly changing factor in producing sounds (compared to the counter variable) 1 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970323 Share on other sites More sharing options...
+SpiceWare Posted December 21, 2021 Share Posted December 21, 2021 2 hours ago, KevKelley said: Just curious. What is "temp2&7" ? What does the "&7" part do? bitwise operation & = AND | = OR ^ = EXCLUSE OR These are operations that occur at the bit level. AND 0 1 + - - 0 | 0 0 1 | 0 1 OR 0 1 + - - 0 | 0 1 1 | 1 1 EXCLUSIVE OR 0 1 + - - 0 | 0 1 1 | 1 0 For AND both bits must be 1 to return a 1, else return 0. For OR at least 1 bit must be 1 to return a 1, else return 0. For EXCLUSIVE OR only 1 bit must be 1 to return a 1, else return 0. The operation is done at the bit level, so it's easiest to understand if you look at the values in binary. 7 in binary is %00000111 if temp2 where 158 then in binary it would be %10011110 AND 76543210 bit location %00000111 %10011110 --------- %00000110 So basically temp2&7 will return the value of the last 3 bits in temp2. In the example only bits 1 and bits 2 are both 1, so they're the only ones that are still on when doing a bitwise and operation. temp2|7 would be OR: OR 76543210 bit location %00000111 %10011110 --------- %10011111 temp2^7 would be EXCLUSIVE OR: EXCLUSIVE OR 76543210 bit location %00000111 %10011110 --------- %10011001 2 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970385 Share on other sites More sharing options...
KevKelley Posted December 21, 2021 Share Posted December 21, 2021 Thanks @SpiceWare. I have had limited use in some bitwise operations so I wasn't familiar with seeing it like that with the temp variables. In Crossdock I used an ^ to turn the bay doors on or off but I think that might have been the extent of my use of these operations. 1 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970389 Share on other sites More sharing options...
+Karl G Posted December 21, 2021 Share Posted December 21, 2021 Adventure generates sounds procedurally rather than using sound data. I used many of the Adventure sound effects in "Space Peril" for the 7800, but generated from sound data instead. Some of these I got from @RevEng's TIA SFX collection, and some I converted into sound data myself. Here's the dragon roar/bite sound: $1F,$03,$0F $1F,$08,$0E $1F,$03,$0D $1F,$08,$0C $1F,$03,$0B $1F,$08,$0A $1F,$03,$09 $1F,$08,$08 $1F,$03,$07 $1F,$08,$06 $1F,$03,$05 $1F,$08,$04 $1F,$03,$03 $1F,$08,$02 $1F,$03,$01 The data here is in the format: Frequency, Channel, Volume Also, each chunk of data is held for 3 frames, so if the sound code doesn't support that, then you will need to triple all of the lines. 1 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970407 Share on other sites More sharing options...
+Gemintronic Posted December 22, 2021 Author Share Posted December 22, 2021 That. was. AMAZING! Thank you for explaining the & operand SpiceWare and Karl G for showing the roar data. I was able to get a pretty good approximation by doing this: sound13 rem Roar Karl G version if counter{0} then AUDV0 = temp2 : AUDC0 = 3 : AUDF0 = 31 else AUDV0 = temp2 : AUDC0 = 8 : AUDF0 = 31 goto after_sound_event 3 Quote Link to comment https://forums.atariage.com/topic/328488-nibble-based-sound-engine-demo/#findComment-4970647 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.