26 (edited by chupo_cro 2017-07-28 00:10:04)

Re: Octode on Arduino

Shiru wrote:

For this particular application I didn't need to know exact cycle count or do assembly optimization. If I was to write AVR assembly code by hand, I sure would know how many cycles it takes - it is common practice to memorize opcode cycles (super easy on AVR), and count them in time critical parts when writing for 8/16 bit systems in assembler.

AVRs are like a 8 bit computer + peripherals, you might soon meet the situation where you would have to know the number of cycles between two events or between two conditions of the system.

I memorized a lot of Z80 opcode cycles and opcodes back in the 80s, I could write 20-30 byte long (or short? :-) ) routines directly in hex - without loading the assembler (Zeus or GENS). Now I still remember only #c9 and a few more opcodes.

Shiru wrote:

What I needed was just to see compiler generated code, to check if particular changes in C code makes resulting code longer or shorter, which is totally enough to estimate efficiency of edits - another common practice when writing for 8/16 bit systems in C. It is super simple task, I don't see why it should be overcomplicated like that with all that porting to other environments, using simulators, debuggers, and stuff like that.

Well... Could you notice the interrupt happening just in between loading or storing the 2-byte variable and ruining the result by just observing the code? ;-)

Chupo_cro

Re: Octode on Arduino

Yeah, good luck with all that.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

28

Re: Octode on Arduino

Well, let's just say everybody has their own goals and methods, alright? For my part, I'm quite interested to hear about yours, chupo_cro (even though I'm personally more interested in coding AVR asm than C). Either way, probably best to continue this discussion in a new thread.

chupo_cro wrote:

Something that might be interesting - my song data format is not tracker-like (patterns of tones/commands) but is rather an array of tone[|CMD], duration[,command][, parameter] per channel (array of uint8_t) so it is quite easy to enter the song by looking at the musical scores and typing the data. Some commands can be specified just by OR-ing the tone with the command and some need to be specified by using CMD flag and the additional byte as command specifier and maybe one more byte as a parameter. The durations are specified as t1 (a whole note), t2 (a half note), t4 (a quarter note), t8, t16 or as the combination - for example t4+t8 is a quarter note with the dot.

Now, while I see your reasoning behind it, I think this approach has some drawbacks. The main issue is that you will find few people who are willing to write music for your engine in a text-based format. While music markup languages have some fans (even around here wink), the vast majority of users prefer trackers nowadays. And this kind of sheet-music oriented format does not lend itself well to a tracker implementation, since trackers don't care about note lengths. It might be worth considering to "inverse" the length format, so that t1 would be the smallest unit (ie. semi-quaver). This way, it'd be still relatively convenient for transcribing sheet music, while at the same time making tracker support a little easier. The other thing you have to worry about is row transition length. The more complex the data format, the more time you need to decode it - time that you can't spend on synthesis. It's normally not such a big issue with PFM-based synthesis, but once you get into pulse-interleaving/volume faking, you will notice a significant impact on the sound quality. Of course, with something like 10 channels, you have to start worrying about data size as well (so it would make sense to have patterns per channel instead of one pattern for all channels). But for 2 channels, I find split patterns aren't worth it in most cases.

Re: Octode on Arduino

Very interesting discussion guys.

Welcome to the forum chupo_cro , it's great to see new faces here smile

Re: Octode on Arduino

utz wrote:

Well, let's just say everybody has their own goals and methods, alright? For my part, I'm quite interested to hear about yours, chupo_cro (even though I'm personally more interested in coding AVR asm than C). Either way, probably best to continue this discussion in a new thread.

Yes, that would be great :-) I shall these days start a new thread where I'll write you an answer to this post (regarding data format and row transitions) and where we can discuss all kinds of possibilities that could be used for 1-bit sound generation using AVRs/Arduinos programmed in C, assembler or C + inline assembler.

Chupo_cro

Re: Octode on Arduino

AtariTufty wrote:

Very interesting discussion guys.

Welcome to the forum chupo_cro , it's great to see new faces here smile

Thank you very much for the welcome! :-) I am looking forward to learn from the works presented by forum members and I hope I could add a bit here and there. Although my 'first' assember is Z80 I did write some 6502 code back in the 80s as well so I will be watching for those sound generation routines too.

Chupo_cro

Re: Octode on Arduino

my skills are not that high, but I found it funny to add this in the arduino code:

#define LED 8
/.../
if(!click_drum_len)
  {
     /.../
  }
  else
  {
    digitalWrite(LED,HIGH);
/.../
}

so now I have a led which pulses during the drum beats!

I'm still working on my AY+SID+1bit player PCB, I should send it soon to the maker!

Re: Octode on Arduino

more fun with this engine...

I've added a knob and and I can slowdown the replay of the song:

  current_speed = constrain(map(knob_value,0,1023, 2, 20),2, 20);
/.../
  parser_sync=song_speed*(current_speed/2);

https://picosong.com/wekgx/

34 (edited by dennisl68 2022-01-10 20:21:27)

Re: Octode on Arduino

Shiru wrote:

[...] after some thoughts chose to start from the simplest thing possible - recreating the original Octode engine for Arudino Uno, in C. A very special kind of fun, should I say.[...]

I really appreciate the work smile

Can this source be found anywhere on Github?

I tried Googling but nothing obvious popped up...

Re: Octode on Arduino

Sorry, I don't use Github, so unless some uploaded it there, it isn't there. And I doubt anyone did that.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: Octode on Arduino

Is it ok for me to upload the source for this and the other two Arduino implementations you've done?

In that case, what should the licensing rules be?

Re: Octode on Arduino

Sure, you can upload it. WTFPL/CC0 it is.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: Octode on Arduino

Shiru wrote:

Sorry, I don't use Github, so unless some uploaded it there, it isn't there. And I doubt anyone did that.

I did it, some time ago, probably with a few modifications:

https://github.com/farvardin/garvuino/t … ino_octode