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

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



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 1381 times)
David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: CD-quality stereo SOUND!
« Reply #10 on: Jun 10th, 2015, 3:10pm »

on Jun 9th, 2015, 10:16pm, g4bau wrote:
But I have noted the (almost) total lack of interest. In fact this forum is about as dead as BBC BASIC is - which makes sense I guess. sad


I'm risking an "off topic" proclamation here, but a commercial game written entirely in BBC BASIC was published a few months ago. The game's called 'Overlord', and was written by Anthony Bartram for the RISC OS platform (the first original, commercial game for RISC OS in several years). I even bought a copy (at £9.99) - my first purchase of a computer game since perhaps 1993! I enjoyed the game. I think Anthony mentioned in an interview that it sold well at a recent RISC OS show.

(He's probably one of the few that has made any money at all from the RISC OS scene!)

http://www.amcog-games.co.uk/

'Overlord' comes with its source code, and upon inspection it wouldn't be difficult to port it over to BB4W (not that I would do such a thing myself without permission and obviously not without license agreement, even if I had the time).

Heartwarming, isn't it, to know that BBC BASIC is still being used to create commercial products. smiley


David.
--
User IP Logged

rtr2
Guest
xx Re: CD-quality stereo SOUND!
« Reply #11 on: Jun 10th, 2015, 5:35pm »

on Jun 10th, 2015, 2:24pm, hitsware wrote:
You've stated before that your purpose was to emulate the original system ergo the chip.

Just to remind you, the sound chip on the original BBC Micro was quite primitive, so things like the ENVELOPE functionality were implemented entirely in software rather than in hardware. This contrasts with some other machines of the day which used a more sophisticated chip but provided less functionality.

I look forward to seeing - and hearing - what you (and others) can achieve by modifying the HQSOUND library to support things like dynamic stereo panning, multiple waveforms and the like.

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 #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

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