News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Triggering code from sound input: how to?

Started by dicky96, January 07, 2013, 02:52:06 AM

Previous topic - Next topic

japheth

Quote from: dicky96 on January 09, 2013, 09:58:53 AM
In the case of win98 can I just read/write directly to the parallel port data/control registers at 378h and 37ah?

It depends on whether it's a Windows or a DOS task that's trying to access the ports. Windows tasks are expected to use the Windows API. For DOS tasks, the default setting is "share ports with other applications" ( there is some virtualization / serialization to prevent multiple DOS tasks from accessing those ports simultaneously ) - but IIRC one can change this behavior by some settings in system.ini ( LPTxAutoAssign = ? ).

farrier

Another method to record sound thru the LineIn input.  Code is in fasm syntax, one records input to a .wav file; another records to .wav file and converts to .mp3 file.  Works well for me to record input to LineIn from receiver to record Radio shows while I'm away.

http://www.masmforum.com/board/index.php?topic=11229.0

farrier

Farabi

MS need about 7 years to make a speech recognition, a software that able to recognize human voice. Trigering code from sound input I think had the same basic prinsiple too. And it is and advance one.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

WinstonHiggins

#33
Quote from: dicky96 on January 07, 2013, 02:52:06 AM
Hi Guys

OK A quick bit about me so you know where I am coming from on this   :icon_cool:

I'm actually an electronics engineer from the 80s and 90s who worked on everything from TV and VCR to Computers and Industrial Electronics.  I did my City & Guilds in TV Video and Electronic servicing and my HNC (kinda like a University degree level in the old days when we had 'Polytechnic Colleges') in Microprocessor System Design and Programming - and I got distinctions throughout  :dazzled:

So I've got a good understanding of analog and digital electronics, and microprocessor systems.  I also have worked as a programmer, but as I am an electronics engineer at heart I tend to work 'backward' to most folks way of thinking, the higher the level of code the less I can figure out what the hell is going on! lol

So enough about me.

My current project is a frivolous one but something I have wanted to do for some years - so ready for next winter I am designing and building a computerised system to control outdoor xmas led light.  It's all for fun really

The questions I want to ask are about the general methods to create such as system, and what is the best approach... but read on and I'll tell you how far I got first

Yeah OK I know most folks who attempt this use professional DMX lighting controllers, but I'm an engineer so.....

A few years ago I got some old dis-used LED 'Moving Sign' displays - you know the ones that have the moving writing in shops and banks etc before we had flat screens everywhere.  I picked up three of these from a Radeio and Electronics fair for a good enough price.  I was gonna sell them on but never did anything with them as I couldnt find any info on how to interface them

Anyway what I have now done is dismantle one of these segns, as I figured it would contain lots of useful bits such as shift registers, which it does

I got three circuit boards full of shift registers, one nibble wide and 64 bits long - and then I reverse engineered the boards from looking up the components data sheets.

Having done that I set about interfacing one of the boards to an old PC (running XP) using the parallel port, I attached 64 strips of SMD RGB LEDs, I can control each strip with one nibble of data (actually I only use three bits pe LED strip as they have 8 colours - if we include off (black) as a colour

I connected it all up and it worked.

Writing some code based on Iczelions tutrials, an example called AsmIO, and the WinIO dll.  I can now run coloured pattern sequences, I have 64 LED strips each can be any of 8 colours... and it looks pretty cool  ;)  TBH as what I am doing is rather 'low level' ASM seems the best choice of programming languiage for this project yes?

I can also daisy chain more of these shift register boards and have even more lights

So thats what I've done so far

My program basically treats the LED display as a 'frame' of 64 nibbles, and loads a whole new 'frame' of data each step - so any of the 64 LEDs can be controlled on each step in any way I like

Now what I want to do is get the thing synchronised to the beat of music.  I don't want to 'step' the display once per beat, I want to 'step' it at a constant say 8 or 16 'frames' per second, and detect when a beat in the music occured so I can change the sequence direction or colours or whatever other parameter each time the music beats

I've done a bit of research and had a good think about this and can come up with three possible solutions:  What I would like is advice on these ideas, and maybe some ideas I haven't even considered

First off - I thought of getting my program working as a winamp visualiser.  From what I have read, visualisers are DLLs with a pretty much set structure, and are called by winamp after whatever mS delay you chose (say ever 80mS for example).  It looks like winamp sends your dll a 'message' like the windows messages in win32 api. It also looks like it gives you spectrum data and stuff.  I have an barebones example for a visualiser dll but it is written in pascal and I have never programmed in that language, but probably with a bit of help on datatypes and such from here I could get an asm visualiser running.  What I can't figure out is how to detect a beat in the music

Second off - I did a bit more looking and it seems I could create an 'APE' for the AVS visualiser.  APE is an AVS Preset Extension I belive. This is also a dll and I have a barebones example but that is written in C++.  If it was written in C I would have a go at creating an asm APE, but all that OOP stuff in C++ with classes and stuff is pure gobbledegook to me no matter how many times i have tried to learn it.  So I think I would need a lot more help with this.  On the plus side AVS calls your DLL at a framerate set from AVS control panel and also passes you a flag to tell you if a beat has occured since your program was last called

It did occur to me with method 1 or 2 above I could compile the barebones example rather than rewriting it in asm and then get that to call my dll but I really don't know exactly how to do this either

Thirdly - Well I am an electronics engineer.... I though maybe I should forget about all this winamp API, AVS and APE dll stuff.... and build a sound to light type circuit and connect it to my sound card output and to the input pins on the parallel port. Then my program could just read the data from the port.  I could add sensitivity control and a speed control to the external sound to light - and reading the clock pulse from the speed (oscillator) via the parallel port on one input and detecting a beat on another I would have external sequence speed and sensitivity controls.  While at it I could use op-amps/filters to detect beats (bass) and high end (snares/cymbals) and get my program to react to both.  At the moment my asm code to test the lights simply counts down a long loop before loading the next frame - probably not the way to do it as the CPU maxes out on my process at 99% and the sequence speeds up/slows down as the OS gives other processes time to execute.

So that's what I am up to.  I would really appreciate any suggestions or advice if this should all work and if I am approaching it the right way.


cheers
dicky


hello were you able to sort out the problem? I am facing similar issue with my triggering code..Can you tell the right way to solve the issue..Waiting for reply thanks in advance:)