|
Post by JDTAY on Sept 21, 2009 14:14:32 GMT -5
I can use the psg command to play sounds, but I can't get it to stop playing. I tried psg 0,0, but it still plays a sound.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 21, 2009 16:58:53 GMT -5
Just like you have to turn up the volume to hear a sound, you should turn the volume back to 0 to "stop" ( mute ) a sound. Alternatively ( but not recommended ) you could set the frequency to -1 / 65535 which is a sound so high-pitched, nobody should be able to hear it On a side-note, it would be great to have some sound commands for the Yamaha YM2612 as well. No Megadrive / Genesis project is complete without its prolific FM chipset playing along
|
|
|
Post by TheMVRules on Oct 9, 2009 13:48:08 GMT -5
On a side-note, it would be great to have some sound commands for the Yamaha YM2612 as well. No Megadrive / Genesis project is complete without its prolific FM chipset playing along Shiru has made an FM music engine for BEX. Unfortunately, it doesn't work on real hardware.
|
|
|
Post by Alex Khan on Feb 11, 2010 4:16:57 GMT -5
Okay so how does it work if I were to take a wav file sound effect and how to convert to PSG format ?
Is there a conversion tool out there.
Or can I just play the raw wav file directly using this
psgvol 0,15 psg 3,1 psgvol 3,12 while 1 for a=200 to 1000 step 20 psg 0,a sleep 1 next for a=800 to 200 step -20 psg 0,a sleep 1 next wend
|
|
|
Post by TheMVRules on Feb 11, 2010 11:32:25 GMT -5
That would be too slow and your code would sound bad. But the PSG has a built in DAC, and it supports playing multiple samples simultaneous.
|
|
|
Post by Alex Khan on Feb 15, 2010 3:40:25 GMT -5
I found a tool called psgfx can I use this to convert wav files to psg and then play them back using the above code ?
DAC is digital to analog converter so the binary music file (In PSG format) is converted to analog signal making that sound effect on speakers ?
Am I on the right track MV ?
|
|
|
Post by GiGaBiTe on Feb 25, 2010 2:32:09 GMT -5
The PSG is incapable of playing PCM audio, it's just a 3 channel tone generator with a 4th channel as white noise (used for water falls, etc.)
You can only play PCM sound in 8 bit on the YM2612, and you'd have to write a driver to do that.
|
|
|
Post by TheMVRules on Feb 25, 2010 11:57:16 GMT -5
Then, explain Sonic 1 GG's SEGA sound. The PSG DAC was rarely used because of ROM space and the low quality. Some MD games used it too, but I can't remember which...
And the YM2612 plays 4-bit samples, not 8-bit.
|
|
|
Post by Mairtrus on Feb 25, 2010 17:10:20 GMT -5
In fact, both are wrong. The PSG can be used to play 4-bit samples at a maximun of 11Khz approximately (super low quality), and the YMH2612 plays 8-bit samples. It's atached a file with the proof of that. Use (A) to play at 8-bit or (B) to play at 4-bit the SEEEEGA sound (open it in Gens, in Fusion sounds kinda distorted when you play it in 4-bit mode) Attachments:
|
|
|
Post by ScroGer on Feb 25, 2010 18:22:44 GMT -5
Hey Mairtrus
How can I use the Segaaaa sound effect when starting my bex made games? I can display the sega logo but if I could sync it with the sound that would be cool..
|
|
|
Post by Mairtrus on Feb 26, 2010 8:45:50 GMT -5
Is really easy. Suposing you call it as a subroutine, it something like this: PlaySEGA: poke &hA04000,&h2B ' DAC enable register while peek(&hA04000).7 ' wait for busy wend poke &hA04001,&h80 ' the DAC is enabled now poke &hA04002,&hB6 ' set mode while peek(&hA04000).7 ' wait for busy wend poke &hA04003,&hC0 ' DAC is stereo now poke &hA04000,&h2A ' adress of the PCM info reload PCMData for a=1 to #PCMLongitude while peek(&hA04000).7 'wait for busy wend read Wave poke &hA04001, Wave ' put the data into the YMH2612 halt ' small delay next a return PCMData: DATAFILE segapcm.bin,BIN where #PCMLongitude is the real longitude of the SEEEEGAAAAA sound in bytes. Atached is the segapcm and it's 27000 bytes long. Attachments:
|
|
|
Post by theelf on Feb 26, 2010 11:57:44 GMT -5
Great!! now i can use wav in BEX!?
the segapcm.bin is a WAV PCM? i dont understand the format...
thanxs Mairtrus
|
|
|
Post by Mairtrus on Feb 26, 2010 16:14:42 GMT -5
Yes. Is a wav file in 8-bit mono mode, without the first 52 bytes. You can directly include wav files and load them with "reload PCMData,52". This sega sound is like 15700hz, but if you put another sound with another rate you will need to change the delay, like a small for...next, modify a variable or something.
|
|
|
Post by ScroGer on Feb 26, 2010 18:07:35 GMT -5
Awesome thanks Mairtrus
But I have a silly question, when I run the code I get a error message saying
"Can not find constant name! Constant MUST be defined first before it is used"
then "next a" is highlighted
How can I fix this?
|
|
|
Post by theelf on Feb 26, 2010 18:33:37 GMT -5
Hi ScroGer, add this to the code, works for me
Const #PCMLongitude = 27000
|
|