Jump to content
IGNORED

RevEng's Sound Collection in bB


Karl G

Recommended Posts

In the 7800 Programming forum, @RevEng has a nice collection of TIA sound effects that anyone may use for their projects, wrapped-up with a nice 7800 player to try out those sounds. The data is easy enough to understand and extract from the code to use in 2600 projects, but I thought it might be nice to have a bB version of the sound player too. I automated the conversion of the data and the text with a Python script, and since the text minikernel only has 12 characters, some of the descriptions have been truncated. It should still give a good enough idea as to which is which, however.

 

Just for fun, I also added a visual representation of the sound as it is playing. The position of the vertical bar indicate the sound's pitch, and the color and brightness of the bar indicate the channel (voice) and the volume of the sound, respectively.

 

926708516_Screenshotfrom2023-03-0109-40-58.thumb.png.6ad45605861b2a24ddb7ddb32f219335.png

 

Version 4 (06/28/2024) Changes sound format to (V, C, F, D).

bbsoundtest4.zip

 

 

  • Like 14
  • Thanks 2
Link to comment
Share on other sites

4 hours ago, Karl G said:

I automated the conversion of the data and the text with a Python script, and since the text minikernel only has 12 characters, some of the descriptions have been truncated. It should still give a good enough idea as to which is which, however.

I think some of the labels or sounds are getting shifted. For example, 033 is labeled "WOLFWHISTLE" but the wolf whistle sound is played on sound 34. I noticed if I start from 001 and go backward, the sound and label are aligned until 102 or 103. The WILHELM scream label is numbered 102, but plays on 101.

Edited by 8bitPoet
  • Thanks 1
Link to comment
Share on other sites

32 minutes ago, 8bitPoet said:

I think some of the labels or sounds are getting shifted. For example, 033 is labeled "WOLFWHISTLE" but the wolf whistle sound is played on sound 34. I noticed if I start from 001 and go backward, the sound and label are aligned until 102 or 103. The WILHELM scream label is numbered 102, but plays on 101.

Thank you, and good catch! I've uploaded a corrected vwersion.

  • Like 3
Link to comment
Share on other sites

On 3/2/2023 at 4:18 AM, Random Terrain said:

Sound 61 "whoa" and sound 63 "yahoo" reminds me of this:

 

 

That's not really coincidental, since from what I understand he produced most or all of these with his soundtotia utility, converting WAV files to Atari sound data.

  • Like 1
Link to comment
Share on other sites

Glancing over the code, it looks like you are saving room by using nybbles. I stopped using nybbles because it became too confusing for me (I stopped programming for a fairly long while because of it). If someone takes over bB in the future and adds automatic nybble variables so they act like small easy-to-use variables, I'll go back to them. Until then, how do I convert the data to fit this pattern:

 

V,C,F

D

 

V - Volume (0 to 15)

C - Control [a.k.a. tone, voice, and distortion] (0 to 15)

F - Frequency (0 to 31)

D - Duration

 

Here is an example of how the data looks:

 

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   4

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   4

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   11

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   4
   0,0,0
   8
   255

 

 

Thanks.

Link to comment
Share on other sites

18 hours ago, Random Terrain said:

Glancing over the code, it looks like you are saving room by using nybbles. I stopped using nybbles because it became too confusing for me (I stopped programming for a fairly long while because of it). If someone takes over bB in the future and adds automatic nybble variables so they act like small easy-to-use variables, I'll go back to them. Until then, how do I convert the data to fit this pattern:

 

V,C,F

D

 

V - Volume (0 to 15)

C - Control [a.k.a. tone, voice, and distortion] (0 to 15)

F - Frequency (0 to 31)

D - Duration

 

Here is an example of how the data looks:

 

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   4

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   4

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   11

   15,8,2
   1
   8,8,2
   1
   4,8,2
   1
   0,8,2
   4
   0,0,0
   8
   255

 

 

Thanks.

Yes, that is correct. I combine the channel and volume into a single byte, and the other byte is for frequency (too big for a nybble). I don't have a duration, but instead repeat the line of data for the duration needed.

 

So, here ls one of the sounds for an example:

Init_chirp
    sdata sfx_chirp = SoundDataLoc
    $4e, $07
    $4e, $0a
    $4e, $0c
    $4f, $09
    $4e, $0a
    $41, $07
    $40, $09
    $FF, $FF
end
    return
; End Init_chirp

The first byte of each data line is channel and volume combined. Breaking that up into two bytes in data is dead simple - just put a comma, space and "$" after the first digit to make it into two numbers. So, after doing that, it would be:

Init_chirp
    sdata sfx_chirp = SoundDataLoc
    $4, $e, $07
    $4, $e, $0a
    $4, $e, $0c
    $4, $f, $09
    $4, $e, $0a
    $4, $1, $07
    $4, $0, $09
    $FF, $FF
end
    return
; End Init_chirp

That is now 3 bytes for the channel, then volume, and then frequency. There is no duration since each line is only 1 frame.

 

I can also easily enough have my script write out my data in the format you asked for. Is it considered somewhat "standard" format for bB projects since that was what the VbB tool would produce?

  • Like 1
Link to comment
Share on other sites

2 hours ago, Karl G said:

I can also easily enough have my script write out my data in the format you asked for. Is it considered somewhat "standard" format for bB projects since that was what the VbB tool would produce?

 

Some people came up with it in the forums somewhere and I guess we just stuck with it until something better came along. It's kind of been "standard" since around 2008.

 

After creating a sound effect using the Music and Sound Editor, it's fairly easy to edit the data after it is in the game code without putting it back through the editor. I've tweaked sound effects countless times after it was added to the code of a game. I've changed things like volume, duration, and so on right there in the game code until I got a sound just right.

 

Here are some example programs that use that kind of data:

 

https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#sound_example_no_bank

 

Sound effect data for Seaweed Assault can be seen here:

 

https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_seaweed_assault

 

 

If you can write a script that will spit out that kind of data, that would be helpful for those of us who use that style in our programs.

 

 

Thanks.

Link to comment
Share on other sites

  • 1 month later...
On 5/3/2023 at 10:46 AM, Random Terrain said:

 

Did you get a chance to do that yet?

 

 

Thanks.

It had slipped my mind for a bit. I also noticed that I wasn't using the latest version of the collection, so many sounds are missing from this version. I'll get to putting out an updated one soonish, I think.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 5/5/2023 at 1:13 PM, Karl G said:

It had slipped my mind for a bit. I also noticed that I wasn't using the latest version of the collection, so many sounds are missing from this version. I'll get to putting out an updated one soonish, I think.

 

Any progress yet?

Link to comment
Share on other sites

3 hours ago, Random Terrain said:

Any progress yet?

Sorry; I let it slip again. I need to find the script I made to do the original conversion, and modify it to generate the format you specified. I'll try to remember to look into this this week.

  • Like 1
Link to comment
Share on other sites

On 6/28/2024 at 2:10 PM, Karl G said:

Version 4 has been added to the first post, giving the sounds in the more common format for bB SFX as requested by @Random Terrain. Let me know if there are any issues with this version.

 

I'm not good with numbers, so I might be mistaken. If the frequency can only be 0 to 31 and the numbers are hexadecimal, wouldn't $31 in the data below be 49 in decimal?

 

Init_electroswitch
    sdata sfx_electroswitch = SoundDataLoc
    $F, $4, $06
    3
    $8, $4, $0C
    3
    $4, $4, $18
    3
    $2, $4, $31
    3
    $FF
end

 

 

Decimal version:

 

Init_electroswitch
    sdata sfx_electroswitch = SoundDataLoc
    15, 4, 6
    3
    8, 4, 12
    3
    4, 4, 24
    3
    2, 4, 49
    3
    255
end

 

 

Thanks.

Link to comment
Share on other sites

10 hours ago, Random Terrain said:

I'm not good with numbers, so I might be mistaken. If the frequency can only be 0 to 31 and the numbers are hexadecimal, wouldn't $31 in the data below be 49 in decimal?

You are correct; that's an oops. I'll take another look at it soon, and see what others are affected. It seems to only be the frequency that is affected for some reason.

 

Edit: It also appears to be out of range in the source file. I will see if it's a bug in the original, or if it's something I changed accidentally myself.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
On 7/1/2024 at 10:36 AM, Karl G said:

You are correct; that's an oops. I'll take another look at it soon, and see what others are affected. It seems to only be the frequency that is affected for some reason.

 

Edit: It also appears to be out of range in the source file. I will see if it's a bug in the original, or if it's something I changed accidentally myself.

 

Have you had a chance to look yet?

Link to comment
Share on other sites

40 minutes ago, Random Terrain said:

Have you had a chance to look yet?

It turned out to be in the original source for 7800basic. So, intended or not, it should play the same on the 2600 version as it does on the 7800 version. 

 

https://forums.atariage.com/topic/301293-7800-tia-sfx-library-sound2tia/?do=findComment&comment=5494176

  • Like 1
Link to comment
Share on other sites

On 7/13/2024 at 11:08 AM, Karl G said:

It turned out to be in the original source for 7800basic. So, intended or not, it should play the same on the 2600 version as it does on the 7800 version. 

 

https://forums.atariage.com/topic/301293-7800-tia-sfx-library-sound2tia/?do=findComment&comment=5494176

 

Bruce-Robert Pocock said this in that other thread:

 

"I believe the register is only 5 bits wide, so anything in the upper 3 bits is ignored/lost — so e.g. $31 ⇒ ($31 & $1f) = $11"

 

Using my handy dandy Hexadecimal to Decimal List, I know that $11 hex = 17 decimal. (I use decimal data for sound since I can understand it with a glance.)

 

I asked RevEng this question:

 

"Did you mean to have that data equal to 17 decimal or did a mistake happen and you actually wanted it to be 31 decimal?"

 

RevEng's reply:

 

"I tweak everything by ear. I'm sure I just goofed on the frequency range when I was going through trial and error, but the fact that it stayed means that I was happy with the 17 sound."

 

I'm converting hexadecimal numbers to decimal for my adapted version of the program to use on the bB page, so now I know (thanks to Karl G and Bruce-Robert Pocock) that anything out of range in the data should be ANDed with $1f to get the actual number. I went Googling and found this free online tool that will do the ANDing:

 

http://easyonlineconverter.com/converters/bitwise-calculator.html

z_aa_bitwise.thumb.png.6f0dcf62a725eaa5308dbbe248e6bae0.png

 

Update:

 

I converted all of the data to decimal and didn't find any other numbers that were out of range. Although I didn't have to use the online tool above, it's nice to know about it in case it's needed in the future.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...