Author |
Topic: CD-quality stereo SOUND! (Read 1351 times) |
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #17 on: Jun 11th, 2015, 01:14am » |
|
Maybe I am becoming deaf ...... No effect for me ... REM CALL or not Copied file to C/programfiles/bbcbasic/lib Code:
CALL @lib$+"HQSOUND"
*TEMPO 133
ENVELOPE 1,0,0,0,0,0,0,0,127,0,0,0,40,0
ENVELOPE 2,0,0,0,0,0,0,0,127,-3,0,0,120,0
ENVELOPE 3,0,0,0,0,0,0,0,127,-127,0,0,100,0
ENVELOPE 4,0,0,0,0,0,0,0,0,0,0,0,0,0
DIM orgn(11), bass(7), drum(7)
FOR x=0 TO 11: READ orgn(x): NEXT x
FOR x=0 TO 7: READ bass(x): NEXT x
FOR x=0 TO 7: READ drum(x): NEXT x
REPEAT
FOR x=0 TO 11: FOR y=0 TO 7
SOUND 0,1,orgn(x)+48,4
SOUND 1,1,orgn(x)+76,4
SOUND 2,bass(y),orgn(x),4
SOUND 3,drum(y),140,4
NEXT y: NEXT x
UNTIL FALSE: END
DATA 32,24,4,32, 4,4,4,4, 24,24,4,4
DATA 2,4,4,2, 2,4,4,4
DATA 4,4,3,4, 4,4,3,4
|
|
Logged
|
|
|
|
dfeugey
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #18 on: Jun 11th, 2015, 09:17am » |
|
Quote:| It seems most of the forum members are working in silence. |
|
I confirm.
I hope to revive BBC Basic use in France, with some actions not completely related to www.riscos.fr (more a mix of BBC Basic for RISC OS AND Windows).
Quote:| I'm risking an "off topic" proclamation here |
|
And we don't forget your work too 
Quote:| Maybe I am becoming deaf ...... |
|
Yes, it sounds the same with or without the lib. Strange.
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #19 on: Jun 11th, 2015, 09:40am » |
|
on Jun 11th, 2015, 01:14am, hitsware wrote:| Maybe I am becoming deaf ...... |
|
To me the reduction in quantising noise (by more than 40 dB) is dramatic and the stereo effect unmistakable.
In all seriousness if you can't hear any difference (not even that channels 0 & 1 are left-only and channels 2 & 3 right-only) then I would worry about your hearing - or your PC.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #20 on: Jun 11th, 2015, 2:11pm » |
|
Quote:In all seriousness if you can't hear any difference (not even that channels 0 & 1 are left-only and channels 2 & 3 right-only) then I would worry about your hearing - or your PC. |
|
Playing the code I submitted with my last post ?
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #21 on: Jun 11th, 2015, 3:52pm » |
|
on Jun 11th, 2015, 2:11pm, hitsware wrote:| Playing the code I submitted with my last post ? |
|
I haven't run that code, but something far simpler is adequate to demonstrate the stereo effect:
Code: CALL @lib$+"HQSOUND"
SOUND 1, 0, 0, 10
SOUND 2, 0, 0, 30
SOUND 1, -15, 148, 20
SOUND 2, -15, 168, 20 That plays a C on the left stereo channel (only) followed by an F on the right channel (only).
But really the stereo aspect is just a (useful) side-effect. The principal objective of the library was to achieve 16-bit rather than 8-bit output, to eliminate the quantising distortion which I've always found unpleasant. Whilst you can guarantee that any modern PC will support 44.1 kHz 16-bit stereo, you can't be so certain that it will support mono with the same parameters.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #22 on: Jun 11th, 2015, 4:09pm » |
|
> I haven't run that code,
Would you please ? .... Then comment on the effects ...
edit:
1) raised speakers off floor and out of corners somewhat 2) turned off EQ 3) completely closed BB4W between comparisons
Now I can hear the L-R 'ness but quieter ? Tis true my ears are worn, plus I've noticed as my PC's go down in size (and price) the sound quality also declines. Makes sense realizing a SB card uses @ least 12 V, while the MB circuit is probably 3.3V or even 1.8V nowdays ...
|
| « Last Edit: Jun 11th, 2015, 5:46pm by hitsware » |
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #23 on: Jun 11th, 2015, 5:43pm » |
|
on Jun 11th, 2015, 4:09pm, hitsware wrote:| Would you please ? .... Then comment on the effects ... |
|
Effects? It plays fine, with what you call 'bass' and 'drum' at 100% right channel and what passes for the 'melody' at 100% left channel. It's also free from the horrible raspy quantising noise that accompanies it when played without HQSOUND (you must restart BB4W for that of course).
Listen to them yourself:
http://www.rtr.myzen.co.uk/standard.wav http://www.rtr.myzen.co.uk/hqsound.wav
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #24 on: Jun 11th, 2015, 5:54pm » |
|
Gotcha ... Thanks .... See edit to last post ....
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #25 on: Jun 11th, 2015, 5:58pm » |
|
on Jun 11th, 2015, 4:09pm, hitsware wrote:| Now I can hear the L-R 'ness but quieter ? |
|
The reduced level is intentional, because with the hugely increased dynamic range there's no need to risk clipping. But that's settable with the 'stereo mix' QWORD in the library so you are free to bump the level up, or play with panning, or whatever.
As I said before the library lacks any 'frills'; tweak it, enhance it, play with it - the code is very amenable to user-modification and that's the way I increasingly want to go as my own interests and abilities wane.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #26 on: Jun 11th, 2015, 6:22pm » |
|
By "quieter ?" I meant I don't know about the noise you refer to ?
Moving along : Code:
FOR ALD = -10 TO -1
CLS
PRINT "ALD = ";ALD
FOR duration = 3 TO 10
ENVELOPE 1,0,0,0,0,0,0,0,127,ALD,0,0,126,0
SOUND 1,1,4,duration
NEXT duration
NEXT ALD
END
REM As ALD decreases it does not take the level
REM all the way down ......
REM Shouldn't it ?
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #27 on: Jun 11th, 2015, 7:11pm » |
|
on Jun 11th, 2015, 6:22pm, hitsware wrote:| As ALD decreases it does not take the level all the way down ...... Shouldn't it ? |
|
You have:
Code: ENVELOPE 1,0,0,0,0,0,0,0,127,ALD,0,0,126,0
SOUND 1,1,4,duration so the final level should be approximately:
Code:126 + duration * tempo * ALD
So with duration=10 and ALD=-1 (and assuming the default tempo of 5) the final level should be around 126-50=76 (or 9 on the 0-15 scale). Isn't that what you are finding?
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #28 on: Jun 11th, 2015, 8:25pm » |
|
How do I make the envelope go to 0 ?
Adding - numbers to AS does nothing .. ? Likewise AR
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: CD-quality stereo SOUND!
« Reply #29 on: Jun 11th, 2015, 9:11pm » |
|
on Jun 11th, 2015, 8:25pm, hitsware wrote:| How do I make the envelope go to 0 ? |
|
You need to increase the duration to give it time to decay:
Code: AD = -1
duration = 25
ENVELOPE 1,0,0,0,0,0,0,0,127,AD,0,0,126,0
SOUND 1,1,100,duration But that's too obvious, so did you mean something else?
Quote: It works for me. For example here the note initially decays quickly at the AD rate but 10 centiseconds later switches to decaying at the slower AS rate:
Code: AD = -5
AS = -1
ALA = 125
ALD = 75
duration = 2 + 15
ENVELOPE 1,0,0,0,0,0,0,0,127,AD,AS,0,ALA,ALD
SOUND 1,1,100,duration Check on an oscilloscope if you want to see it more clearly. You may want to add an initial delay to avoid the sound start-up transient partially masking the effect.
Quote: Again it has always worked for me. I thought you were something of an expert on the ADSR envelope so I'm surprised you are having problems with it.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 70
|
 |
Re: CD-quality stereo SOUND!
« Reply #30 on: Jun 11th, 2015, 10:21pm » |
|
Here I (empiricly) got the envelopes to work to my liking, but at the expense of the channel modifiers (which I never understood and now do even less) Code:
ENVELOPE 1,0,0,0,0,0,0,0,127,0,0,-2,127,0
ENVELOPE 2,0,0,0,0,0,0,0,127,0,0,-4,127,0
ENVELOPE 3,0,0,0,0,0,0,0,127,0,0,-6,127,0
DIM note(3,7),selection(16)
FOR x=1 TO 16: READ selection(x): NEXT x
DATA 32,40,48,60,68,0,0,0,0,0,0,0,0,0,0,0
REPEAT
FOR count=0 TO 7
FOR voice=0 TO 3
random1=RND(5)
random2=RND(16)
IF random1=1 THEN note(voice,count)=selection(random2)
NEXT voice
IF SGN(note(1,(count)))=1 THEN
SOUND 1,1,note(1,(count)),1: SOUND 4097,1,0,4
ELSE SOUND 4097,1,0,5
ENDIF
IF SGN(note(2,(count)))=1 THEN
SOUND 2,1,note(2,(count)),1: SOUND 4098,1,0,4
ELSE SOUND 4098,1,0,5
ENDIF
IF SGN(note(3,(count)))=1 THEN
SOUND 3,1,note(3,(count)),1: SOUND 4099,1,0,4
ELSE SOUND 4099,1,0,5
ENDIF
NEXT count
UNTIL FALSE
|
|
Logged
|
|
|
|
|