Omnimaga
Calculator Community => Casio Calculators => Topic started by: MPoupe on February 23, 2012, 03:55:14 am
-
Hello,
I wrote simple program demonstrating audio output on Casio fx cg 20.
Usage:
create wav from your favorite music, PCM,11025 Hz,8 bit,mono and store to the calculator's flash memory as demo.wav.
Copy CGPlayerA.g3a from the attachment here too.
Run it.
As you can see the program is very simple, it uses safe part of the user's stack to load about 450KB of the wav file (so the file doesn't need to be larger). Then it converts the samples and outputs by syscalls.
To be improved:
- increase speed of COM port, 115200 (maximum for syscall) is too slow
- output data asynchronously.
Unfortunately I do not know CPU enough to do it. :-(
Can somebody help ?
-
See fx_calculators_SuperH_based_10.chm
(http://ourl.ca/8207/238670).
Try topic: fx-CG20...Registers, MPU...Accessing the 3pin serial lines directly
Perhaps it helps.
-
I'll try later tonight MPoupe.
-
See fx_calculators_SuperH_based_10.chm
(http://ourl.ca/8207/238670).
Try topic: fx-CG20...Registers, MPU...Accessing the 3pin serial lines directly
Perhaps it helps.
Thank you, of course I use your manual :-)
I will try to use 7730.h header (http://pastebin.com/xiyV8CZs)
-
I will try to use 7730.h header (http://pastebin.com/xiyV8CZs)
Be careful with this. 7730 register addresses and bit-assignments are not necessarily compatible with the 7305.
-
Sound like a cool Idea. Might try it later. I did it and it is really quiet to my ears. Good enough for me though. ;D ;D ;D ;D ;D ;D
-
Does it work for cg10?
-
I'll try. Yay my Prizm could be a wav player. Also is it hard to implement some sort of OGG/MP3 compression?
-
only one ear gives sound, like fx9860?
the volume is the same as 9860 or is lower?
I can only test the player at the weekend, because now I have no headset compatible.
-
It works fine on the fx-CG10. There's a lot of interferences though, and it stops just before the first chorus of Never Gonna Give You Up.
-
Ok I tried it and I was surprised because the volume is much louder than on the FX-9860G and the TI-84 Plus it seems. :O
There is a bit more noise than on those devices, but it's not too bad on my side it seems. And yeah I had the sound stopping issue too. I loaded in a 1:27 song and it stopped around 30 secs.
Btw I like how much easier it is to listen to calc music with this software than it was with other calc ones. On the 84+ you must open command prompt to convert a wav file to 8xk and stuff like that, and on the 9860G you must use an annoying linking software (FA-124). On the Prizm we don't even need to change the wav extension.
Good job so far. :)
-
Yes I agree. It is a lot easier. NO MORE HASSLE! It does stop after 30 seconds. That part disappointed me. :( Hopefully he can fix that.
-
Hmm... looks cool. I'll have to give it a try when I have a moment. :D
-
-
Video Response: Do you have a CG 10 or a CG 20? I have a CG10 and it isn't that good.
-
Hello, thank you for testing.
The noisy is expected, the D/A frequency is only 115200 bps (fxPlayer uses 1.8 Mbps), I will improve it after I find how.
The 30 seconds duration is also expected and I wrote it in the initial post. The player is synchronous so it loads piece of sound and then it plays (outputs bytes in a loop). I will improve it after I find how to do asynchronous output.
The direct wav support seems to be advantage, but due to limited storage I think I will create more space-saving format.
I think it will use only 4 bit samples so it will have 1/2 of the wav length.
-
Yeah it might be good if there was a different format that was compressed. Would the calculator be fast enough to decompress it while playing, though?
-
Yeah it might be good if there was a different format that was compressed. Would the calculator be fast enough to decompress it while playing, though?
I plan to try mp3, but i am afraid it will be too slow.
-
NOw make a chiptune tracker! :p
Does it takes many proc power?
-
It would be nice indeed. Something else that I wonder if it's possible is a MIDI player. Would the calc be fast enough to play multiple instruments at once?
-
Video Response: Do you have a CG 10 or a CG 20? I have a CG10 and it isn't that good.
CG10. It might be because I recorded while putting the headphone speaker right next to the iPod Touch mic, so this alters the quality a bit and we hear the distortion less. I would have recorded the sound directly on my computer, but I can't find my 3.5mm to 3.5mm cable and I think the quality would be even worse.
Also the distortion is less perceptible on certain headphones.
Sorry btw I didn't notice your comment until now.
-
That's okay.....
-
Hello, this is updated version of the wave player.
Changes:
- COM speed increased 4x (to 460800), so it is 1/4 of COM speed used by fxPlayer. This means sound quality is better, but do not expect miracles. I was able to directly access the sio registers (thank you Simon :-) ), but it seems the serial port is less powerful compared to the one in 9860G (one speed register is missing and fifo is only 16 B).
- player remained synchronous, but it is able to play the whole wav - it creates the map of the file in flash and while playing it reads the file from flash directly (see source for details)
I am not sure I will be able to increase the sound quality, I thing I touch the HW limits.
-
It plays better quality, but it isn't very loud. It's awesome. Just keep making upgrades.
-
It plays better quality, but it isn't very loud. It's awesome. Just keep making upgrades.
Thank you for testing.
The output could be slightly louder, but I am afraid that quality would decrease.
To make it louder, open cgplayer.c, change line 211:
giSubSample = gpBuffer[giBufIndex] >> 4;
to
giSubSample = gpBuffer[giBufIndex] >> 3;
I hope it will work, I cannot test it just now.
-
hi i have a THEORY (only theory) to improve audio player
the ea-200/e-cons2 using the communication system by cable sb-62 (calc-to-calc cable), and is compatible with the Prizm
(http://img833.imageshack.us/img833/9633/img10z.jpg)
it may be possible to find another syscall in this app to improve sound quality or write to RX pin
EDITED:
EA-200 have sound & speaker, calculator group link, etc :o
(http://img714.imageshack.us/img714/7898/ea200.jpg)
http://edu.casio.com/products/peripheral/ea200/
-
Wow the new version sounds much better, despite being less loud. It's still louder than most other audio programs though. Also it's nice to hear entire songs play now. :D
Now to find my computer cable...
-
I tried converting Nyan Cat, but it plays back as high pitched sound. Only when I plug it into my stereo system and turn up the volume 3/4 of the way, I could hear the song. However, that song is also high pitched as well... :P
I'm not too sure if this is converted right. The file size is 2.27 MBs for 3:36 of music.
Is this a bug or a problem on my side? I own a CG-10.
This is my demo.wav: http://dl.dropbox.com/u/1016340/demo.wav
-
It could be because your song was not maxed out, volume-wise. In Audacity you need to increase its volume (amplification) so it's loud enough, else the static produced by the calc will drown the song.
Also I finally found my 3.5mm to 3.5mm cable (and I got my 2.5mm adapter) so I could finally record the calc audio directly to the computer. This is how La Porte du Soleil sounds like on-calc:
http://djomni.57o9.org/prizmlaportedusoleil.mp3
Original song:
-
Hey! I know that muzik! :p
That looks goods anyway, but a bit noisy...
-
How do you record music from your calc to the computer? I have a 3.5 to 3.5 cord and a 2.5 adapter.
-
1.Put the adaptater inside your calc
2.Put the other jack on the Microphone port (the pink/red)
3.Record with good old windows Recorder, or else
4?
5. Profit
-
It could be because your song was not maxed out, volume-wise. In Audacity you need to increase its volume (amplification) so it's loud enough, else the static produced by the calc will drown the song.
Nope, I did a full amplification in Audacity, and even allowed clipping.
-
Any progress? Any new features? MPoupe, you need to add a pause function so if you want to get out during the song, you can.
-
Any progress? Any new features? MPoupe, you need to add a pause function so if you want to get out during the song, you can.
No, I had no time to implement anything :-(
BTW: Feel free to modify the player and add any functionality you need (pause included :-) )
-
Here is the CGPlayer with an Overclocked Prizm:
Original Song:
-
Well sorry for the massive bump but I did a little quick work on this and was able to improve the quality simply by using a new algorithm. It is louder and of higher quality with a small side effect of a quite high pitch noise which can be easily solved with an RC low pass filter and/or faster baud rate. I have some recordings as I have a 2.5mm to 3.5mm cable if anyone wants to hear a comparison. Binary:
https://github.com/ComputerNerd/CGplayer/blob/master/CGplayer.g3a
Source: https://github.com/ComputerNerd/CGplayer/blob/master/src/main.c
And for those who don't want to bother clicking on the link here is the new algorithm it is more simple that what was originally used.
unsigned samp=gpBuffer[giBufIndex++]>>3;
if(giBufIndex>=giLength)
return;
unsigned x;
for(x=0;x<4;++x){
if(samp>7){
SCIF2.SCFTDR=255;
samp-=8;
}else{
SCIF2.SCFTDR=ptab[samp];
samp=0;
}
while((SCIF2.SCFDR.WORD >> 8)>=15);
}
Also it uses this table
static const unsigned char ptab[]={0,1,3,7,15,31,63,127};
-
Interesting, I will have to find my cable to hear how it sounds like now. :)
-
Alright tell me how it sounds.