Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64 Phoenix Edition v3.8.0 Released!
#40
(06-14-2023, 12:36 PM)mnrvovrfc Wrote: The additional functionality to SOUND is great, but it's destined to do only one-channel sound. One still has to work for multichannel playback with _SNDRAW and the like. ON PLAY() was never supported by QB64. This is just a reminder for the ambitious ones.

You raise a solid point. I was playing around with it yesterday to learn too (obviously it requires QB64PE3.8+).

I spoke with @a740g on Discord and he mentioned he wants to add some multi-channel stuff. Then he showed me how it uses miniaudio and when I saw it could do filters and had the ability to do delay and reverb, my little brain and heart nearly exploded with joy.

I'm super excited about this stuff!

The example below is mostly me trying to find limits.

One thing I did learn is that you cannot stack Q's like notes. My thought was ok Q100 that's only 100ms (and I already begged for that range to be increased to @a740g) but if I could stack 10 Q100's that's a full second, alas, it doesn't work that way. When I asked why it was because it's per PLAY statement note.

So in the same way that V adjusts(modulates, attenuates, whatever language you like here) the volume from 0-100, Q also acts like that in the same category.

Stacking V's does nothing, V100,V50,V25 doesn't create a ramp or a shape of modulation, it simply sets the value. Q works like that.

You can change the V and Q for the next note to come though, if you pair them.

I've also asked @a740g for different noise colors (because white noise is really really harsh, there is also brown and pink which are much less intense) and from a sound design perspective it's wonderful to get this to happen.

Code: (Select All)

DIM AS STRING Q, P : Q$ = CHR$(34) : P$ = ""

PRINT "==============================="
PRINT "QB64 PHOENIX EDITION SOUND DEMO"
PRINT "==============================="

MONO:
PRINT
PRINT "--- WAVEFORMS DEMO MONOPHONIC (@n) ---"
P$ = "V25 O3 @1 G D C F" : PRINT " SQUARE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @2 G D C F" : PRINT " SAW WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @3 G D C F" : PRINT "TRIANGLE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @4 G D C F" : PRINT " SINE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @5 G D C F" : PRINT " NOISE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$

POLY:
PRINT
PRINT "--- WAVEFORMS DEMO POLYPHONIC (@n) ---"
P$ = "V25 O3 @1 G,D,C,F" : PRINT " SQUARE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @2 G,D,C,F" : PRINT " SAW WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @3 G,D,C,F" : PRINT "TRIANGLE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @4 G,D,C,F" : PRINT " SINE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O3 @5 G,D,C,F" : PRINT " NOISE WAVE: PLAY " + Q$ + P$ + Q$ : PLAY P$

MULTI:
PRINT
PRINT "--- WAVEFORMS DEMO MULTI-WAVE (@n) ---"
P$ = "V25 O0@1G,O1@2G" : PRINT " SQUARE + SAW WAVES: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O0@2G,O3@2G" : PRINT " SAW + SAW WAVES: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O0@3<<G,O1@1<<G" : PRINT " TRIANGLE + SQUARE WAVES: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V25 O1@1<G,O1@2>G,@5G" : PRINT "SQUARE + SAW + NOISE WAVES: PLAY " + Q$ + P$ + Q$ : PLAY P$

RAMPS:
PRINT
PRINT "--- WAVEFORM VOLUME RAMP (ATTACK) DEMO (@Q) ---"
P$ = "V50 T60 O2 Q100 @2 G" : PRINT " 60BPM 100MS RAMP FADE IN SAW: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V50 T60 O2 Q10 @2 G" : PRINT " 60BPM 10MS RAMP FADE IN SAW: PLAY " + Q$ + P$ + Q$ : PLAY P$
P$ = "V50 T60 O2 Q0 @2 G" : PRINT "60BPM 0MS RAMP (NO FADE) IN SAW: PLAY " + Q$ + P$ + Q$ : PLAY P$

SOUNDS:
PRINT
PRINT "--- SOUNDS THAT YOU CAN MAKE! ---"
P$ = "V25 T120 L16 O1 @4 <C,@3<<C P4 <C,@3<<C P4 <C,@3<<C P4 <C,@3<<C" : PRINT "BASS DRUM: PLAY " Q$ + P$ + Q$ : PLAY P$
PRINT
P$ = "V2 T120 L64 O6 P4 @1A,@5A P4 @1A,@5A P4 @1A,@5A P4 @1A,@5A" : PRINT "HI HAT: PLAY " Q$ + P$ + Q$ : PLAY P$
PRINT
P$ = "V5 T240 L64 O5 MS @2E,@1E @2A,@1A @2A,@1A @2F,@1F @2E,@1E @2A,@1A @2A,@1A @2F,@1F @2E,@1E @2A,@1A @2A,@1A @2F,@1F @2E,@1E @2A,@1A @2A,@1A @2F,@1F @2E,@1E @2A,@1A @2A,@1A @2F,@1F @2E,@1E @2A,@1A @2A,@1A @2F,@1F P1 @5 L1 O1 Q100 C,C,C,C,@2<<<<C" : PRINT "SQUEAL TIRES AND CRASH: PLAY " Q$ + P$ + Q$ : PLAY P$
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply


Messages In This Thread
RE: QB64 Phoenix Edition v3.8.0 Released! - by grymmjack - 06-17-2023, 02:09 PM



Users browsing this thread: 11 Guest(s)