Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOUND and waveforms
#6
(08-14-2022, 09:47 AM)mnrvovrfc Wrote:
(08-13-2022, 06:41 PM)madscijr Wrote: If out of this we can get an improved sound library with a better sound function that accepts frequency, waveform (sine, square, sawtooth, triangle, white/brown/pink noise, maybe a way to specify a custom formula), attack/decay/sustain/release, or duration, volume, envelope(?), and pan/fader parameters, which returns a unique ID where multiple sounds can play simultaneously, start & stop routines for a given sound ID, IsPlaying (returns true/false), and the ability to alter the parameters while it's playing, that would make audio in QB64 a lot better.
Telling by at least two threads I've opened having to do with sound generation, which there's no reply, it seems you and I are the only ones on this forum that want this functionality, my friend.

I'd be happy to try to help make something usable!

Just thinking out loud to break it down and make sure I understand, a digital audio sound is made up of a bunch of brief click noises (where a single click is called a sample) played at different volumes one after another really really fast. Typically a sound is made up of many such samples played each second (the frequency is how many samples are played each second). The volume increases and/or decreases over time, which looks like a wave when the volume (y-axis) is graphed against time (x-axis). 

So basically to play a sound of a certain waveform, you would have the computer play a click at the loudness determined by the waveform for the given (miniscule) point in time. This happens many times per second for each sound (44,100 times per second for CD quality sound). So we would need a timer that fires the sound play event however many thousand times a second, to achieve the desired frequency and timbre. 

I know QB64 has a timer function that you can enable to fire at a regular interval, so for each sound we want to play, we might set up a timer, and send it the parameters so it knows what volume and when to play the next sample. 

Does that sound at all right or is that missing some important part? I started reading about modulation and they totally lost me. 

Would we really need our sound routine to run 44100 times every second per sound channel to generate CD quality sound? That sounds like an awful lot of processing power... When I'm back at a PC, I can play around with this, and try to create a proof of concept program to try out various concepts and see the process in action.
Reply


Messages In This Thread
SOUND and waveforms - by CharlieJV - 08-06-2022, 07:41 PM
RE: SOUND and waveforms - by mnrvovrfc - 08-08-2022, 12:42 AM
RE: SOUND and waveforms - by madscijr - 08-13-2022, 06:41 PM
RE: SOUND and waveforms - by CharlieJV - 08-13-2022, 06:52 PM
RE: SOUND and waveforms - by madscijr - 08-16-2022, 06:15 PM
RE: SOUND and waveforms - by mnrvovrfc - 08-14-2022, 09:47 AM
RE: SOUND and waveforms - by madscijr - 08-14-2022, 11:37 AM
RE: SOUND and waveforms - by madscijr - 08-16-2022, 06:26 PM



Users browsing this thread: 1 Guest(s)