BBC BASIC for Windows
« CD-quality stereo SOUND! »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:16pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2 3 4  Notify Send Topic Print
 veryhotthread  Author  Topic: CD-quality stereo SOUND!  (Read 1367 times)
hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx Re: CD-quality stereo SOUND!
« Reply #12 on: Jun 10th, 2015, 7:24pm »

User Image
User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx Re: CD-quality stereo SOUND!
« Reply #13 on: Jun 10th, 2015, 7:44pm »

" It contains three square wave tone generators and one white noise generator, each of which can produce sounds at various frequencies and sixteen different volume levels."

You may not give those 'primitive' chips their just due.
I strongly surmise that the original ENVELOPE addressed the various registers in the SNhuh
User IP Logged

rtr2
Guest
xx Re: CD-quality stereo SOUND!
« Reply #14 on: Jun 10th, 2015, 8:38pm »

on Jun 10th, 2015, 7:24pm, hitsware wrote:
User Image

You will get a 'Not in a subroutine' error if you RUN, rather than CALL (or INSTALL) the library. But it's quite normal for a BB4W library to report an error if you RUN it directly - indeed it's inevitable that any module designed to be CALLed will report an error if it is RUN instead - so I wonder what point you are making.

Quote:
I strongly surmise that the original ENVELOPE addressed the various registers in the SN

I think that's unlikely. Although I've never seen the relevant code in the Acorn MOS, I would expect that its structure was similar to my code in BB4W which does the same job. My envelope routine does not directly call any of the code which emulates the 'chip' (i.e. the DDS code) but achieves its effect indirectly by effectively calling the SOUND routine, to set the frequency and amplitude, every centisecond.

Richard.
« Last Edit: Jun 10th, 2015, 9:14pm by rtr2 » User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx Re: CD-quality stereo SOUND!
« Reply #15 on: Jun 10th, 2015, 9:09pm »

> so I wonder what point you are making.

I obviously don't know where to put it .............
It should be filed where to be called ?
User IP Logged

rtr2
Guest
xx Re: CD-quality stereo SOUND!
« Reply #16 on: Jun 10th, 2015, 9:42pm »

on Jun 10th, 2015, 9:09pm, hitsware wrote:
I obviously don't know where to put it ... It should be filed where to be called ?

When you are running your program from the BB4W IDE it really doesn't matter where you store the library, so long as you specify the appropriate absolute or relative path when you CALL it. In that respect it's like any other 'resource' file used by your program.

But when it comes to compiling your program to an EXE it is obviously much more convenient if you can embed the library file in the executable, which means that it must either be in the LIB folder (which you access using @lib$) or in the same folder as your program (which you access using @dir$), or in a sub-directory of one of those places.

It is conventional to store libraries in the former location (hence the name LIB), although since that's a 'protected' folder in Windows Vista and later you will need to have administrative privileges in order to copy it there. Assuming UAC is enabled, and you copy the file in Windows Explorer (e.g. using copy-and-paste) you will be automatically prompted to grant the necessary privileges.

As is explained in the REMarks within the file itself, you can either use INSTALL (followed by a PROC_hqinit), as you would for a conventional library, or alternatively - because HQSOUND doesn't need to be resident in memory after it has done the patching - you can use CALL instead. The CALL method is particularly useful for those running the trial version of BB4W because it is more memory-efficient.

Because it's the simplest method, when modifying any of my existing four-voice music programs to use the library I simply add this at or near the start:

Code:
      CALL @lib$+"HQSOUND" 

Richard.
User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx 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


 
User IP Logged

dfeugey
Guest
xx 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 smiley

Quote:
Maybe I am becoming deaf ......

Yes, it sounds the same with or without the lib. Strange.
User IP Logged

rtr2
Guest
xx 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.
User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx 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 ?
User IP Logged

rtr2
Guest
xx 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.
User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx 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 » User IP Logged

rtr2
Guest
xx 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.
User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx Re: CD-quality stereo SOUND!
« Reply #24 on: Jun 11th, 2015, 5:54pm »

Gotcha ... Thanks .... See edit to last post ....
User IP Logged

rtr2
Guest
xx 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.
User IP Logged

hitsware
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 70
xx 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 ?

 
User IP Logged

Pages: 1 2 3 4  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls