A blogspot journal showcasing computer programming, personal development, and other hobbies. Featuring Raspberry Pi, Petit Computer, and miscellaneous How-To.
Tuesday, December 31, 2013
Raspberry Pi Journal #43
Speech Synthesis Trouble
I'm having a hard time coming up with proper speech synthesis. I tried using espeak, and it seems to work, but the first few seconds was off as if having buffer underflow, and the last few seconds was slow, as if it's having buffer overflow. Tried festival, and that too, suffers from the same problem.
As a last resort, I installed Basic256, and use its "say" command. The speech was clear and concise. Unfortunately, the buffer overflow problem is still happening. So, in the end I gave up.
I think the problem does not lie in the speech program. After all, all the speech module does is chaining snippets of audio to make the speech. I don't see any problem in that regard. It's the audio driver that is a problem. Apparently, the buffer isn't set up properly and so the audio becomes scrambled.
It should be possible that the audio be working fine. After all, I don't see any trouble regarding audio in playing movies.
Monday, December 30, 2013
Cooking Journal #19
Exotic Butter
I usually just pick up the butter substitute. However, when I was wandering over to the butter section, I saw this butter, and I can't resist. It's certainly unique, and I'm glad I tasted this one. Something like a specially made butter. Not too sure that I have use for special ingredient, though. Yes, it's better. No, it's not so much better that I want to hunt this specific butter.
Saturday, December 28, 2013
Nintendo Journal #19
Craftsman Drill
I love this tool. I even use it around the house! Install this, install that. This is my first go to tool. It has light, auto tension, and all around a good tool.
Of course, the magazine review makes it only a so-so value. But I really don't care. This one is good enough for me.
Friday, December 27, 2013
Petit Computer Journal #31
Digital Koto
A while back, I wrote a little piano program. It includes song player. It's just a little simple music player, so I used BEEP instead of MML command. However, I'm rather curious since most of the code is created for the interface. In other words, drawing the piano keys. So, I'm wondering whether or not it's simpler to just draw the keys straight. Well, what kind of musical instrument is like that? The answer is simple: Japanese Koto. In truth, different cultures have different ideas and names for what basically amounts to a bunch of strings mounted on a board.
Still, the idea of it is interesting, and it's simple enough for me to do. So, let' do it! There are several different parts, but generally speaking, once you touch the screen, you come up with a string number and beep the appropriate sound. That's just look up table. Touch screen is easy. About the only thing that's difficult is drawing the strings proportionately. A little mathematic should do it.
- INIT
- Build BEEP table
- Build Note table
- Build String table
- LOOP
- Draw Strings
- If Touch screen
- Highlight nearest string
- Play BEEP sound
- GOTO LOOP
So, do you think this will take you one hour to do? Time for another "Hour of Code" challenge!
- ACLS:CLEAR
- DIM BP[49]:'BEEP TABLE
- DIM NT$[49]:'NOTE TABLE
- DIM ST[16]:'STRING TABLE
- BREPEAT 0,60,12
- BREPEAT 1,60,12
- BREPEAT 2,60,12
- BREPEAT 3,60,12
- @INIT
- NSI=0
- P=4096/12:T$="CcDdEFfGgAaB"
- FOR I=-24 TO 24:J=I+24
- BP[J]=P*I
- NT$[J]=MID$(T$,(J%12),1)
- NEXT
- ST[0]=14:ST[1]=19
- ST[2]=21:ST[3]=22
- ST[4]=26:ST[5]=27
- ST[6]=31:ST[7]=33
- ST[8]=34:ST[9]=38
- ST[10]=39:ST[11]=43
- ST[12]=45:ST[13]=0
- ST[14]=0:ST[15]=0
- ACLS
That's about it for the Initialization table. I want to fiddle with the string, so I'll put in button interface so I can change the string values on the fly.
- @LOOP
- NS=13:A=256/NS:B=A/2
- VSYNC 1:BT=BTRIG():TX=FLOOR(TCHX*NS/256)
- IF NS<1 THEN NS=1
- FOR I=0 TO NS-1
- GLINE B+I*A,16,B+I*A,192,15
- LOCATE (B+I*A)/8,0:?FLOOR(ST[I]/12)
- LOCATE (B+I*A)/8,0:?NT$[ST[I]]
- NEXT
- GLINE B+TX*A,16,B+TX*A,192,8
- IF TCHTIME>0 THEN BEEP 20,BP[ST[TX]]
- GOTO @LOOP
And that's about it. 35 minutes so far, and that's because I was having trouble with the math. The truth is, had I did the math correctly beforehand, I wouldn't have had so much trouble and I wouldn't have spend the time debugging.
Oh, yeah, about the tuning on the fly. I think that it is nice to be able to change the notes. So, what I'll do is add some button interface. That's what the BREPEAT command is for. Also, I may as well throw the instrument along with it. Instead of the locked in BEEP 20, I substitute it with a variable that will allow you to choose your own instrument.
Finally, we're going to move the whole thing down to the lower screen for ease of play. What should we put on the top of the screen? I don't know. Title screen, maybe? Or some internal variables?
- REM DIGITAL KOTO
- REM BY HARRY HARDJONO
- REM DEC 2013
- ACLS:CLEAR
- DIM BP[49]:'BEEP TABLE
- DIM NT$[49]:'NOTE TABLE
- DIM ST[16]:'STRING TABLE
- BREPEAT 0,60,12
- BREPEAT 1,60,12
- BREPEAT 2,60,12
- BREPEAT 3,60,12
- PNLTYPE "OFF"
- @INIT
- NSI=0
- CI=16:'CURRENT INSTRUMENT
- P=4096/12:T$="CcDdEFfGgAaB"
- FOR I=-24 TO 24:J=I+24
- BP[J]=P*I
- NT$[J]=MID$(T$,(J%12),1)
- NEXT
- ST[0]=14:ST[1]=19
- ST[2]=21:ST[3]=22
- ST[4]=26:ST[5]=27
- ST[6]=31:ST[7]=33
- ST[8]=34:ST[9]=38
- ST[10]=39:ST[11]=43
- ST[12]=45:ST[13]=0
- ST[14]=0:ST[15]=0
- GPAGE 1:ACLS
- @LOOP
- NS=13:A=256/NS:B=A/2
- VSYNC 1:BT=BTRIG():TX=FLOOR(TCHX*NS/256)
- IF NS<1 THEN NS=1
- GPAGE 1,1,1
- FOR I=0 TO NS-1
- GLINE B+I*A,16,B+I*A,192,15
- LOCATE (B+I*A)/8,0:?FLOOR(ST[I]/12)
- LOCATE (B+I*A)/8,0:?NT$[ST[I]]
- NEXT
- GLINE B+TX*A,16,B+TX*A,192,8
- IF TCHTIME>0 THEN BEEP CI,BP[ST[TX]]
- IF BT AND 1 THEN ST[NSI]=ST[NSI]+1
- IF BT AND 2 THEN ST[NSI]=ST[NSI]-1
- IF BT AND 4 THEN NSI=NSI-1
- IF BT AND 8 THEN NSI=NSI+1
- IF BT AND 16 THEN CI=CI+1:GOSUB @DISP
- IF BT AND 32 THEN CI=CI-1:GOSUB @DISP
- NSI=(NSI+NS)%NS
- ST[NSI]=(ST[NSI]+49)%49
- CI=(CI+70)%70
- GOTO @LOOP
- @DISP
- ACLS
- ?"INST: ";CI
- FOR I=0 TO 15
- ?I,ST[I]
- NEXT
- RETURN
Oh, by the way. The actual problem is so simple, that you can actually fit the minimalistic version of the program into one screen. That's right. It's another single screen challenge program!
- REM DIGITAL KOTO
- REM BY HARRY HARDJONO
- ACLS:CLEAR:DIM BP[49]
- DIM NT$[49]:DIM ST[16]
- P=4096/12:T$="CcDdEFfGgAaB"
- FOR I=-24 TO 24:J=I+24
- BP[J]=P*I
- NT$[J]=MID$(T$,(J%12),1):NEXT
- ST[0]=14:ST[1]=19:ST[2]=21
- ST[3]=22:ST[4]=26:ST[5]=27
- ST[6]=31:ST[7]=33:ST[8]=34
- ST[9]=38:ST[10]=39:ST[11]=43
- ST[12]=45:ST[13]=0:ST[14]=0
- @LOOP
- NS=13:A=256/NS:B=A/2
- VSYNC 1:TX=FLOOR(TCHX*NS/256)
- GPAGE 1,1,1:FOR I=0 TO NS-1
- GLINE B+I*A,0,B+I*A,192,15
- NEXT
- GLINE B+TX*A,16,B+TX*A,192,8
- SD=BP[ST[TX]]
- IF TCHTIME>0 THEN BEEP 16,SD
- GOTO @LOOP
Labels:
31,
challenge,
computer,
digital,
hour of code,
Journal,
koto,
music,
Petit,
screen,
single,
tutorial
Thursday, December 26, 2013
Book Review #16
American Bar Association: Legal Guide to Game Development
Ross Dannenberg (Editor)
I have always wanted to have my own video game development company. I just don't know how. All the books out there is simply a guide on how to build a generic business. That's not true. I found a book on how to run your own Food Truck. Somebody actually recommended a good book on video game company development. That book is out of print. This book is my substitute.
Unfortunately, it makes for a boring reading. I suppose lawyers are boring creatures. I understand the need for precise wording, but it's like, they have no imagination whatsoever. Oh, well. All the pertinent info are there. At least I think so, since I'm not a lawyer. The book does details the game development process from idea to implementation to execution. Of course, all the pertinent regulations are highlighted. The book does an admirable job explaining the laws as they affect the gaming development.
It has enough examples and exposition to make the issues clear to me. Well. It's just so boring, though. Of course, the value of this book isn't entertainment. It's legal advice, as close as you can get without actually consulting a lawyer. On that, the book succeeds. Give it a try. You may be surprised as just how many of those laws apply to a simple game development process.
Tuesday, December 24, 2013
Raspberry Pi Journal #42
Symbolic Linking
Here's something to ponder. Let's say that you want to have a certain file that is frequently modified. But, you also want to have a copy of all the modifications. Something like a running log. You can, of course, do it like this:
- Create the file, make changes to it, etc.
- Copy the file to some other name, adding timestamp.
So, let's say we have a file called Musings.txt. We can use this command copy the file, while adding time stamp.
cp Musings.txt `date Musings_%F.txt`
You can change the date format to anything you like. See the man pages for "date" for details.
Another way to have a file associated with changes, and this is important if you want to make changes to it, but want the file associated with the latest stable version, as opposed to the latest edited, is to use symbolic link command.
ln -s original_file linked_file
By making copy as a linked file, you can refer to the linked file whenever you want, and refer to the original file. Then when you're ready, simply replace the linked file to the updated one.
- rm linked_file
- ln -s updated_file linked_file
It's a two step process, but you can work with the updated file to your heart content, and be sure to have the updated file ready to be "released", without changing anything else.
It's similar to copy, but more space efficient.
Monday, December 23, 2013
Cooking Journal #18
Chicken Leg and Thigh
I usually cook my rice with hot dogs. However, I do like to get fancy from time to time. So, I'd go to the local supermarket and raid their chicken section. I usually grab their legs and thigh section. In the old days, I'd grab their boneless breast section. Nowadays, though, after reading Modernist Cuisine, I decided that cooking bone-in is the way to go!
It's a simple enough deal to cook these. Once the oil is warmed up in the pan, I set it to medium, and put a leg and a thigh into it. Wait 20 minutes, and turn them over. Wait another 10 minutes, and take the leg out. Wait another 10-15 minutes and take the thigh out. Total time: 25-30 minutes for the leg. 40-45 minutes for the thigh.
The only problem with this is that last 5 minutes. I have to watch over them. I have the pan with glass lid, so I can actually watch them fry. However, I still go by smell.
The end result is delicious! Not as good as KFC, because I simply don't care about spices, but the meat is tender and juicy. Just the right amount of cooking.
Subscribe to:
Posts (Atom)