I am developing an instrument (a seismometer) for which the output signal is a square wave with varying frequency centred on about 5 kHz. I would like to measure this frequency every 0.2 seconds to provide a stream of pulse counts.
I have seen Richard's code for a FFT display based on his FFTW code but am unable to decipher his program nor find where this DLL is held.
Can anyone please provide suggestions as to how I can read my square wave pulse count on the microphone input port? I believe I am competent enough to write the rest of the BBC4W code for my project!
Reading frequency on microphone input
Re: Reading frequency on microphone input
The next release of BBC BASIC for SDL 2.0 will include an audio spectrum analyser (cross-platform, of course, so not dependent on a Windows-specific DLL or anything like that). I suggest you adapt that; what frequency resolution do you need?
Being a square wave you will of course see all the odd harmonics (up to the Nyquist limit), so your code would need to identify the fundamental. Should be straightforward, but something to be aware of.
I'm not too sure of the timescale for the next release because my laptop recently failed, and I am awaiting a replacement.
-
- Posts: 1
- Joined: Tue 29 Jun 2021, 23:20
Re: Reading frequency on microphone input
Hi Mark,
The analyser code example is excellent (thanks Richard!) - I'm modifying it to log super-slow data rate transmissions on ELF.
Finding the DLL was tricky, it used to be here: http://groups.yahoo.com/group/bb4w/file ... tw2dll.dll ...but sadly there's no access to the old group archives. In the end, I used archive.org to find a copy of the DLL, which I can make available if you are struggling (and there's no official download source).
I've just spotted that Richard is going to provide a new version of the audio spectrum analyser for BBC BASIC SDL (please can it support logging/replay to/from a file? Sorry to hijack this post with the cheeky request...), something I'm looking forward to for cross-platform use but the old code works well if you can't wait.
Regards
Darren
The analyser code example is excellent (thanks Richard!) - I'm modifying it to log super-slow data rate transmissions on ELF.
Finding the DLL was tricky, it used to be here: http://groups.yahoo.com/group/bb4w/file ... tw2dll.dll ...but sadly there's no access to the old group archives. In the end, I used archive.org to find a copy of the DLL, which I can make available if you are struggling (and there's no official download source).
I've just spotted that Richard is going to provide a new version of the audio spectrum analyser for BBC BASIC SDL (please can it support logging/replay to/from a file? Sorry to hijack this post with the cheeky request...), something I'm looking forward to for cross-platform use but the old code works well if you can't wait.
Regards
Darren
Last edited by DarrenStorer on Tue 30 May 2023, 22:03, edited 1 time in total.
-
- Posts: 11
- Joined: Tue 13 Sep 2022, 09:13
Re: Reading frequency on microphone input
Thanks Richard and Darren for the quick replies.
I await the release of the next SDL2.0 that should provide clues for me in the audio spectrum analyser. In the meantime Darren, yes please provide the DLL used in Richard's the FFTW code. Also, me being cheeky, it would be great if the new analyser provided the option to log sound input to a file.
Regards,
Mark
I await the release of the next SDL2.0 that should provide clues for me in the audio spectrum analyser. In the meantime Darren, yes please provide the DLL used in Richard's the FFTW code. Also, me being cheeky, it would be great if the new analyser provided the option to log sound input to a file.
Regards,
Mark
Re: Reading frequency on microphone input
The idea is that it should be functionally equivalent to the BBC BASIC for Windows example program analyser.bbc, primarily to illustrate how one can create cross-platform applications that don't depend on OS-specific resources like Windows DLLs.
Since the output from the Spectrum Analyser is graphical much the easiest way of 'logging' it to a file is to record it as a video. For example in Windows you can use the built-in Game Recorder (accessed using the Windows+G hotkey combination). Other OSes have similar capabilities.
Attempting to log its output to a file in any other way would slow the program down to such an extent that it would no longer be a real-time analyser; as it is it needs a fast PC to keep up with audio sampled at 22 kHz.
Re: Reading frequency on microphone input
It did indeed take longer than expected (two months), not least because the replacement laptop (Dell) was awful and, after a failed repair, I rejected it and chose a different model! Back in business now though, and BBCSDL v1.36a, including the spectrum analyser, has now been released.Hated Moron wrote: ↑Tue 30 May 2023, 21:41 The next release of BBC BASIC for SDL 2.0 will include an audio spectrum analyser (cross-platform, of course, so not dependent on a Windows-specific DLL or anything like that).
...
I'm not too sure of the timescale for the next release because my laptop recently failed, and I am awaiting a replacement.