19 January 2016, 15:50 | #1 |
Amigan - an' lovin' it!!
Join Date: Nov 2010
Location: Nottingham, UK
Age: 55
Posts: 557
|
SetPeriod Sound Issues
I'm getting an odd error when trying to use the SetPeriod command in Blitz Basic to alter the pitch of a defined sound.
Here's the code, which creates a simple square wave and then tries to alter the pitch: Code:
InitSound 0,128,450,0 For a=0 to 63 SoundData 0,a,100 Next a For a=64 to 128 SoundData 0,a,-100 Next a LoopSound 0,1 VWait 200 SetPeriod 0,250 LoopSound 0,1 VWait 200 Sound 0,1 End However, when running the code all is well until the SetPeriod command is encountered. At this point I get an error saying "Illegal Chanel Mask". Bizarrely complete with mis-spelling of "Channel"... unless it is really something to do with perfume... According to the Blitz manual, the SetPeriod command does not take a parameter for the audio channel, but purely a value for the pre-defined Period parameter of the Sound. Any ideas? |
20 January 2016, 06:26 | #2 |
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
First rule of debugging:
- strip the code to the bare minimum still exhibiting the bug Do you still get the issue if you do: Code:
InitSound 0, 128, 450, 0 For a=0 to 128 SoundData 0, a, 100 Next a LoopSound 0,1 SetPeriod 0, 250 |
20 January 2016, 10:48 | #3 |
Amigan - an' lovin' it!!
Join Date: Nov 2010
Location: Nottingham, UK
Age: 55
Posts: 557
|
The code works fine for the first part - although I did see a typo in my original post... The loop does go from 64 to 127, not 128
I've tried a number of different wave types - square, sine, saw, as well as loaded samples - and I always get the error when I try to amend the period.... |
20 January 2016, 12:27 | #4 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
BUM7 says:
Syntax : SetPeriod Sound#,Period Library : audiolib Description: Hmmm, not sure why we never included this command in the original audiolib, SetPeriod simply allows the user to override the frequence information (period) of the sound object after it has been loaded. To alter a sound's pitch while playing programmers should hit the audio hardware direct (hardware locations are listed at the back of the reference manual). |
20 January 2016, 14:58 | #5 |
Amigan - an' lovin' it!!
Join Date: Nov 2010
Location: Nottingham, UK
Age: 55
Posts: 557
|
Hehe. OK, so the command isn't working properly, then. That's OK, so long as I know. Saves me hours of flogging a dead horse!!
Thanks for the heads-up, idrougge. Taking a look at the reference manual now... UPDATE: WOW! There's a lot of useful stuff in the reference section at the end of the Blitz Manual! So, the following bit of code resets the period to 256, thus making the pitch of the note higher: Code:
Move.w #$00ff, $dff0a6 Last edited by LuMan; 20 January 2016 at 15:51. |
21 January 2016, 00:10 | #6 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
I think the command you're looking for is Freq.
|
21 January 2016, 21:15 | #7 |
Amigan - an' lovin' it!!
Join Date: Nov 2010
Location: Nottingham, UK
Age: 55
Posts: 557
|
Hmm.. This may be in later updates of BB2 for that Amiga, but it's certainly not a command in the version I have. There's no reference in the Manual, and, while I can find a reference to it on the internet, the command throws an error when I try to compile.
|
22 January 2016, 01:46 | #8 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
There's no reason not to run the Ultimate Blitz CD version unless you have a floppy-only system.
|
22 January 2016, 20:56 | #9 |
Amigan - an' lovin' it!!
Join Date: Nov 2010
Location: Nottingham, UK
Age: 55
Posts: 557
|
Y'know, that's a good idea. I ought to dig it out, but I actually bought Blitz Basic 2 when if first came out and nostalgia sort of led me back to my original disk set.
I'll upgrade to the Ultimate version and make use of all those extra commands!! |
22 January 2016, 21:12 | #10 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
|
23 January 2016, 20:51 | #11 |
Amigan - an' lovin' it!!
Join Date: Nov 2010
Location: Nottingham, UK
Age: 55
Posts: 557
|
|
21 February 2016, 04:49 | #12 | |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
Found this in alt.sys.amiga.blitz…
Quote:
|
|
28 January 2017, 02:55 | #13 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
There's a fix to SetPeriod in http://aminet.net/package/dev/basic/BlitzLstJan02
|
28 January 2017, 04:42 | #14 |
Unregistered User
Join Date: Nov 2005
Location: Tasmania
Age: 42
Posts: 893
|
This would be great, it's been a while since I coded in Blitz, but I recall telling my computer to get ****** every time I forgot to disable/re-enable the debugger around the Sound function. I'm curious as to which file contains the patch, is it this one:
Code:
BlitzLstJan02/attachments/mail_110/bugs2.2.bb2 |
28 January 2017, 11:15 | #15 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
It's attachments/mail_56/libfixes.lha. It claims to fix exactly the problem of SetPeriod not working in debug mode.
|
15 January 2021, 22:07 | #16 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,656
|
OK this was driving me insane.
How exactly do I patch this, then? I have the libfixes.lha file but no idea how to patch the program. I have the Blitz Ultimate CD but installing from there using the installer gives me an error about some file being write protected. I never was able to use that installer. Do I have a bad CD? [edit] as soon as I use setperiod, I hear noise in my audio channel. Must not be using it right. Last edited by Amiga1992; 15 January 2021 at 22:33. |
16 January 2021, 16:30 | #17 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
There is a fixed installer on Aminet. http://aminet.net/package/dev/blitz/ubbinstall
|
18 January 2021, 17:08 | #18 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,656
|
Holy shit did they do nothing right? Thanks idrougge I'll have to try that.
|
19 January 2021, 11:21 | #19 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
|
Also, there's the http://ubb.plus version of the CD that might be worth looking at. It's a relatively recent update to the Blitz CD that includes all the major updates, a fixed installer and an updated manual.
As for changing the pitch of a sample, back in the '90s I used SetPeriod and it worked fine, so that bug probably crept in later on in a certain version of the libraries. But it was limited in that it only took effect the next time the sample was played, since it simply alters the period value associated with the sample. If that's all you need, you can easily modify the sound object's parameters directly using something like this: Code:
*MySound.sound = Addr Sound(1) *MySound\_period = 500 If changing the pitch during the sample being played is the intended result, then the Freq command should do the job instead, or you can poke the desired period values directly into the chipset registers for the desired channels. |
19 January 2021, 15:16 | #20 | |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,656
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WHDLoad IK+ Sound issues | lurch | support.Games | 3 | 27 March 2015 18:48 |
Roadkill sound issues | Steve | support.WinUAE | 0 | 11 May 2014 19:41 |
Sound issues? | thermalthong | support.Hardware | 18 | 02 November 2012 18:14 |
A1200 sound issues | arnljot | support.Hardware | 5 | 06 February 2008 13:16 |
Even more sound timing issues... | andreas | support.WinUAE | 11 | 30 November 2005 11:23 |
|
|