Jump to content
IGNORED

MidiJoy - Using your Atari as a Chiptune-instrument


freetz

Recommended Posts

This is amazing. Time to go to Radio Shack and get parts. :)

 

Now, here are a couple of possibilities:

 

1. Some enterprising programmer needs to write software for the Commodore 64/128, Atari 2600, Atari 7800, Sega Master System, Sega Genesis, or any other systems which use DB-9 connectors, that can take advantage of this interface.

 

2. Avery might do well to write a MidiJoy emulator which can read signals from any PC-MIDI interface, and translate it into data which can be read by the emulated joystick ports on the Altirra emulator. This would essentially turn Altirra into a MIDI controlled Atari POKEY softsynth. :)

  • Like 1
Link to comment
Share on other sites

Yes, it is entirely possible to port MidiJoy to other DB-9 based systems, in fact I have written a small proof-of-concept program for the C64 (my first one for that computer actually). You can find a demo video on my website as well.

 

As for Altirra or Atari800MacX, I'd love for these emulators to input from serial ports and map them to an Atari interface (such as joystick ports). That would make debugging hardware much easier, not only for MidiJoy. However, what you would like to achieve can be done (if I'm not mistaken) with Raster Music Tracker on PC (and Mac probably, too), because RMT is Midi capable. So if all you want is to generate sound that sounds _like_ POKEY, RMT would probably be easier than using an emulator. But if you want _real_ POKEY music, MidiJoy would be your choice :)...

Edited by freetz
Link to comment
Share on other sites

  • 1 month later...

I have created a PCB-version of my MidiJoy interface which also is ready for "classic" serial Midi input. I'll put up the Gerber files online soon, so you can manufacture your own. However, since minimum order for this test run was 10 pieces, I have a few spare sets (Teensy microcontroller not included) which I would give away for material costs. PM me if you are interested.

post-38620-0-79082600-1417705937_thumb.jpg

Link to comment
Share on other sites

I have added a very simple sample code on my website which shows the basic structure of the MidiJoy software. It should be easy to translate this code to computers/consoles other than the Atari or C64. At the same time, the interface could stay as it is, so hopefully the devices that can be used as instruments will increase in the future :).
BTW, there are still a few PCBs left, in case someone is still interested...

Link to comment
Share on other sites

  • 2 weeks later...

To all MidiJoy users:

 

I have adjusted the firmware for the Teensy microcontroller in a way that there is no longer a 5V current on the joystick pins. While this generally shouldn't cause harm to the Atari, it's better to play safe. Instructions for updating the firmware as well as the most recent firmware version can be found on my website.

 

F.

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

I just got my Midijoy working and it is really fantastic!

 

I am using Cakewalk Sonar software on my PC DAW interfacing to my 800XL and my 130XE both. Pretty cool.

 

I also started exploring playback possibilities using the MJPVBI and MJPLAYER programs included with midi joy. And also looking at how the data is parsed in memory. It is nice to see that the data is stored in a very intuitive format.

 

As for the playback options available, I have not yet found a straightforward way to incorporate the output data into an Atari program so it can be used as background music, sound effects, etc.

 

What I was hoping to do is capture a segment of midi music in midijoy ( let's say about 20 seconds for example ).

- Then from a game program I want to load that into memory.

- And then be able to trigger it to begin from the program.

- I want that 20 second segment to loop endlessly until I trigger it to stop from the program.

- I want to be able to start/stop that loop from playing based on different events in the program.

 

Most likely I will want it to always start from the beginning of the segment each time it is triggered (and then continue to loop until stopped). But I could also see the need to have it continue from where it was previously stopped instead of at the beginning.

 

And of course, I would want to do this in such a way that the rest of the game program keeps executing while the sound loop plays in the background.

 

Is it possible? And if something like that has already been done in terms of a playback utility that can be incorporated into other programs, even better!

 

My ultimate goal would be to have everything self-contained inside of one program ( so the data could be loaded and the player could be incorporated into the program as well) if possible.

 

By the way, I am using Turbo Basic XL as the "base" of my program with many USR calls to machine language routines throughout. So, again, hoping I can incorporate what I am trying to do into that context.

 

Any assistance or advice would be GREATLY GREATLY appreciated!!

 

Ok, back to experimenting with midijoy... seems there are a lot of possibilities here! :)

 

-Eric

Link to comment
Share on other sites

Hi Eric,

 

thank you for your kind feedback - and I think/hope that most of what you want to achieve should be possible with MidiJoy:

 

First of all, MidiJoy was designed for the purpose you want, i.e. re-using your recorded songs in your own programs/games. So basically all you need to do in Turbo-Basic is to BLOAD the VBI player, then BLOAD the recorded song-data and then you can use the command

X=USR($600,$5000,$whereever_your_song_ends)

to start playback of your recorded song in the background. This assumes that the song data begins at $5000. If you want to begin playback at a later position, just increase the value of $5000 accordingly. The current song position is stored in $CD/$CE (low/high), so if you do a

10 PRINT PEEK($CE)*256+PEEK($CD):GOTO 10

while the song plays back, you can see the corresponding value you would need to use in the USR command.

If you want to stop/pause playback, simply enter

POKE 207,0:FOR X=0 TO 3:SOUND X,0,0,0:NEXT X

and continue playing with

POKE 207,1

If you want to loop playback, you would have to modify the VBI playback routine slightly (the source code is on my website). You'd need to replace the "exitplayer" section to do a reset of the player pointer to its original value, written from my head it would be something like this:

exitplay lda #$00       ; low byte of starting position
         sta $cd
         lda #$50       ; high byte of starting position
         sta $ce

Then you would need to use abovementioned "pause" function POKE to interrupt/resume playback.

 

Please keep in mind that recorded song data is always saved from $5000 onwards, due to the fact that DOS and MidiJoy uses the lower parts of memory during recording. You might want to relocate the saved song data to a lower RAM segment in order to have enough memory for your own program. This could be done by loading song data to $5000 first, then use Turbo-Basic's MOVE command to move it to, say, $3400 (or any other place right above the DOS of your choice) and then BSAVE it again using the appropriate length (i.e. if it song data was from $5000 to $5a00 before, you would BSAVE from $3400 to $3e00 after moving it to $3400). Then next time you won't have to worry about loading song data corrupting your BASIC program. That is, of course, if you set MEMLO ($2e7/$2e8) accordingly to $3e00 in this example. Any BASIC program will then begin at $3e00 only and therefore leave your song data intact - and vice versa.

 

Hope this helps, and once you have a piece of software ready that was done with the help of MidiJoy, I'd be happy to link to it from my project page!

 

F.

Edited by freetz
Link to comment
Share on other sites

Great information ! Thanks! Makes sense and thanks for pointing out the source code for the vbi playback on your website.

 

Right now I am working on some other features of the project so I probably won't get back to the sound/music for a while.

 

This seems like it will work for what I am wanting to do though.

 

I'll let you know when I get to that point. :)

 

-Eric

Link to comment
Share on other sites

Hi Eric,

 

thank you for your kind feedback - and I think/hope that most of what you want to achieve should be possible with MidiJoy:

 

First of all, MidiJoy was designed for the purpose you want, i.e. re-using your recorded songs in your own programs/games. So basically all you need to do in Turbo-Basic is to BLOAD the VBI player, then BLOAD the recorded song-data and then you can use the command

X=USR($600,$5000,$whereever_your_song_ends)

to start playback of your recorded song in the background. This assumes that the song data begins at $5000. If you want to begin playback at a later position, just increase the value of $5000 accordingly. The current song position is stored in $CD/$CE (low/high), so if you do a

10 PRINT PEEK($CE)*256+PEEK($CD):GOTO 10

while the song plays back, you can see the corresponding value you would need to use in the USR command.

If you want to stop/pause playback, simply enter

POKE 207,0:FOR X=0 TO 3:SOUND X,0,0,0:NEXT X

and continue playing with

POKE 207,1

If you want to loop playback, you would have to modify the VBI playback routine slightly (the source code is on my website). You'd need to replace the "exitplayer" section to do a reset of the player pointer to its original value, written from my head it would be something like this:

exitplay lda #$00       ; low byte of starting position
         sta $cd
         lda #$50       ; high byte of starting position
         sta $ce

Then you would need to use abovementioned "pause" function POKE to interrupt/resume playback.

 

Please keep in mind that recorded song data is always saved from $5000 onwards, due to the fact that DOS and MidiJoy uses the lower parts of memory during recording. You might want to relocate the saved song data to a lower RAM segment in order to have enough memory for your own program. This could be done by loading song data to $5000 first, then use Turbo-Basic's MOVE command to move it to, say, $3400 (or any other place right above the DOS of your choice) and then BSAVE it again using the appropriate length (i.e. if it song data was from $5000 to $5a00 before, you would BSAVE from $3400 to $3e00 after moving it to $3400). Then next time you won't have to worry about loading song data corrupting your BASIC program. That is, of course, if you set MEMLO ($2e7/$2e8) accordingly to $3e00 in this example. Any BASIC program will then begin at $3e00 only and therefore leave your song data intact - and vice versa.

 

Hope this helps, and once you have a piece of software ready that was done with the help of MidiJoy, I'd be happy to link to it from my project page!

 

F.

 

I wanted to try to get the looping working so I tried what you said above. I know you said it was just from your memory but it didn't work.

 

So, I changed it as follows...

exitplay lda #$00 ; low byte of starting position
sta PLAYPTR
lda #$50 ; high byte of starting position
sta PLAYPTR+1
jmp doplay
This "almost works". :)
What it does is it starts the loop again but seems to skip a few seconds before playing again (and misses several of the beginning notes).
Do you know what needs to be changed to make that work correctly?
thanks,
-Eric
Link to comment
Share on other sites

I'm in Beijing right now and thus don't have my Atari nor MidiJoy with me ;), but again just from looking at the code, this might hopefully do the trick:

exitplay    ldy #3
cleartimer2 lda #0
            sta NOTETIMER,y
            dey
            bpl cleartimer2
            lda #$00 ; low byte of starting position
            sta $cd
            lda #$50 ; high byte of starting position
            sta $ce

That's about the only other thing the init-routine does when it is called from the USR-command. Let me know if this works and in that case I'll add a fourth parameter to the USR command allowing for a loop flag.

 

[EDIT: Small bugfix]

F.

Edited by freetz
Link to comment
Share on other sites

thanks for that quick response...even from Beijing!

 

Ok, so yes this does loop now.

 

However, it has a bit of a pause and the end before starting over. Probably because the code you added clears out all of the values of NOTETIMER before it can start again.

 

Do you think there is a way to make it a more seamless loop? What if the NOTETIMER values were restored back to zero as the playback executes (cleaning up after itself with each note played) instead of having to do it all in one re-initialization loop at the end?

Link to comment
Share on other sites

The cleaning up at the end of the song only takes fractions of a second. In fact, the whole playback routine takes less than 1/50 of a second because this is the maximum length of a VBI run (1/60 in NTSC machines). I assume the reason for this pause to be in the amount of time it took you to stop the recording after playing your last note. You could check that by recording a second track (or using the demo songs) and see whether the pause varies between these two recordings when played back in a loop. If it does, then that's the reason. Another thing to check is whether the pause stays (or stays the same length) when you lower the third parameter in the USR command (the end of song data) by a multiple of 5 bytes. Let me know what/if that changes anything.

Link to comment
Share on other sites

  • 1 month later...
  • 4 years later...

Hey ...

 

Just found your project and it looks really interesting.  Had thought about rewriting your software to run on the Atari 7800.  It would likely go on a POKEY enabled cart and use TIA and POKEY both.  What joystick registers are used by your hardware, and how are the midi functions mapped?

 

Also ... I have updated the pokey note table significantly... i have note tables for $2x and $4x (two iterations) in 1.79 mhz mode, $8x in 16-bit mode using 9-bit polycounter,  and also $2x, $4x (two tables), $Ax, $Cx (two tables) in 16-bit mode.  Attaching a link below in case you wanted to update your software 

 

 

  • Like 2
Link to comment
Share on other sites

  • 6 months later...
  • 2 weeks later...

@Hand baked: MidiJoy works so far only with the MidiJoy software, see here: http://www.phobotron.de/midijoy_en.html

There are still boards available if your are interested, just send me an e-mail to midijoy (ät) phobotron.de

 

@Synthpopalooza: I'm SO sorry for the long delay, I must have overlooked the notification. I use both joysticks and all 10 Bits (four directions plus fire). The mappings are explained on the project website as well: http://www.phobotron.de/midijoy_en.html#OtherSystems

I'm about to release the source code soon on GitHub so you could take it from there.

Thanks also for the updated table, I'm sure to include it once I find time to work more closely on this project - or leave it to someone else once I have put it up on GitHub.

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