April 18, 2024, 10:00:03 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


A simple Audio Record/Play example for Creative Basic

Started by Egil, September 05, 2019, 10:15:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Egil

For a while I have been working on a SWL Loggbook program, using Creative Basic. During this work, I thought it would be nice to include audio record and playback routines in the program.

Forum user h3kt0r posted code for audio recording using IWB a while ago: https://www.ionicwind.com/forums/index.php?topic=5869.msg43409#msg43409
And Graham posted code for playback of MP3 files using CB: https://www.ionicwind.com/forums/index.php?topic=5341.msg39931#msg39931

A bigh THANK YOU to both for the inspiration!

My own audio record/playback routines for Creative Basic are attached. Some bitmaps and audiosamples (recorded with this priogram) are also included.
In the example program the WAV sampling frequency is set to 11025 Hz. This gives an audio quality similar to audio recorded by a casette player. Which is more that good enough for audiosamples recorded from shortwave broadcasts. And resulting audio files are relatively small. I have converted them to MP3 and included these in the same directory for comparison. The sampling frequency can be set to higher values for better sound quality, but doubling the sampling frequency doubles the file size.

The program has four bitmap buttons, and for the EXE file I have not bothered to include these as a resource, so the Bitmap directory has to be included.

I wasted a lot of time trying to make a routine for detecting when an audio file has reached the end, but after much trial and error, that idea was dropped, and a routine for showing the duration of played files was made. This will be changed later to return the file duration in seconds, and the result will be used in a timer controlling the status of the playback.

Later I will also try to make routines for controlling the Windows audio mixer, abling me to select whatever available input line present. At present the program captures audio from the default input line, which on my computer is an internal "virtual audio cable" stereaming demodulated audio from an SDR receiver (ELAD FDM-S2). The SDR has four independent receivers, so it would be nice to be able to record audio from several of these simultaneously. But that will be a far cry from what I'm doing now.


Have fun!

Egil
Support Amateur Radio  -  Have a ham  for dinner!