Poster | Thread |
AlexC
| |
Coding Challenge: [Update: voice.library asm source available now!] (Was: Emulating a generic parallel sound sampler on A1) Posted on 19-Oct-2007 8:55:46
| | [ #1 ] |
|
|
|
Super Member |
Joined: 22-Jan-2004 Posts: 1300
From: City of Lost Angels, California. | | |
|
| [edit] UPDATE:
I managed to get the source code! See Post #18 for more details. [/edit]
Backgound: On my Amiga 1200 and 4000 I was using VoiceShell, a voice command program. Even though it could only recognize "learned" words and thus couldn't be used to dictate a letter, it was very useful for system commands, and could really learn any sound so it could also recognize the door bell, the phone ringer, and other typical noises... Sadly, we have no alternative/replacement for it in OS4.
Problem: VoiceShell, like various older 68k audio applications pre-dating AHI have support for "Generic" and sometimes other sound samplers like PerfectSound which can't function on the A1 parallel port due to hardware differences. Also it's unlikely that the source code of VoiceShell, VoiceCLI, AniMan, or any of these audio-sampling applications will become available...
Solution: I was thinking that a general solution would be to intercept accesses to the parallel device and fool the programs into thinking they are talking to and being fed audio from a generic sampler when in reality they'd be talking to a virtual device and getting the audio from the AHI input.
Interested? I don't have time to do the research and figure out how to do this using my limited skills, but I'm hoping that someone with the proper skills would feel enticed by the challenge and give it a shot... Because I could really use voice commands, and to make this more interesting, I'll even give $100.00 to whomever makes the AHI input work with VoiceShell in OS4. Though it would be more beneficial if the hack made any application which supports the "generic" sampler work with AHI. For that matter, using 68k code might be best as it would also allow Classic/Peg/UAE users to benefit as well.
Last edited by AlexC on 17-Mar-2010 at 08:43 AM.
_________________ AlexC's free OS4 software collection
AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation |
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 19-Oct-2007 9:35:29
| | [ #2 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @AmigAlex
I can only assume that these would only be read accesses to the parallel port? I suppose you could divert those reads to use AHI in theory. But, there is something else we don't know, do they actually use parallel.device or read the actual hardware?
If these programs "work" fine on OS4 and don't crash, there is one way to find out how it is reading the port. Just use CIAgent to find out. Issue this command line: CIAgent ALLHITS
Then run your voice applications and watch for any hitting. Last edited by Hypex on 19-Oct-2007 at 09:36 AM.
|
|
Status: Offline |
|
|
AlexC
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 20-Oct-2007 11:36:53
| | [ #3 ] |
|
|
|
Super Member |
Joined: 22-Jan-2004 Posts: 1300
From: City of Lost Angels, California. | | |
|
| @Hypex
Thanks for the hint, here's what I found:
Launching VoiceShell causes a DSI unless the misc.resource is available.
I took care of adding that resource and it loaded, with the following hits in the CIAgent window: Quote:
! Hit: CIA A: W:DDRB ($BFE301) Data: 0 ($00) Task: $6C78A250 "VoiceShell" ! Hit: CIA A: W:DDRB ($BFE301) Data: 0 ($00) Task: $6C78A0D0 "VoiceTask" - API: CIA B: AddICRVector() ICRBit: 1=TIMER B Interrupt: $6C9834B0 "Listener" Result: $00000000 ! Hit: CIA B: R:CRB ($BFDF00) Data: 255 ($FF) Task: $6C78A0D0 "VoiceTask" ! Hit: CIA B: W:CRB ($BFDF00) Data: 247 ($F7) Task: $6C78A0D0 "VoiceTask" |
It then sat there waiting for the interrupt which I triggered with "I": Quote:
* Cmd: Interrupt I. Chip: B #1 ! Hit: CIA B: W:TBLO ($BFD600) Data: 126 ($7E) Task: $6CEEEB10 "CIAgent" ! Hit: CIA B: W:TBHI ($BFD700) Data: 3 ($03) Task: $6CEEEB10 "CIAgent" ! Hit: CIA A: R:PRB ($BFE101) Data: 17 ($11) Task: $6CEEEB10 "CIAgent" |
And it continuously does 3 hits then waits for B #1, I assume in a loop trying to read from the sampler.
When I made it inactive it did this: Quote:
! Hit: CIA B: W:TBLO ($BFD600) Data: 111 ($6F) Task: $6CEEEB10 "CIAgent" ! Hit: CIA B: W:TBHI ($BFD700) Data: 0 ($00) Task: $6CEEEB10 "CIAgent" - API: CIA B: AbleICR() Mask=$2 Current=$2 ! Hit: CIA B: R:CRB ($BFDF00) Data: 247 ($F7) Task: $6C78A0D0 "VoiceTask" ! Hit: CIA B: W:CRB ($BFDF00) Data: 246 ($F6) Task: $6C78A0D0 "VoiceTask" - API: CIA B: RemICRVector() ICRBit: 1=TIMER B Interrupt: $6C9834B0 "Listener" Result: $00000000 |
If I understand this right, it's accessing the sampler directly. So I suppose a derivative of CIAgent might be able to feed VoiceShell with the data it wants.
_________________ AlexC's free OS4 software collection
AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation |
|
Status: Offline |
|
|
Deniil715
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 20-Oct-2007 15:54:51
| | [ #4 ] |
|
|
|
Elite Member |
Joined: 14-May-2003 Posts: 4236
From: Sweden | | |
|
| @AmigAlex
My suggestion would be to patch the program in realtime (replace $bfe00X with some real address); allocate memory for emulating the parallel port registers, then patch the program with these addresses and start it.
An interrupt timer could perhaps be set to generate interrupts to it at regular intervals, say 8kHz. Then put continuous AHI data into the parallel byte at the allocated address. The program would read it at every faked interrupt it gets.
Possible? _________________ - Don't get fooled by my avatar, I'm not like that (anymore, mostly... maybe only sometimes) > Amiga Classic and OS4 developer for OnyxSoft. |
|
Status: Offline |
|
|
Xenic
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 20-Oct-2007 16:17:34
| | [ #5 ] |
|
|
|
Super Member |
Joined: 2-Feb-2004 Posts: 1246
From: Pennsylvania, USA | | |
|
| @Deniil715
It would probably be easier to modify the sourcecode. I have the sources sitting on my hard drive. They were included in various VoiceShell archives on the Fred Fish disks and on Aminet. I know they are included in the file TBSource.lha on Aminet. The downside is that they are written entirely in assembly language. However, there are some 68k assemblers that work with OS4 and it might be possible to switch the digitizer code to use AHI and assemble an updated 68k version of the program.
With either method there are further complications. VoiceShell uses the voice.library for voice recognition. I don't know if it works on OS4 and even if it does, it probably needs 8 bit sound samples. I don't know if AHI can convert 16bit samples to 8bit for you so you may also need to convert the samples before feeding them to voice.library.
_________________ X1000 with 2GB memory & OS4.1FE |
|
Status: Offline |
|
|
Rob
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 20-Oct-2007 19:46:45
| | [ #6 ] |
|
|
|
Elite Member |
Joined: 20-Mar-2003 Posts: 6349
From: S.Wales | | |
|
| @Xenic
Quote:
However, there are some 68k assemblers that work with OS4 and it might be possible to switch the digitizer code to use AHI and assemble an updated 68k version of the program. |
Would this be suitable for the job http://www.coyoteflux.nl/ppc680x0.htm |
|
Status: Offline |
|
|
Xenic
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 21-Oct-2007 3:56:27
| | [ #7 ] |
|
|
|
Super Member |
Joined: 2-Feb-2004 Posts: 1246
From: Pennsylvania, USA | | |
|
| @Rob
Actually I was referring to assembling it to a 68k binary with an assembler that would run on OS4. I would think that one would want to get it working as a 68k program before trying to convert it to PPC. I doubt if anyone has the time to try such a project but it's a nice idea.
_________________ X1000 with 2GB memory & OS4.1FE |
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 21-Oct-2007 16:07:15
| | [ #8 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @AmigAlex
Quote:
Thanks for the hint, here's what I found:
Launching VoiceShell causes a DSI unless the misc.resource is available.
When I made it inactive it did this: |
I knew I wrote CIAgent for a reason. So how did you add a misc.resource?
Quote:
! Hit: CIA A: W:DDRB ($BFE301) Data: 0 ($00) Task: $6C78A250 "VoiceShell" ! Hit: CIA A: W:DDRB ($BFE301) Data: 0 ($00) Task: $6C78A0D0 "VoiceTask" - API: CIA B: AddICRVector() ICRBit: 1=TIMER B Interrupt: $6C9834B0 "Listener" Result: $00000000 ! Hit: CIA B: R:CRB ($BFDF00) Data: 255 ($FF) Task: $6C78A0D0 "VoiceTask" ! Hit: CIA B: W:CRB ($BFDF00) Data: 247 ($F7) Task: $6C78A0D0 "VoiceTask" |
Gee it's funny seeing CIAgent on another machine.
Quote:
It then sat there waiting for the interrupt which I triggered with "I": Quote: * Cmd: Interrupt I. Chip: B #1 ! Hit: CIA B: W:TBLO ($BFD600) Data: 126 ($7E) Task: $6CEEEB10 "CIAgent" ! Hit: CIA B: W:TBHI ($BFD700) Data: 3 ($03) Task: $6CEEEB10 "CIAgent" ! Hit: CIA A: R:PRB ($BFE101) Data: 17 ($11) Task: $6CEEEB10 "CIAgent"
And it continuously does 3 hits then waits for B #1, I assume in a loop trying to read from the sampler. |
Yes. You can se how the interrupt runs in the CIAgent task. It writes to the timer B registers, trying to reset the timer, and reads from data register B for the parallel port. I think that timer may be at 800Hz.
Quote:
When I made it inactive it did this:Quote: ! Hit: CIA B: W:TBLO ($BFD600) Data: 111 ($6F) Task: $6CEEEB10 "CIAgent" ! Hit: CIA B: W:TBHI ($BFD700) Data: 0 ($00) Task: $6CEEEB10 "CIAgent" - API: CIA B: AbleICR() Mask=$2 Current=$2 ! Hit: CIA B: R:CRB ($BFDF00) Data: 247 ($F7) Task: $6C78A0D0 "VoiceTask" ! Hit: CIA B: W:CRB ($BFDF00) Data: 246 ($F6) Task: $6C78A0D0 "VoiceTask" - API: CIA B: RemICRVector() ICRBit: 1=TIMER B Interrupt: $6C9834B0 "Listener" Result: $00000000
If I understand this right, it's accessing the sampler directly. So I suppose a derivative of CIAgent might be able to feed VoiceShell with the data it wants., |
Yes it is, it writes into the timer again, then the control register and removes it's interrupt.
I was recently asked about parallel emulation in CIAgent, and although I hadn't planned to put in any parallel support in (but did think about it), I might have to consider this feature after all.
|
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 21-Oct-2007 16:16:21
| | [ #9 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @Deniil715
]Quote:
My suggestion would be to patch the program in realtime (replace $bfe00X with some real address); allocate memory for emulating the parallel port registers, then patch the program with these addresses and start it. |
Yes this would be "cleaner".
Quote:
An interrupt timer could perhaps be set to generate interrupts to it at regular intervals, say 8kHz. Then put continuous AHI data into the parallel byte at the allocated address. The program would read it at every faked interrupt it gets. |
This would be slightly harder as you'd need it to open AHI really and add a record func IIRC.
|
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 21-Oct-2007 16:22:52
| | [ #10 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @Xenic
Quote:
It would probably be easier to modify the sourcecode. I have the sources sitting on my hard drive. They were included in various VoiceShell archives on the Fred Fish disks and on Aminet. I know they are included in the file TBSource.lha on Aminet. The downside is that they are written entirely in assembly language. However, there are some 68k assemblers that work with OS4 and it might be possible to switch the digitizer code to use AHI and assemble an updated 68k version of the program. |
A68K is one. Not sure of AsmOne works, nor DevPac. Phxass should. I even used AssemPro the other day to assemble and disassemble something and that can even work on OS4!
I am currently porting the TotalChaos system over to AHI and it is entirely written in assembly. Funny how assembly is like riding a bike, you never forget how to do it. At least I was happy coding in 68K ASM, even if I ran it on OS4.
Quote:
With either method there are further complications. VoiceShell uses the voice.library for voice recognition. I don't know if it works on OS4 and even if it does, it probably needs 8 bit sound samples. I don't know if AHI can convert 16bit samples to 8bit for you so you may also need to convert the samples before feeding them to voice.library. |
It works exclusively in 16-bit. Or 32-bit if you want IIRC. But, this is easy, assuming the 16-bit AHI sample data is in D0: ASR.W #8,D0
LSR.W #8,D0 should also work well enough. |
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 21-Oct-2007 16:24:39
| | [ #11 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @Rob
Quote:
I am always mentioning this. It it can produce OS4 compatible PPC code then all the better.Last edited by _Steve_ on 21-Oct-2007 at 07:14 PM.
|
|
Status: Offline |
|
|
AlexC
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 24-Oct-2007 11:01:50
| | [ #12 ] |
|
|
|
Super Member |
Joined: 22-Jan-2004 Posts: 1300
From: City of Lost Angels, California. | | |
|
| @Xenic
Since the VoiceShell source code is available, modifying it and recompiling it to 68k or porting it to 'C' for 68k/PPC is feasible, but it doesn't seem to be required, appearently it's not accessing the hardware at all, and as you point out, the issues are with voice.library :-/
Unless the source code can be located, that's what needs to be patched/hacked/or whatever trick may work to keep it from hitting the hardware directly and get a downsampled stream from AHI instead.
Making the library work would be great and I'd be all set, though it would be even better to catch these CIA and parallel port accesses completely to get all such sampling applications to work on 68k Amigas without sampler and especially on OS4/MOS/UAE where it's just not possible to use them.
[edit]wrote serial where I meant parallel[/edit] Last edited by AmigAlex on 24-Oct-2007 at 02:08 PM.
_________________ AlexC's free OS4 software collection
AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation |
|
Status: Offline |
|
|
AlexC
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 24-Oct-2007 15:04:40
| | [ #13 ] |
|
|
|
Super Member |
Joined: 22-Jan-2004 Posts: 1300
From: City of Lost Angels, California. | | |
|
| @Hypex Quote:
So how did you add a misc.resource? |
I took the misc.resource from the beta Classic kickstart and added it to the kicklayout, but that might not be an option for most end-users.
Quote:
I was recently asked about parallel emulation in CIAgent, and although I hadn't planned to put in any parallel support in (but did think about it), I might have to consider this feature after all. |
That would be one piece of the puzzle, and perhaps install a fake misc.resource as well if one isn't loaded already? (It only has to emulate 3 simple functions) otherwise programs which just assume it's there without checking (since it was in the ROMs) might crash.
_________________ AlexC's free OS4 software collection
AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation |
|
Status: Offline |
|
|
Xenic
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 24-Oct-2007 16:14:44
| | [ #14 ] |
|
|
|
Super Member |
Joined: 2-Feb-2004 Posts: 1246
From: Pennsylvania, USA | | |
|
| @AmigAlex
Quote:
Making the library work would be great and I'd be all set, though it would be even better to catch these CIA and parallel port accesses completely to get all such sampling applications to work on 68k Amigas without sampler and especially on OS4/MOS/UAE where it's just not possible to use them. |
I think it would be a little more complicated than intercepting the CIA accesses. All parallel port digitizers that I used had to freeze the operating system in order to get precisely timed samples (enable/disable forbid/permit). You will need to eliminate that and then feed coverted samples (16->8 bit) one at a time from the AHI sample input to the program that is trying to access the CIA. It might be possible but the programming time could probably be better spent porting a similar program (if one exists) from another OS._________________ X1000 with 2GB memory & OS4.1FE |
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 28-Oct-2007 14:39:48
| | [ #15 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @AmigAlex
Quote:
I took the misc.resource from the beta Classic kickstart and added it to the kicklayout, but that might not be an option for most end-users. |
Okay, so this wasn't in any A1 versions?
I did the same with the CIA resources before I "invented" CIAgent. I took the CIA kmod and stuck it back in my kicklayout when we got WarpUP. So I could try and get FusionPPC to work. Of course it didn't and complained about some interrupt thing, which I thought may have been WarpUP emulation. Should test it on Update4 with CIAgent to prove it was.
Quote:
That would be one piece of the puzzle, and perhaps install a fake misc.resource as well if one isn't loaded already? (It only has to emulate 3 simple functions) otherwise programs which just assume it's there without checking (since it was in the ROMs) might crash. |
I just took a look, seems simple enough. BTW, what is the 3rd function? In my SDK Browser it mentions three by mistake when only two are listed. The Alloc function appears twice. |
|
Status: Offline |
|
|
AlexC
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 29-Oct-2007 4:02:35
| | [ #16 ] |
|
|
|
Super Member |
Joined: 22-Jan-2004 Posts: 1300
From: City of Lost Angels, California. | | |
|
| @Hypex Quote:
Okay, so this wasn't in any A1 versions? |
Nope, it comes from the kickstart for the Classic.
Quote:
I just took a look, seems simple enough. BTW, what is the 3rd function? In my SDK Browser it mentions three by mistake when only two are listed. The Alloc function appears twice. |
You're right, only two functions, a quick look at the autodoc made it look like 3 because there's no blank line between the list and the first section.
_________________ AlexC's free OS4 software collection
AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation |
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: Emulating a generic parallel sound sampler on A1 Posted on 29-Oct-2007 15:04:10
| | [ #17 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @AmigAlex
Quote:
Nope, it comes from the kickstart for the Classic. |
Aha! So you are an OS4 dev coder?
Quote:
You're right, only two functions, a quick look at the autodoc made it look like 3 because there's no blank line between the list and the first section. |
Yep.
|
|
Status: Offline |
|
|
AlexC
| |
Coding Challenge: [Update: voice.library asm source available now!] (Was: Emulating a generic parallel sound sampler on A1) Posted on 17-Mar-2010 8:41:31
| | [ #18 ] |
|
|
|
Super Member |
Joined: 22-Jan-2004 Posts: 1300
From: City of Lost Angels, California. | | |
|
| I started having VoiceShell cravings again the other day and decided to try my best to find a solution.
I located the VoiceShell author who also happened to be the last person to work on voice.library and 15 years later he still had the library source code and promptly sent it to me.
The code is really clean and nicely commented, but it's all 68k asm, which I can't really modify myself as I don't know the first thing about asm.
What I do know is that it's possible to substitute the parallel sampler routines with AHI ones and would be easier than my initial idea of making a hack to simulate a parallel sampler.
That way it would work on Classic with AHI-based sound card, PPC Amigas and even UAE.
Since the library supports 4 sampler models, its PickSampler function (which allows you to select between a PerfectSound3, SoundMaster, Generic or DSS8 sampler) could then select an AHI unit between 0 and 3 instead.
The beauty in that approach is that existing software which depend on voice.library like VoiceShell, VCLI, AniMan (the talking head), and perhaps others would work again, even without modifications.
The timer code needs to be switched from using CIAB to timer.device.
Some functions would have to become NOOP as they become irrelevant once using AHI and timer.device like PickTimer, WhatGain and possibly PickChannel and PickInput unless these last two can be used with AHI.
I have all the tools and files required to successfully assemble and link voice.library, it worked with OS4 so it should work on MOS and UAE too.
If you think you are able to make these changes and want to give it a try, let me know and I'll put all the files online. _________________ AlexC's free OS4 software collection
AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation |
|
Status: Offline |
|
|
Spectre660
| |
Re: Coding Challenge: [Update: voice.library asm source available now!] (Was: Emulating a generic parallel sound sampler on A1) Posted on 17-Mar-2010 11:54:31
| | [ #19 ] |
|
|
|
Elite Member |
Joined: 5-Jun-2005 Posts: 3918
From: Unknown | | |
|
| @thread
While we are discussing these kinds of things
anyone know how to get GS callerid to work on OS4.1 ? I need a callerid program for OS4.1 so that I can retire my Amithlon system.
http://aminet.net/package/comm/misc/GSCID _________________ Sam460ex : Radeon Rx550 Single slot Video Card : SIL3112 SATA card |
|
Status: Offline |
|
|
Hypex
| |
Re: Coding Challenge: [Update: voice.library asm source available now!] (Was: Emulating a generic parallel sound sampler on A1) Posted on 17-Mar-2010 13:52:27
| | [ #20 ] |
|
|
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @AlexC
This is good news! I had forgot about this. Thanks for the full report. Going from my experience of converting a multi module replayer to use AHI you might not need to use timer.device either as AHI should provide a timer for you. I'll look into that.
I'm quite comfortable with ASM so if you need a hand just ask. |
|
Status: Offline |
|
|