Hi All
I was wondering if it's possible to do the following things whilst a multi channel song is playing:
1) Mute a particular channel
2) Change the patch a particular channel is using
Without interrupting the flow of the music.
Cheers
Roukan / Jim
Question about Music Player and patches
Re: Question about Music Player and patches
There's currently no API or direct way to do this. Though it could be done in part using the sound engine internal structures. Muting could be simulated by setting a tracks's column to zero, though any volume controller used in the track later would "unmute". For the patch, it is the same thing, on the next patch change controller found it would restore to that one.
Code: Select all
extern struct TrackStruct tracks[];
tracks[channel].trackVol=0;
tracks[channel].patchNo=5;
Re: Question about Music Player and patches
Just thought I'd link the reason I was asking about this - might shed a bit more light on the matter:
http://uzebox.org/forums/viewtopic.php? ... 798#p10378
Cheers
Roukan / Jim
http://uzebox.org/forums/viewtopic.php? ... 798#p10378
Cheers
Roukan / Jim
Re: Question about Music Player and patches
I'm replying to the other thread here, I think this is the best place?
Essentially this is how easy it is:
I am positive it would be possible to do something similar. I attached a demo where up,down,left, and right will change what instrument plays for channel 0(main melody). Now, distorting the timing or playing "out of tune" when the bad guys have the instrument would be a bit trickier. The patch that plays when you push right in the demo, seems like it would almost work for a warbled melody for baddies. Otherwise it would take a bit of work, but I think it would be possible to distort time only for channel0 fairly easy also.Roukan wrote: 1) Though it's probably not doable due to the way it uses music as part of the game play
Essentially this is how easy it is:
Code: Select all
while(true){
uint16_t pad = ReadJoypad(0);
tracks[0].patchNo=0;//normal sound
if(pad & BTN_UP)
tracks[0].patchNo=1;
if(pad & BTN_DOWN)
tracks[0].patchNo=2;
if(pad & BTN_LEFT)
tracks[0].patchNo=3;
if(pad & BTN_RIGHT)
tracks[0].patchNo=4;
WaitVsync(1);
}
- Attachments
-
- musictest.hex
- (113.9 KiB) Downloaded 748 times
Re: Question about Music Player and patches
Hi Deathadder
Thanks very much for the reply.
I guess I should of tried something after Uze had replied - I just got it into my head that the original patch would be forced back into play for some reason.
I've now run some tests and yes it does work (not that I ever doubted you )
Whilst I'm at it, just wondering if any kind person out there could come up with patch settings for the following 3 instruments:
1) Saxophone
2) Trumpet
3) Electric Guitar
Cheers
Roukan / Jim
Thanks very much for the reply.
I guess I should of tried something after Uze had replied - I just got it into my head that the original patch would be forced back into play for some reason.
I've now run some tests and yes it does work (not that I ever doubted you )
Whilst I'm at it, just wondering if any kind person out there could come up with patch settings for the following 3 instruments:
1) Saxophone
2) Trumpet
3) Electric Guitar
Cheers
Roukan / Jim
Re: Question about Music Player and patches
The sound engine could easily be updated to support a track mute flag. On the other hand, detuning is harder to do because of the way the engine works with a fixed lookup table to derive the notes frequencies. Basically the reason why I never implemented the pitch bend controller.
Maybe you could achieve a similar effect using an out-of-tune chord arpegio? Though that would not sound like those instruments you are looking for.
@Lee: Great song convertion btw! Temping to update SuperMArio demo with it...
Maybe you could achieve a similar effect using an out-of-tune chord arpegio? Though that would not sound like those instruments you are looking for.
@Lee: Great song convertion btw! Temping to update SuperMArio demo with it...
Re: Question about Music Player and patches
On the mute side of things, could certain settings for a patch make it a silent patch, then when muting is required - one just changes the patch number to the silent one.uze6666 wrote:The sound engine could easily be updated to support a track mute flag.
If so what might they be?
I had also thought that just having a few dodgy sounding patches that can be switched in might suffice - If it sounds bad then it's doing the jobuze6666 wrote:On the other hand, detuning is harder to do because of the way the engine works with a fixed lookup table to derive the notes frequencies. Basically the reason why I never implemented the pitch bend controller.
Maybe you could achieve a similar effect using an out-of-tune chord arpegio? Though that would not sound like those instruments you are looking for.
Agree, it sounded pretty sweet.uze6666 wrote:@Lee: Great song convertion btw! Temping to update SuperMArio demo with it...
Cheers
Roukan / Jim
Re: Question about Music Player and patches
I had a simple idea and I've added an updated demo. Hold right to hear a very detuned playback. I think this is fully capable, and certainly the patches could be experimented to be more precise for your taste. The basic idea is this:
Here I made 5 patches that are detuned something like this:
Randomly choosing 1 of several patches with messed up notes and/or timing seems very similar to the original game.
Code: Select all
uint16_t lfsr = 26;//seed our random number generator
while(true){
uint16_t pad = ReadJoypad(0);
tracks[0].patchNo=0;
if(pad & BTN_UP)
tracks[0].patchNo=1;
if(pad & BTN_DOWN)
tracks[0].patchNo=2;
if(pad & BTN_LEFT)
tracks[0].patchNo=3;
if(pad & BTN_RIGHT)
tracks[0].patchNo=4+(lfsr&5);
WaitVsync(1);
uint16_t bit;
/* taps: 16 14 13 11; characteristic polynomial: x^16 + x^14 + x^13 + x^11 + 1 */
bit = ((lfsr>>0)^(lfsr>>2)^(lfsr>>3)^(lfsr>>5))&1;
lfsr = (lfsr>>1)|(bit<<15);
}
Code: Select all
const char patch11[] PROGMEM ={
0,PC_TREMOLO_LEVEL,60,
0,PC_TREMOLO_RATE,24,
0,PC_WAVE,4,
0,PC_ENV_VOL,0//here we can halt sound for a bit
14,PC_ENV_VOL,128,//and restore it some frames later causing "off time" playback
0,PC_NOTE_DOWN,15,//different values here mess up the pitches played
0,PC_ENV_VOL,87,
0,PC_ENV_SPEED,8,
1,PC_NOTE_HOLD,0,
0,PC_ENV_SPEED,-4,
60,PC_NOTE_CUT,0,
0,PATCH_END
};
- Attachments
-
- musicdemo.hex
- (81.07 KiB) Downloaded 555 times
Re: Question about Music Player and patches
Nice work DeathAdder, that seems to reproduce the effect quite well indeedD3thAdd3r wrote:Randomly choosing 1 of several patches with messed up notes and/or timing seems very similar to the original game.
Cheers
Roukan / Jim