Jump to content
IGNORED

Sound Effect editor!


Recommended Posts

Hi all.

 

I was watching in delight how Brian Pudden wrote two new games in one month after getting into Intellivision Programming, and he posted on Intellivision Homebrew Games in Facebook.

 

Then Bill Stahl made a question in the topic "Has anyone written sound ‘tool’ that runs in inty basic? To manipulate the registers, and hear in real time. " and I thought it would be good to have such a tool.

 

So I've wrote a sound editor that allows you to write sound effects up to 20 tones long in one channel.

 

Each tone frequency, volume, noise and mix can be setup.

 

The manual of usage (also included at the start of the program):

 

1- Enter frequency (0-4095) Press Enter to complete or enter the four digits.

2- Enter volume (silence 0-15 high)

3- Enter noise value (high noise 0-31 low noise)

4- Enable/disable mix of noise

5- Increase length of sound effect by one tone.

6- Decrease length of sound effect by one tone.

7- Enter speed for playing tones (1 for changing tone on each video frame)

8- Toggle repeat (when playing it will keep repeating unless you disable it)

9- Start playing (BTW if you change data while it repeats, it will sound in real time!!)

0- Show IntyBASIC source code for playing the sound (you should do manually the speed with WAIT or the multitask method ON FRAME GOSUB)

 

Enjoy it!

 

 

 

shot0006.gif

 

shot0007.gif

 

shot0008.gif

 

effect.bas effect.rom

Edited by nanochess
  • Like 7
  • Thanks 1
Link to comment
Share on other sites

YES!!!!

 

I was wondering if such a program existed.....

 

Nano, you are the man!!!  I will definitely use this

 

EDIT: ok, so this clearly uses the intellivsiion controller pad in all it's numeric keypad glory.

 

I just can't get me windows laptop to have a consistent mapping so I cannot use this program in it's entirety.  So, are there any USB compatible controllers out there for intellivision....how does everyone here test and play intellivision games that use everyrthing on the original controller?

 

I can get some of it working and it is a GREAT program!

Edited by Mik's Arcade
  • Like 2
Link to comment
Share on other sites

1 hour ago, Mik's Arcade said:

I just can't get me windows laptop to have a consistent mapping so I cannot use this program in it's entirety.  So, are there any USB compatible controllers out there for intellivision....how does everyone here test and play intellivision games that use everyrthing on the original controller?

There's the keyboard hack file I include with PIDEjL, my own front-end for launching jzIntv.  I had to make a mapping for all the controls onto a keyboard without Function keys or an Escape key, which was the keyboard I had when I wrote FUBAR.

 

Here is a link to the Windows port of PIDEjL, if you care to try it.

  • Like 1
Link to comment
Share on other sites

1 hour ago, nanochess said:

Typically the numbers and Enter key  (or Fn+Enter on my Macbook) replace the same in Intellivision controller.

I wish....that just doesn't seem to work for my laptop.  I even tried using the functions keys in the SDK tool (i think it was F6 to force the numeric key pad)...

 

I'll try the PIDEjl hack and see if I can use it...

 

thanks

  • Like 1
Link to comment
Share on other sites

Corrected bug on handling sound effects with a length bigger than 8.

 

Please re-download the tool.

 

Also made a video (added to first post) showing it with the sound effects examples from the chapter 2 of my book Advanced Game Programming for Intellivision.

Edited by nanochess
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hey guys!

 

I am still trying to understand how to make sounds... I used this tool and was able to generate a sound I liked but when I put it in my code it just came out as a single tone.

 

I tried seperating with a for loop and still the same... I want it to play the sound where you hear the 2 tones one after the other.

 

here is the output: 

 

sound 2,1341,12
sound 4,,$38
sound 2,1119,12
sound 4,,$38

 

Link to comment
Share on other sites

  • 2 months later...
On 5/7/2021 at 11:02 AM, Mik's Arcade said:

I just can't get me windows laptop to have a consistent mapping so I cannot use this program in it's entirety.  So, are there any USB compatible controllers out there for intellivision....how does everyone here test and play intellivision games that use everyrthing on the original controller?

Get a USB adapter for a real controller.

 

Due to the flexibility, i'd recommend the 2600-daptor D9 if you are interested in support for a single player adapter (or get two adapters if you want two players), or you can get a UPCI if you want two players using a single adapter and the UPCI supports a few additional things that the D9 doesn't.

 

Both work great with jzintv

 

There are a few other adapters out there, too.  It is just that these two are more flexible than the others.

Link to comment
Share on other sites

12 hours ago, fdr4prez said:

Get a USB adapter for a real controller.

 

Due to the flexibility, i'd recommend the 2600-daptor D9 if you are interested in support for a single player adapter (or get two adapters if you want two players), or you can get a UPCI if you want two players using a single adapter and the UPCI supports a few additional things that the D9 doesn't.

 

Both work great with jzintv

 

There are a few other adapters out there, too.  It is just that these two are more flexible than the others.

oh, this is great.  I will have to get this adapter and some controllers

 

thanks for the info

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

ok, let's talk about sound.  This is really more of a question about sound itself than the intellivision.

 

I get how of this works (great tool!), but the problem is, I don't know where to start!  Of course, I could sit here all day and just play around, I've come up with some interesting sounds, but I guess I don't know enough about noise, and mix and frequency, let along combining them.  

 

For example, I'm just trying to come up with as close to a match as I can with the simple sound below.  I just cant figure out the right mix.

 

this seems a bit close....

 

SOUND 2,26,15

SOUND 4,5,$18

SOUND 2,26,14

SOUND 4,5,$18

SOUND 2,26,13

SOUND 4,5,$18

SOUND 2,26,12

 

can someone point me out to a resource I can read up on?  any general tips? this sound close enough? thanks

 

I think making music will be easier than sound effects...lol

 

It's weird, the number pad on my laptop does not work with the tool but at least the numbers at the top of the keyboard do.

 

shot.wav

Edited by Mik's Arcade
Link to comment
Share on other sites

8 hours ago, Mik's Arcade said:

ok, let's talk about sound.  This is really more of a question about sound itself than the intellivision.

 

I get how of this works (great tool!), but the problem is, I don't know where to start!  Of course, I could sit here all day and just play around, I've come up with some interesting sounds, but I guess I don't know enough about noise, and mix and frequency, let along combining them.  

 

For example, I'm just trying to come up with as close to a match as I can with the simple sound below.  I just cant figure out the right mix.

 

this seems a bit close....

 

SOUND 2,26,15

SOUND 4,5,$18

SOUND 2,26,14

SOUND 4,5,$18

SOUND 2,26,13

SOUND 4,5,$18

SOUND 2,26,12

 

can someone point me out to a resource I can read up on?  any general tips? this sound close enough? thanks

 

I think making music will be easier than sound effects...lol

 

It's weird, the number pad on my laptop does not work with the tool but at least the numbers at the top of the keyboard do.

 

shot.wav 66.29 kB · 3 downloads

That sounds pretty cool.  It reminds me of the shot in Space Invaders, although that one had a bit of a higher pitch.

 

Anyway, I do not know much specifically about that tool, but it seems that it is rather basic and grants you mostly low-level access to the sound capabilities of the Intellivision.  IntyBASIC offers the same with the SOUND command, but in code.  That's not intended as a knock on the tool -- it is definitely useful to tinker in "real time" as you design your sound effects.  I'm just pointing out that there is still some complexity that you need to deal with, especially regarding those numbers.

Think of SOUND like the SPRITE command, but aural instead of visual:  it is still a bunch of numbers that need to be combined and then go into the chip's registers.

 

With that in mind, let me offer some details about the sound chip that may help.  First, this is directly from the "psg.txt" document prepared by Joe Z. and included in the SDK-1600 and the IntyBASIC SDK:

    The basic blocks in the PSG which produce the programmed sounds include:

        Tone Generators         produce the basic square wave tone
                                frequencies for each channel (A,B,C)

        Noise Generator         produces a frequency modulated pseudo
                                random pulse width square wave output

        Mixers                  combine the outputs of the Tone
                                Generators and the Noise Generator. One
                                for each channel (A,B,C)

        Amplitude Control       provides the D/A converters with either
                                fixed or variable amplitude pattern. The
                                fixed amplitude is under direct CPU
                                control; the variable amplitude is
                                accomplished by using the output of the
                                Envelope Generator.

        Envelope Generator      produces an envelope pattern which can
                                be used to amplitude modulate the output
                                of each mixer

        D/A Converters          the three D/A converters each produce up
                                to a 16 level output signal as
                                determined by the Amplitude Control

 

In simpler terms:

  • There are three tone generators (or oscillators, or voices, or channels) that can produce sound -- square wave tones to be precise.  Although it seems that many use only one in IntyBASIC, reserving the others for music.
  • There is one noise generator, whose output can be mixed in with any of the three tone voices.
  • There is one envelope generator, which can be assigned to any of the three tone voices.

Logically, you can visualize the signal path like this:

image.thumb.png.834f004cf0871ceeca7e3e579225608c.png

Notice that all three voices are independent, but that when mixed with noise, they all use the single one.  The same with the envelope generator.  Each voice can either have its own program-controlled volume or use the envelope generator, but when using the latter there is only one.

 

Now, about those tones:

  • Even though we all say "frequency," these are not sound frequencies -- they are the periods of the internal counters in the chip that control the oscillators.  Yes, it's a bit technical, but the only thing you need to worry about is the difference between Frequency and Period, and that's easy.  If you recall your high-school physics class:
        F = 1 / T

    So, the Frequency (F) is inversely proportional to the Period (T).  That means that lower periods translate into higher frequences, which produce higher pitches, and vice-versa.  This is why you see in Oscar's tool demo that he sets higher numbers decrementing to lower numbers, and the output sounds like an increase in pitch ramp.

    Now, is there a relationship between those period numbers and real life pitches that you could exploit to find some useful values?  Of course!  I'll spare you the details of what it means (but feel free to ask if you are interested to know!), and just give you the following function, also taken from the "psg.txt" document:

      Period = CpuClock ÷ (32 × Frequency)
    
    Or ...
    
      Period = CpuClock / 32 / Frequency

    The CPU clock frequency depends on whether you are using NTSC or PAL:

    • NTSC:  3,579,545  (3.58 MHz)

    • PAL:  4,000,000  (4 MHz)
       

  • The same function above applies to the noise generator period.  When played in isolation, the noise generator produces an unpitched scratchy sound, similar to white-noise, that biases towards higher or lower frequencies depending on the period selected.  This can produce hissing sounds at the higher end, and booming explosions at the lower one.
     

  • The "mixing" of tone and noise is a bit counter-intuitive as well.  It works closer to a filter than a typical audio mixer.  The tones are actually generated as a cycling stream of one and zeros, which are then converted by the Digital/Analog Converter into an audio signal.  Likewise, the noise is actually a random bunch of ones and zeros.  Mixing these two is done in a bitwise AND operation.

    What this means is that the noise will have a tendency to modulate a tone by changing the character of its signal pattern.  In practice, higher noise periods (i.e., lower frequencies) tend to make for brighter sounds, while lower periods (i.e., higher frequencies) tend towards more muddled sounds.  This effect is more noticeable at higher tone frequencies.

    So, in short:

    • (High Tone Frequency) AND (Low Noise Frequency) = Brighter noise

    • (High Tone Frequency) AND (High Noise Frequency) = Muddled or muffled noise
       

  • The "Mix" value of the IntyBASIC SOUND command (and in Oscar's tool) is a bit-field that allows you to select which channels produce tone and/or noise.  However, the bits are set in reverse:  a zero means "enable" and a one means "disable."  The mixer bit-field is defined like this:

                    NOISE       TONE
                  ____^____   ____^____
                 /         \ /         \
        +---+---+---+---+---+---+---+---+
        | - | - | N | N | N | T | T | T |
        +---+---+---+---+---+---+---+---+
    Channels:     2   1   0   2   1   0

    What that means is that setting any of those bits to zero will enable a given generator to produce either noise or tone.  For example, to enable all three channels for tone, and mix in noise on channel #0 only, you would set the bits like this:

                    NOISE       TONE
                  ,___^___,   ,___^___,
                 /         \ /         \
        +---+---+---+---+---+---+---+---+
        | - | - | 1 | 1 | 0 | 0 | 0 | 0 |  = $30
        +---+---+---+---+---+---+---+---+
    Channels:     2   1   0   2   1   0
    

    The default, as you may have seen in all the documents and sample programs is to enable all tones (lower three bits to zero) and disable all noise (next three bits to one):

                    NOISE       TONE
                  ,___^___,   ,___^___,
                 /         \ /         \
        +---+---+---+---+---+---+---+---+
        | - | - | 1 | 1 | 1 | 0 | 0 | 0 |  = $38
        +---+---+---+---+---+---+---+---+
    Channels:     2   1   0   2   1   0
    

    You can use your PC's calculator, in "programmer" mode, to set the bits and get a Decimal or Hexadecimal value.

    However, all that notwithstanding, the easiest way is to use the constants defined in the "constants.bas" to compose your mixer values:

    ' Enable noise in all three channels and the first noise channel.
    ' In other words, just disable noise in the top two channels.
    Mixer = (PSG_NOISE_CHANNELB_DISABLE + PSG_NOISE_CHANNELC_DISABLE)

    You may want to explore the section headed "PSG - Mixer control" in the "constants.bas" file to see what other relevant constants it offers.

 

That's it for a (very) basic course on the AY-3-8914 (PSG) chip capabilities of the Intellivision.  I hope it helps.

 

Ultimately, the best way to get some cool sound effects is just to play with the parameters and see how it sounds.  For that, Oscar's "Sound Effects Editor" tool is useful.

 

Ask any questions!

 

     -dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

As aways, super informative and helpful.  I looked at the entire section of the PSG in constants.bas before and had no idea what any of it meant.  The 'theory' of it all makes more sense to me (flowcharts always makes things easy to visualize!), but the main takeaway I was looking for is the lesson on frequency and how it describes what 'kind' of noise is generated. This is the starting point for any sound I want to create (or replicate) in knowing where in the spectrum to start tinkering

 

Unfotunately, after that, you kind of just need to have an 'ear' for sound.  Nobody can help me with that.

 

The sound I made was close, maybe close enough to what I was looking for.  It must have also been close because, as you point out, it sounds a bit similar to Space Invaders, and that's exactly how it is in the arcade game. It has a bit too much of the "white noise" in it, but it sounds nothing like it without it!

 

I'm also going to take a crack at a couple of short music interludes later so we shall see how that goes.

 

Has anyone ever figured out how to make the intellivision "crowd cheer", "whistling" and "horn" sounds?   I think I remember someone saying that they were copyrighted and off limited.  I want to use the "cheer" and "whistling" as a starting point for two sound effects in Sasuke Vs Commander that are actually quite similar to them. They are used separately and not as a crowd cheering, of course.  I'll use your chart above as a starting point too.

 

EDIT: In the tool, on a side note, once your sound goes beyond a page of length (8), it seems to get lost and I have a hard time finding the rows. It might even be flat out glitching. 

Edited by Mik's Arcade
Link to comment
Share on other sites

1 hour ago, Mik's Arcade said:

As aways, super informative and helpful.  I looked at the entire section of the PSG in constants.bas before and had no idea what any of it meant.  The 'theory' of it all makes more sense to me (flowcharts always makes things easy to visualize!), but the main takeaway I was looking for is the lesson on frequency and how it describes what 'kind' of noise is generated. This is the starting point for any sound I want to create (or replicate) in knowing where in the spectrum to start tinkering

I'm glad it was at least useful.

 

Quote

Unfotunately, after that, you kind of just need to have an 'ear' for sound.  Nobody can help me with that.

I think that applies to anybody.  I believe that the reason people like Oscar and others can produce such cool sound effects is that they've done it already for a while, perhaps in multiple platforms, and already have an idea of how to construct their effects.  Then, it's just a matter of seeing how to reproduce it on the Intellivision.

 

Like you, I was intimidated by the whole affair and couldn't make heads or tails of the PSG chip capabilities.  For my game, @intvnut created all the sound effects, and when I tried to adapt or extend some to make additional effects, I found that I was just able to break them. :(

 

It wasn't until I took over the Intellivision Music Tracker that I dug deep into the PSG and was able to get a grasp on how to exploit it.  Especially, the synthesis of drums, which are implemented very similarly to the way sound effects are done.  That effort really allowed me to understand the relationship between tone and noise and all those funny register values.

 

So I guess what I'm trying to say is that, I'm sure it'll come to you with practice.

 

Quote

The sound I made was close, maybe close enough to what I was looking for.  It must have also been close because, as you point out, it sounds a bit similar to Space Invaders, and that's exactly how it is in the arcade game. It has a bit too much of the "white noise" in it, but it sounds nothing like it without it!

That's the thing about the so-called "mixer":  It's not like you get a tone with some noise when you mix the two together -- you get noise of a different color.

 

So if it has too much of a "white noise" character, try lowering the period of the noise, or increasing the period of the tone (lower frequencies), and see what happens.

 

It also can help to start with a "sharper" noise and changing its period over time to add extra "umph" to the initial attack.

 

For an example, consider this synthesized 808 snare drum I created for the Intellivision Music Tracker.  It starts with a sharp attack at maximum volume and a bit of a lower frequency tone -- just for a single frame -- to give it that extra kick to the initial sound.  Then, it quickly tapers down in volume while lowering the period of the noise generator.

@@808_snare:    DRUM($500, $08, 1, 1, $F) ' Step #00
                DRUM($000, $08, 0, 1, $F) ' Step #01
                DRUM($000, $08, 0, 1, $E) ' Step #02
                DRUM($000, $07, 0, 1, $D) ' Step #03
                DRUM($000, $07, 0, 1, $C) ' Step #04
                DRUM($000, $07, 0, 1, $B) ' Step #05
                DRUM($000, $06, 0, 1, $A) ' Step #06
                DRUM($000, $06, 0, 1, $9) ' Step #07
                DRUM($000, $06, 0, 1, $8) ' Step #08
                DRUM($000, $08, 0, 1, $7) ' Step #09
                DRUM($000, $08, 0, 1, $6) ' Step #10
                DRUM($000, $08, 0, 1, $4) ' Step #11
                DRUM($000, $08, 0, 1, $2) ' Step #12
                DRUM($000, $00, 0, 0, $0) ' Step #13
                DRUM($000, $00, 0, 0, $0) ' Step #14
                DRUM($000, $00, 0, 0, $0) ' Step #15

You can hear it in my "808-ish Drums Demo" recorded from the jzIntv emulator.  It's not a perfect replica of an TR-808 snare sound, but a close facsimile.  Thus "808-ish." ?

 

Converting that to IntyBASIC would look something like this:

' Each pair sets the tone, volume, noise, and mix of the channel
' on each frame:

' Initialize channel #2:
SOUND 2, $500, $0F      ' Channel #2: Tone period = $500, volume = 15
SOUND 4, $08,  $1B      ' Channel #2: Noise period = $08, mix = noise + tone

' Step #1:
SOUND 2, $00,  $0F      ' Channel #2: Volume = 15
SOUND 4, $08,  $1F      ' Channel #2: Noise period = $08, mix = noise only

' Step #2:
SOUND 2, $00,  $0E      ' Channel #2: Volume = 14
SOUND 4, $08,  $1F      ' Channel #2: Noise period = $08, mix = noise only
                        
' Step #3:              
SOUND 2, $00,  $0D      ' Channel #2: Volume = 13
SOUND 4, $07,  $1F      ' Channel #2: Noise period = $07, mix = noise only
                        
' Step #4:              
SOUND 2, $00,  $0C      ' Channel #2: Volume = 12
SOUND 4, $07,  $1F      ' Channel #2: Noise period = $07, mix = noise only
                        
' Step #5:              
SOUND 2, $00,  $0B      ' Channel #2: Volume = 11
SOUND 4, $07,  $1F      ' Channel #2: Noise period = $07, mix = noise only
                        
' Step #6:              
SOUND 2, $00,  $0A      ' Channel #2: Volume = 10
SOUND 4, $06,  $1F      ' Channel #2: Noise period = $06, mix = noise only
                        
' Step #7:              
SOUND 2, $00,  $09      ' Channel #2: Volume = 9
SOUND 4, $06,  $1F      ' Channel #2: Noise period = $06, mix = noise only
                        
' Step #8:              
SOUND 2, $00,  $08      ' Channel #2: Volume = 8
SOUND 4, $06,  $1F      ' Channel #2: Noise period = $06, mix = noise only
                        
' Step #9:              
SOUND 2, $00,  $07      ' Channel #2: Volume = 7
SOUND 4, $08,  $1F      ' Channel #2: Noise period = $08, mix = noise only
                        
' Step #10:             
SOUND 2, $00,  $06      ' Channel #2: Volume = 6
SOUND 4, $08,  $1F      ' Channel #2: Noise period = $08, mix = noise only
                        
' Step #11:             
SOUND 2, $00,  $04      ' Channel #2: Volume = 4
SOUND 4, $08,  $1F      ' Channel #2: Noise period = $08, mix = noise only
                        
' Step #12:             
SOUND 2, $00,  $02      ' Channel #2: Volume = 2
SOUND 4, $08,  $1F      ' Channel #2: Noise period = $08, mix = noise only
                        
' Step #13:             
SOUND 2, $00,  $00      ' Channel #2: Volume = 0
SOUND 4, $00,  $3F      ' Channel #2: Noise period = $00, mix = disable all

 

It's still a bit low-level, which is why Oscar's tool may help in generating the code for you.

 

Quote

I'm going to watch Oscar's demo again....the sound was not working when I tried watching it which is kind of important in a sound demo...LOL

DOH! ?

 

Quote

Has anyone ever figured out how to make the intellivision "crowd cheer", "whistling" and "horn" sounds?

I believe Carl Mueller Jr. reproduced them for his own sound effects engine.  There may be a thread somewhere describing how it's done (or perhaps it was in the INTVPROG mailing list?).

 

Quote

   I think I remember someone saying that they were copyrighted and off limited.  I want to use the "cheer" and "whistling" as a starting point for two sound effects in Sasuke Vs Commander that are actually quite similar to them. They are used separately and not as a crowd cheering, of course.  I'll use your chart above as a starting point too.

As far as I remember, the crowd cheer is a combination of various sound effects, with a simple program that randomly picks which one to play at any given time.  It also uses some random parameters to change the pitch of the cheer and the whistles as it goes.  All of the effects are played together, so it uses all three channels.

 

The original sound effect was implemented by APh programmers using the Exec's own sound effects engine.  This engine was a bit more sophisticated than the SOUND statement in IntyBASIC, and included some nice capabilities that let you manipulate a sound as it played.  In that sense, it was closer to a sound scripting language.

 

Essentially, it offered the ability to:

  • Turn on and off the tone or noise on a channel.
  • Set a channel's frequency
  • Set a channel's volume
  • Set a repeating process that would increase or decrease a channel's frequency by a certain amount, at a given speed, for a given duration or number of steps.
  • Set a similar repeating process to increase or decrease a channel's volume
  • Offer a couple of variables to keep state of where you are in your effect's processing.

The idea was that you just create a small "program" with some special macro commands, and call it from your main game program.  This "program" included instructions to ramp up or down the frequency of a channel at a certain speed, or choosing a random value, etc.  The sound effects engine will then play this little "program" on its own while your own game program continued as normal.

 

As you may imagine, such a framework would make something like the crowd cheer sound effect a lot simpler to implement than just plain, raw SOUND statements.

 

     -dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

Yeah, I'm starting to get comfy with concepts, but I think this going to be harder than I thought and the knowledge goes beyond what the tool offers. It is going to be a learning curve and like everything else I will just need to get the experience

 

The tool created this code:

    SOUND 2,37,8
    SOUND 4,,$38
    SOUND 2,37,8
    SOUND 4,,$38
    SOUND 2,38,8
    SOUND 4,,$38
    SOUND 2,38,8
    SOUND 4,,$38
    SOUND 2,39,8
    SOUND 4,,$38
    SOUND 2,39,8
    SOUND 4,,$38
    SOUND 2,40,8
    SOUND 4,,$38
    SOUND 2,40,8
    SOUND 4,,$38

 

I entered into the tool as such:

T=0037  V=08 N:0 M:0

T=0037  V=08 N:0 M:0

T=0038  V=08 N:0 M:0

T=0038  V=08 N:0 M:0

T=0039  V=08 N:0 M:0

T=0039  V=08 N:0 M:0

T=0040  V=08 N:0 M:0

T=0040  V=08 N:0 M:0

 

Speed = 05

 

It makes a nice sound that I want to make it sound like the ninja is dropping from the sky. So, it starts when they are hit and I want it continue until they plop onto the ground I actually want to keep going further (41..50) but I can't get the tool to add that many indexes without having issues.   

 

I put it in the game, and it sounds noting like what it sounded like in the Tool. It's just one long beep.  The code works though....it plays the sounds as long as the ninja drops from the sky and stops once he splats on the ground.  Perhaps I should treat this sound as actual music. But, the bullet sound does play all the way through as I expected it to.

 

I'll keep plugging away...

 

Link to comment
Share on other sites

Yeah, I'm starting to get comfy with concepts, but I think this going to be harder than I thought and the knowledge goes beyond what the tool offers. It is going to be a learning curve and like everything else I will just need to get the experience

 

The tool created this code that I added to my game as:

play_plummet: PROCEDURE

    SOUND 2,37,8
    SOUND 4,,$38
    SOUND 2,37,8
    SOUND 4,,$38
    SOUND 2,38,8
    SOUND 4,,$38
    SOUND 2,38,8
    SOUND 4,,$38
    SOUND 2,39,8
    SOUND 4,,$38
    SOUND 2,39,8
    SOUND 4,,$38
    SOUND 2,40,8
    SOUND 4,,$38
    SOUND 2,40,8
    SOUND 4,,$38

END

I entered into the tool as such:

T=0037  V=08 N:0 M:0

T=0037  V=08 N:0 M:0

T=0038  V=08 N:0 M:0

T=0038  V=08 N:0 M:0

T=0039  V=08 N:0 M:0

T=0039  V=08 N:0 M:0

T=0040  V=08 N:0 M:0

T=0040  V=08 N:0 M:0

 

Speed = 05

 

It makes a nice sound that I want to make it sound like the ninja is dropping from the sky. So, it starts when they are hit and I want it continue until they plop onto the ground I actually want to keep going further (41..50) but I can't get the tool to add that many indexes without having issues.   

 

I put it in the game, and it sounds noting like what it sounded like in the Tool. It's just one long beep.  The code works though....it plays the sounds as long as the ninja drops from the sky and stops once he splats on the ground.  Perhaps I should treat this sound as actual music. But, the bullet sound does play all the way through as I expected it to.

 

I'll keep plugging away...

 

 

EDIT:   Oh, this worked!   To follow the concept of the 'state' as you pointed out above, I changed the code in my game to look like this:

 

play_plummet: PROCEDURE
    SOUND 2,37 + sound_state ,8
    SOUND 4,,$38    
    sound_state = sound_state + 1
    IF sound_state = 8 THEN sound_effect = 0

 

Edited by Mik's Arcade
  • Like 1
Link to comment
Share on other sites

32 minutes ago, Mik's Arcade said:

Yeah, I'm starting to get comfy with concepts, but I think this going to be harder than I thought and the knowledge goes beyond what the tool offers. It is going to be a learning curve and like everything else I will just need to get the experience

 

The tool created this code:

    SOUND 2,37,8
    SOUND 4,,$38
    SOUND 2,37,8
    SOUND 4,,$38
    SOUND 2,38,8
    SOUND 4,,$38
    SOUND 2,38,8
    SOUND 4,,$38
    SOUND 2,39,8
    SOUND 4,,$38
    SOUND 2,39,8
    SOUND 4,,$38
    SOUND 2,40,8
    SOUND 4,,$38
    SOUND 2,40,8
    SOUND 4,,$38

 

I entered into the tool as such:

T=0037  V=08 N:0 M:0

T=0037  V=08 N:0 M:0

T=0038  V=08 N:0 M:0

T=0038  V=08 N:0 M:0

T=0039  V=08 N:0 M:0

T=0039  V=08 N:0 M:0

T=0040  V=08 N:0 M:0

T=0040  V=08 N:0 M:0

 

Speed = 05

 

It makes a nice sound that I want to make it sound like the ninja is dropping from the sky. So, it starts when they are hit and I want it continue until they plop onto the ground I actually want to keep going further (41..50) but I can't get the tool to add that many indexes without having issues.   

 

I put it in the game, and it sounds noting like what it sounded like in the Tool. It's just one long beep.  The code works though....it plays the sounds as long as the ninja drops from the sky and stops once he splats on the ground.  Perhaps I should treat this sound as actual music. But, the bullet sound does play all the way through as I expected it to.

 

I'll keep plugging away...

 

My understanding is that the SOUND statement in IntyBASIC only sets the values of a PSG register, but does not control the timing of the sound -- that's up to your program.

 

So, while the tool plays a nice sound that changes over time, at the speed you indicated; the code it produces is only the configuration of the PSG registers at any point in time.  That is, you will have to create a small subroutine that runs every two of those statements (SOUND 2 for the tone change, SOUND 4 for noise change) on each game frame.

 

You do this in a loop with a state machine, or you can just use IF/ELSE/END from the ON FRAME GOSUB event.  Something like this (NOTE: Untested code ahead!):

ON FRAME GOSUB PlaySoundEffect

' Initialize your sound effect
Counter = 0

MainLoop:
  ' Your game loop here ...
GOTO MainLoop



PlaySoundEffect: Procedure
  IF (Counter = 0) THEN
    SOUND 2,37,8
    SOUND 4,,$38
  END

  IF (Counter = 1) THEN
    SOUND 2,37,8
    SOUND 4,,$38
  END

  IF (Counter = 2) THEN
    SOUND 2,38,8
    SOUND 4,,$38
  END

  IF (Counter = 3) THEN
    SOUND 2,38,8
    SOUND 4,,$38
  END

  IF (Counter = 4) THEN
    SOUND 2,39,8
    SOUND 4,,$38
  END

  IF (Counter = 5) THEN
    SOUND 2,39,8
    SOUND 4,,$38
  END

  IF (Counter = 6) THEN
    SOUND 2,40,8
    SOUND 4,,$38
  END

  IF (Counter = 7) THEN
    SOUND 2,40,8
    SOUND 4,,$38
  END

  ' Reset PSG when done
  IF (Counter = 8) THEN
    SOUND 2, 1, 0
    SOUND 4, , $38
  END

  Counter = (Counter + 1)
End

 

Note that, as long as you are writing a mini-program to handle your sound effect, you may as well take advantage of the full IntyBASIC language.  For instance, if all you are doing is changing the frequency in a linear fashion, you may just want to combine all those tests above into something that just adds or subtracts some amount on every frame.  This is closer to the way Oscar's sound effects are implemented in the example programs included in the book.

 

    -dZ.

Edited by DZ-Jay
  • Like 1
Link to comment
Share on other sites

sorry....you must have missed my edit!  Thanks for keeping the interest.  I'm sure this is a more fun thing to discuss than my  collision deterction issue.  I'll get back to that once I work out all these sounds and music.  

 

EDIT:   Oh, this worked!   To follow the concept of the 'state' as you pointed out above, I changed the code in my game to look like this:

 

play_plummet: PROCEDURE
    SOUND 2,37 + sound_state ,8
    SOUND 4,,$38    
    sound_state = sound_state + 1
    IF sound_state = 8 THEN sound_effect = 0

 

 

I also made the bullet fire better by doing this:

 

play_fire:    PROCEDURE
    SOUND 2,26,8 - sound_state / 4
    SOUND 4,5,$18
    sound_state = sound_state + 1
    IF sound_state = 32 THEN sound_effect = 0
    END

 

I'm figured out the math Oscar is doing and starting to get it....

 

It's just like how I am controlling the movement on screen.  For the sound, I was trying to code the whole thing in one shot, but you take to take one step at a time. Basically, each 'index' in the tool is equivalent to one sound_state in the code called by ON FRAME GOSUB call.

Edited by Mik's Arcade
more info
  • Like 2
Link to comment
Share on other sites

1 hour ago, Mik's Arcade said:

sorry....you must have missed my edit!  Thanks for keeping the interest.  I'm sure this is a more fun thing to discuss than my  collision deterction issue.  I'll get back to that once I work out all these sounds and music.  

 

EDIT:   Oh, this worked!   To follow the concept of the 'state' as you pointed out above, I changed the code in my game to look like this:

Sorry, I did.  We crossed our streams! ?
 

1 hour ago, Mik's Arcade said:

play_plummet: PROCEDURE
    SOUND 2,37 + sound_state ,8
    SOUND 4,,$38    
    sound_state = sound_state + 1
    IF sound_state = 8 THEN sound_effect = 0

 

 

I also made the bullet fire better by doing this:

 


play_fire:    PROCEDURE
    SOUND 2,26,8 - sound_state / 4
    SOUND 4,5,$18
    sound_state = sound_state + 1
    IF sound_state = 32 THEN sound_effect = 0
    END

 

I'm figured out the math Oscar is doing and starting to get it....

The math is just to manipulate the parameters in a repeatable manner.

1 hour ago, Mik's Arcade said:

It's just like how I am controlling the movement on screen.  For the sound, I was trying to code the whole thing in one shot, but you take to take one step at a time. Basically, each 'index' in the tool is equivalent to one sound_state in the code called by ON FRAME GOSUB call.

Yep, you got it!

 

      -dZ.

  • Like 1
Link to comment
Share on other sites

yeah, I'm cranking now, so thanks for the help.

 

MUSIC, in my opinion, is even easier.

 

I just pulled out my bass and worked out the notes for what I wanted to play and the only thing to think about is getting the time signature right.

 

I've already written 2 of the short musical interludes and they sound great!!

  • Like 2
Link to comment
Share on other sites

12 minutes ago, Mik's Arcade said:

it's great how the game springs to life with music and sound. Now the game now longer looks, plays OR sounds like Pumpkin Master....LOL

I know, right?  It's almost like night and day.

 

You can spend weeks working on a game and you are sort of happy with it, and it feels ... fine.  And then you add music and sound effects and it just comes to life!  At that point it starts feeling like a real game. :)

 

(I remarked the exact same thing when I described my experience making Christmas Carol.)

 

     -dZ.

 

 

  • 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...