![]() |
Forum Index : Microcontroller and PC projects : Audio sample playback from within MMBASIC
Author | Message | ||||
frnno967 Senior Member ![]() Joined: 02/10/2020 Location: United StatesPosts: 104 |
I'm toying around with having Maxiterm play a sound for every character RX/TX. I really want to have a sound like the one from Wargames, but I can't figure out the best way to accomplish the task. It sounds pretty good if I play an MP3 file for each character but I would rather not add an additional file that must be present for the feature to work. Is there a way to encode the audio sample values within the program itself, then call a subroutine to play them every time I want the sound? Or should I just bite the bullet and include the sound file and distribute both as a .zip? And if I go this route, what command is best for checking of the presence of a file before it is played? Thanks! Jay Crutti: Ham Radio Operator, K5JCJ. Computer Enthusiast. Musician. Engineer. |
||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
How about PLAY SOUND ? my site |
||||
frnno967 Senior Member ![]() Joined: 02/10/2020 Location: United StatesPosts: 104 |
The original sound is a bit too multitimbral for PLAY SOUND. I tried that at first but the limited number of voices (4) combined with envelope characteristics meant that at best it sounded like a pure tone, but usually was very choppy and not close to the intended sound. Maybe if there was some ADSR parameters I could make it work, but I also don't know enough about the original sound yet to re-create it. Jay Crutti: Ham Radio Operator, K5JCJ. Computer Enthusiast. Musician. Engineer. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
You could convert that mp3 to a wav. Then, look at the sound code in Martin Scragg's Max-E-Man pacman game. Way down in the program, look for the "ReadWav" subroutine to see how how he loaded the sounds into arrays. In principle, you should be able to convert the array of sound data into data statement values. The "MakeNoise" subroutine shows how to feed the array to the DAC. It's gonna be big though - 10k or more perhaps. Visit Vegipete's *Mite Library for cool programs. |
||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
Do you require a single sound , or multiple frequencies ? my site |
||||
frnno967 Senior Member ![]() Joined: 02/10/2020 Location: United StatesPosts: 104 |
This is perfect. I can downsample the WAV file to a very small size and make it work, but just couldn't figure out the procedure to do it. Thanks for the advice! Jay Crutti: Ham Radio Operator, K5JCJ. Computer Enthusiast. Musician. Engineer. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |