Page 1 of 2

Chords on a single track?

Posted: Wed Dec 13, 2017 1:35 am
by Artcfox
Does anyone know if there is a way to play chords on a single track with the Uzebox MIDI player? I was thinking if maybe a special instrument that always played a chord (the key it is assigned, and two more notes above that) was assigned as the instrument for a track, then it might be possible, but I'm not too sure if that would work.

Re: Chords on a single track?

Posted: Thu Dec 14, 2017 5:31 am
by D3thAdd3r
The problem with the instrument doing multiple notes, is that only the last note event per frame per track would actually make it into the output stream, because there is only 1 set of variables per track to keep state for how fast to cycle through the kernel way, the current position, etc. There is no room in the inline mixer for multiple extra waves to process, and I don't think there are any large optimization left that would allow to squeeze them in. In the case of the vsnc mixer, this could be done with small code changes I believe. I have not looked at it in a while, but really the track limitations are mostly artificial there in that if you are willing to spend more cycles and ram, you could have more tracks and just do chords that way: 1 note per track and have 8 tracks for example. Any other way similar to the existing, would basically be taking the cycle and ram costs of multiple tracks together(each which coordinates looping through a single wave at a single per frame speed, ie. note), and simply calling it a single track. I am pretty sure about that much at least, there is no general purpose work around for it unfortunately.

Maybe if the requirements for the chord were not too varied, you could somehow coerce a PCM equivalent sound to trigger instead for those. If SPI ram is not out of the question, then you could potentially go a little crazier in that department. Problem with going elaborate in that direction, is that cycles start to run out pretty quickly :roll:

What are the requirements exactly?

Re: Chords on a single track?

Posted: Thu Dec 14, 2017 5:45 am
by Artcfox
Hmm, cool. I may try to mess with the vsync mixer then.

I've just run across a bunch of songs that have simple chords, C major, A minor, F major, and G major, and I remember that I was able to set a sound effect patch that had multiple note up/note down commands in it as the instrument for a MIDI track, and it worked by changing the pitch of that sound effect depending on which note was played in the MIDI, so I thought maybe by clever use of patch commands I could make an instrument that had multiple pitches at the same time, kinda like how you can specify multiple wave tables in the same instrument (which I guess don't happen at the same time).

Re: Chords on a single track?

Posted: Fri Dec 15, 2017 5:23 pm
by Artcfox
Would using a custom wave (say the sum of multiple waves at different frequencies) as the wave for an instrument allow me to play chords?

Edit: Or would I run into problems when it samples that composite wave in order to change the pitch?

Re: Chords on a single track?

Posted: Fri Dec 15, 2017 6:39 pm
by D3thAdd3r
I thought on that a bit but I "feel" it would be a struggle that wouldn't yield a solution. I think there will be the exact issue you mention, but I don't know for sure. If playing just 1 note at a fixed frequency that represents the combined notes in a wave, maybe that gets around it. But then I think 256 samples is not enough to represent the complex interactions over larger time periods than can be represented with a short loop. I mean the destructive and constructive wave interactions or "frequency beats" a chord causes for that distinct complex sound. I really can't say for sure though.

Another idea pops up from that, abusing note slides with some custom wave form to cause the sound you want. Basically modeling the interactions in a different way using less channels. This sounds intensely difficult or impossible maybe. Let me think on that tonight, it is interesting at least. Block Boy or ZS both abuse note slides at the intro to cause that changing off key melancholy sound, with intentionally non-melodic frequency beats..ie dark sound. Doing the opposite would be intentionally obeying expected melodic relations the user is accustomed to somehow.

Re: Chords on a single track?

Posted: Sat Dec 16, 2017 5:11 am
by D3thAdd3r
There used to be a ram patch thing maybe 6 years ago, that was supposed to be for the MIDI interface or something. Now that makes me think, what can a ram patch combined with mild forms of algorithmic music do, to allow time effective music development for most of it the normal way...where for a couple key flourishes one might be able to have levels of control and state far beyond patch commands. Or instead of the algorithm describing the exact wave form, only encoding the interference of several imaginary ones over the top of some real ones...I have no clue if that idea is really feasible technically, let alone development time wise, but I have to think at least something could be done in that direcrion.

Re: Chords on a single track?

Posted: Sat Dec 16, 2017 9:43 am
by Artcfox
Both very interesting ideas to consider! I haven't used slide notes, because I thought they were just for sound effects, not for instruments.

I do remember reading about the RAM patch thing. I also wonder if one could stream bytes from the sd card into a special ram "wave" so instrument sounds could be changed on the fly. I'm not sure what that could buy in terms of what it might make possible that isn't possible now, but maybe custom instruments (like the Budda demo has with the nice custom instrument that sounds like it was sampled).

Re: Chords on a single track?

Posted: Sat Dec 16, 2017 7:59 pm
by D3thAdd3r
Artcfox wrote: Sat Dec 16, 2017 9:43 am I also wonder if one could stream bytes from the sd card into a special ram "wave" so instrument sounds could be changed on the fly.
Huh, that is worth thinking about there. Like a note event, except it denotes that the bytes to follow(terminated by some event) are to be placed in the ram patch, or something. I like that. It seems like it would work, but harder to makes songs with the extra specifications and then how to mix that data into the music stream made in something like Rosegarden. I have a hard time understanding what the end results of this theoretical stuff might be, but it is easy to imagine a real amount of time investment to figure it out. Then per each song that utilizes it.

Then to "big hammer" any of the funner more imaginative ideas like these, "just" stream the music as compressed PCM which requires a much sought after asynchronous SD streaming code base. I imagine the time investment to do that is less and yields a more general purpose result. The possible advantage to something trickier, is better than general purpose results for something specific. That assumes you are not looking to heavily use the SD for graphics or something else. I still quite like the idea of full PCM music at something like 4 bits(sounding close to 8), with some ideas Jubatian had on fast and simple compression. That does seem to rely on SD streaming existing though, or adding an SPI ram requirement just for music.

Re: Chords on a single track?

Posted: Sat Dec 16, 2017 11:00 pm
by Artcfox
D3thAdd3r wrote: Sat Dec 16, 2017 7:59 pm
Artcfox wrote: Sat Dec 16, 2017 9:43 am I also wonder if one could stream bytes from the sd card into a special ram "wave" so instrument sounds could be changed on the fly.
Huh, that is worth thinking about there. Like a note event, except it denotes that the bytes to follow(terminated by some event) are to be placed in the ram patch, or something. I like that. It seems like it would work, but harder to makes songs with the extra specifications and then how to mix that data into the music stream made in something like Rosegarden. I have a hard time understanding what the end results of this theoretical stuff might be, but it is easy to imagine a real amount of time investment to figure it out. Then per each song that utilizes it.
I wasn't thinking about doing that while the song was playing, just maybe a routine that loads waves for instruments into RAM before a song, so you could have multiple songs that each use different instruments with custom waves. The only ROM I know that uses custom waves (which might have been sampled) is the Buddha deno, but I'm not sure there is source available to it. But the instruments in it do sound really nice, and a sample-based approach supporting many instruments might work well with longer songs that get streamed from SD card.

All PCM seems like it would be much harder to compose for, since there are no limitations, and it might sound out of place.

Re: Chords on a single track?

Posted: Sun Dec 17, 2017 7:23 am
by D3thAdd3r
You can do relatively mild MIDI conversion to PCM that still IMO are far beyond what can be done with patches. I mean something like this, which has a large amount of sound font options. I am flirting with that idea for future games, because actual "full PCM" instrument recordings of these songs are generally not available. I do believe the amount of effort to produce music like this would actually be less, but then it might not be technically feasible for most games because that is a lot of cycles to feed all that.

Otherwise ram patches and/or waves could be a nice thing too. It would be possible for sure, just a matter of how much ram could be justified for a particular program. Then how much effort it is to make the waves, but they would be highly reusable at least.