Sound in an IP.bin file

This is a forum for discussing the feasibility of getting emulators, games, or other applications that have had their source released ported to the Dreamcast. Please read the Porting FAQ before starting a topic in this forum!
User avatar
I.M. Weasel
Iron Muskateer Weasel
Posts: 2780
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Jan 04, 2002 4:45 am
Location: The city of the future, Los Braingeles
Has thanked: 1 time
Been thanked: 3 times
Contact:

Sound in an IP.bin file

Post by I.M. Weasel »

hola,

okay,as known you can insert a .mr binary image into the ip.bin booter file.

What about inserting an audio file in there instead?

the only problem would be how the code gets displayed on the "SEGA" boot screen,but is there a way to take the first part of the picture space (about 3-4k of 12k) and insert some graphic code to display the color white so the text of the audio file is not displayed?
:arrow: http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games

"You don't have to be forgiven. Clint Eastwood taught us that."
User avatar
toastman
Iron Fist of Justice
Iron Fist of Justice
Posts: 4933
Joined: Sat Nov 10, 2001 3:08 am
Location: New Orleans
Has thanked: 0
Been thanked: 0
Contact:

Post by toastman »

From what little I know about the IP.BIN (and it is little) what you are suggesting is impossible with either of the current IP.BINs. There is code there to display a graphic but not do anything else, in order to play a sound file, you would need to rewrite the IP.BIN and add in some sound player functions.
I don't think the IP.BIN is big enough.
No signature.
User avatar
I.M. Weasel
Iron Muskateer Weasel
Posts: 2780
Joined: Fri Jan 04, 2002 4:45 am
Location: The city of the future, Los Braingeles
Has thanked: 1 time
Been thanked: 3 times
Contact:

Post by I.M. Weasel »

gotcha,I would have to write in a mini-audio player?
:arrow: http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games

"You don't have to be forgiven. Clint Eastwood taught us that."
User avatar
toastman
Iron Fist of Justice
Iron Fist of Justice
Posts: 4933
Joined: Sat Nov 10, 2001 3:08 am
Location: New Orleans
Has thanked: 0
Been thanked: 0
Contact:

Post by toastman »

Pretty much, yeah.
No signature.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

It'd be possible, but you'd have to find some space in the IP.BIN file to put it. As far as I know, the only free space would be used up by the image, with maybe a little to spare. But that's not a lot of space for sound samples, even compressed ones, just a few kilobytes. And I don't know if it'd be possible to stop the sound data from being displayed - it depends on the image format it's stored in.

You could probably get the DC to play a sound with a few hundered bytes of assembley, but you might only get a second or so of very low quality sound. And you'd have to be really good for that to work.
Sanchez
DCEmu Ex-Admin
DCEmu Ex-Admin
Posts: 1098
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by Sanchez »

ok, this is off topic, but it must be said...

He can do it because:

HE.... IS.... WEASEL!
"This is worse than when the Raccoon got in the copier!"
bizzle
Has thanked: 0
Been thanked: 0

Post by bizzle »

maybe like little beep or like a little ring.

Sounds very interesting. I wish i had the programming talent to work on something like this.
User avatar
I.M. Weasel
Iron Muskateer Weasel
Posts: 2780
Joined: Fri Jan 04, 2002 4:45 am
Location: The city of the future, Los Braingeles
Has thanked: 1 time
Been thanked: 3 times
Contact:

Post by I.M. Weasel »

hmm,only assembly code. doesnt the DC have a built in software audio player?

This is off topic?

no matters
because

I..M..Weasel!!!
:arrow: http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games

"You don't have to be forgiven. Clint Eastwood taught us that."
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

The DC has built-in, fairly complex sound hardware. Basically, you'd have to do something like this (in asm, not English):

Shut down AICA/ARM
Copy a dummy program to Sound RAM
Copy sample data to Sound RAM
Initialise the AICA/ARM
Set up the sound registers
Start the sound playing
Keep getting status, until the sound has finished
Reset the sound hardware
Set up the SH-4 and stack, like the IP.BIN is supposed to do
Jump to the main program
User avatar
JMD
Insane DCEmu
Insane DCEmu
Posts: 234
Joined: Wed Dec 11, 2002 6:45 am
Location: A Melody From a Past Life Keeps Pulling Me Back
Has thanked: 0
Been thanked: 0
Contact:

Post by JMD »

what about playing sounds from the internal general Midi bank ?

I think DC have a built in wavetable and using it will take less bytes. no ?
Image
There is the theory of Möbius. A twist in the fabric of space where time becomes a loop
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

There's an internal GM bank? I wasn't aware of one.

If it did have an internal bank, and you used it, then you'd just have to include the playback code, which would be much simpler. But you'd just get a note, maybe a very simple, two-second bit of music. Maybe like the sound that comes up with the SEGA logo on the older Master Systems.

I'll have to see if I can find any info on the DC's sound hardware. If it does have an internal GM sound bank, it could be very useful.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

Without the image bit, there's 18KB of free space in the IP.BIN file, which is for bootstraps 1 and 2. Basically, they are executed by the DC's BIOS, in order, and they are supposed to set up the SH-4 and reset the stack, then jump to 1st_read.bin (which has been preloaded by the BIOS). That'd probably leave you with, at most, 15KB or so for a sound sample.

Assuming that you want to use 4-bit ADPCM for encoding, and in mono, you'd get about 2.7 seconds of audio at 11025Hz, 1.4 seconds at 22050Hz, and 0.7 seconds at 44100Hz.

I don't know where the image is stored, but it's probably in the huge blank area in the Sega licence information section, and you could theoretically use that area for extra samples, if you didn't mind the graphics synthesiser.

Wow... There's more space in that file than I thought. Basically, you have 18KB of space to fill, and ASM code tends to be very small, so most of that can probably be filled with data. You could probably fit a game in there.
User avatar
I.M. Weasel
Iron Muskateer Weasel
Posts: 2780
Joined: Fri Jan 04, 2002 4:45 am
Location: The city of the future, Los Braingeles
Has thanked: 1 time
Been thanked: 3 times
Contact:

Post by I.M. Weasel »

BlackAura wrote:There's an internal GM bank? I wasn't aware of one.

If it did have an internal bank, and you used it, then you'd just have to include the playback code, which would be much simpler. But you'd just get a note, maybe a very simple, two-second bit of music. Maybe like the sound that comes up with the SEGA logo on the older Master Systems.

I'll have to see if I can find any info on the DC's sound hardware. If it does have an internal GM sound bank, it could be very useful.
yeah i was thinking a tiny sound byte,just like the sega logo.
:arrow: http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games

"You don't have to be forgiven. Clint Eastwood taught us that."
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

I've got a program to play a small piece of music - it's 7KB, and most of that's the ARM program code. Provided you don't mind shuffling things around, you can play a very, very short sound sample. If you can rewrite the whiole IP.BIN, you could probably get a good two seconds of audio in there, at the expense of the logo thingy.

Actually, I could possibly fit a CDFS driver in there, and load extra stuff off the disc, including a small sound file. That'd make it even easier.
User avatar
I.M. Weasel
Iron Muskateer Weasel
Posts: 2780
Joined: Fri Jan 04, 2002 4:45 am
Location: The city of the future, Los Braingeles
Has thanked: 1 time
Been thanked: 3 times
Contact:

Post by I.M. Weasel »

well then captain,give it a shot . im all ears
:arrow: http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games

"You don't have to be forgiven. Clint Eastwood taught us that."
User avatar
burnerO
DC Developer
DC Developer
Posts: 801
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by burnerO »

Here are some Sega wavs that fit your requirements, 4bit mono 11hz-44hz, that range from 3-12kb.

http://consolevision.com/members/burner ... ega!11.wav
http://consolevision.com/members/burner ... ega!22.wav
http://consolevision.com/members/burner ... ega!44.wav
http://consolevision.com/members/burner ... sega11.wav

"I don't know where the image is stored"
It's at offset 14368.

Additionally, you might check out the file http://boob.co.uk/files/ipfull.tgz
It's Lienus's work with the Ip.bin.

Now make the Ip.bin scream Sega! :P
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

It might be to compact it into a small enough space that it'll fit into an IP.BIN file, along with a WAV file. I've looked at Lienus's IP.BIN, and I can see what goes where. There's two spaces - where the image file is stores (inside Bootstrap 1, a huge blank area's left for it), and after Bootstrap 2, which is a lot smaller but never used for anything.

I just need a way of delaying the IP.BIN, so it doesn't jump to the main program before the sound's finished playing.

Still researching it, and I need to find a way of loading an IP.BIN to test, but without having to burn a fresh selfboot CD each time.
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

what about one of those DC emulators i remember one booted the ip bins once
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
I.M. Weasel
Iron Muskateer Weasel
Posts: 2780
Joined: Fri Jan 04, 2002 4:45 am
Location: The city of the future, Los Braingeles
Has thanked: 1 time
Been thanked: 3 times
Contact:

Post by I.M. Weasel »

BlackAura wrote:It might be to compact it into a small enough space that it'll fit into an IP.BIN file, along with a WAV file. I've looked at Lienus's IP.BIN, and I can see what goes where. There's two spaces - where the image file is stores (inside Bootstrap 1, a huge blank area's left for it), and after Bootstrap 2, which is a lot smaller but never used for anything.

I just need a way of delaying the IP.BIN, so it doesn't jump to the main program before the sound's finished playing.

Still researching it, and I need to find a way of loading an IP.BIN to test, but without having to burn a fresh selfboot CD each time.
isn't there a smiply stall command, in applescript "delay' is used [delay (5)].
or maybe you could loop for the length of the sound byte for x seconds
while (x != length of soundbyte)
{
++ in seconds
}
but you probably would need added code to calculate seconds,i dunno.


and is there something like a modified version of dc_load that will attempt to load the ip.bin ? If the 1st_read.bin file is a binary file as well, could you just choose to load the ip.bin file instead?
:arrow: http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games

"You don't have to be forgiven. Clint Eastwood taught us that."
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

There is in KOS, but I can't use KOS in an IP.BIN file, because KOS is much, much too large. And the IP.BIN file is loaded at a different place in memory. I could probably write a 1ST_READ.BIN that loaded a new IP.BIN into memory, and ran that, then test that on the DC.

Reaper - They do, but not reliably. The only ones I have don't do sound either.
Post Reply