Topic: Ear Shaver questions and concerns

I'm not a person who knows assembly, but I have a question about the Ear Shaver engine.

How to you get the song to Loop?

At the end of the assembly version, I see

music_data:
    defw song,0

followed later on by

loop:
    defb $01,$01,$01
    defb $00
    defw loop


But I don't know how to use the loop portion to make the song loop endlessly.

I also noticed another issue with the code produced by 1tracker.

In 1Tracker, I exported a song written with the Ear Shaver engine and was pretty happy with the results, but there seemed to be a large difference from the TAP vs the Assembly.  The assembly language version seems the fail on multiple notes being played simultaneously, while the TAP version works exactly as the tracker had it arranged.

So when I compiled the defective version, I did a disassembly on it and I found a difference at the very start of the code.

The working Tap version (export - Tap via 1tracker), produced

begin:
    ld hl,music_data
    rlca
    add a,b   
    call play
    ret


While the assembly version (export- assembly via 1 tracker) produced

begin:
    ld hl,music_data
    call play
    ret

When I added those two lines in, I got good results, so I wanted to point out that the assembly version seems to drop those commands.

As a bonus question, I'd like to ask to see if there was an easy way to get the border flashing with every note, which I found very attractive when playing a song.

Thanks

Andy

Re: Ear Shaver questions and concerns

You don't need to edit assembly code in order to use loop (if it is supported by an engine). Use Ctrl+Home to mark loop start, Ctrl+End to mark loop end.

This piece of code

begin:
    ld hl,music_data
    rlca
    add a,b   
    call play
    ret

is totally not correct, the other one is. Probably some bug, the engine is very fresh and wasn't tested much, if at all.

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

3 (edited by andydansby 2018-10-11 10:19:51)

Re: Ear Shaver questions and concerns

I don't know if it is my version or some goofy thing happening on my machine, but ctrl-end seems to perform a mute operation on channel 1.  I'm running 1tracker 0.29

EDIT>>

This seems to be a problems with my laptop keyboard, I attached a 104 key keyboard and the  loop start and end works

Re: Ear Shaver questions and concerns

Yep, there is a ton of problems with laptops, as they has very shrinked down keyboards, and the lacking keys is different. I'm trying to add alternative key combinations for laptops whenever issues discovered, but there is always more.

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

Re: Ear Shaver questions and concerns

Looping works great.

Code wise is there an easy way to introduce patterns into earshaver? I'm looking to save some data as opposed to re-coding parts of the song as redundant data.

Re: Ear Shaver questions and concerns

1tracker follows pattern-less design. It is possible to add patterns support into engine, not too difficult, but you would have to prepare data manually somehow, as 1tracker won't split it into patterns automatically (engine script can do this potentially, but that's not an easy way).

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

Re: Ear Shaver questions and concerns

I could generate a pattern in 1tracker and then manually paste the sound data into pattern1, pattern2, etc...

such as this 2 note pattern.

;compiled music data
music_data:
    patterndata,0

patterndata:
    defw pattern1   
    defw pattern2
    defw music_data
   
pattern1:
    defb $14,$80,$49,$80,$49
    defb $0a,$01,$01
    defb $00;indicates end of pattern
   
pattern2:   
    defb $14,$82,$49,$82,$49
    defb $0a,$01,$01
    defb $00


Which plays the two notes and then crashes.

What I am thinking of for this is to create the pattern using 1 tracker and copy/paste the notes into a particular pattern and then set up the pattern in the pattern data section. 

I'm making a few assumptions, that the defb $00 indicates the end of the pattern and that the defb $0a,$01,$01 indicates a clearing of the pattern,  I'm certain that somehow I'm wrong in this

Also in music_data:
    patterndata,0

What does that ,0 mean

Forgive me for my naïvety

Thanks

Re: Ear Shaver questions and concerns

Your music_data should simply contain the pattern pointers, the extra "patterndata" structure is not needed. So

music_data:
   defw pattern1
   defw pattern2
   defw 0
...

The 0-word at the end of the music_data block marks the end of that block, in the same way that the 0-byte at the end of a pattern marks the pattern end.

However, I don't know if Ear Shaver supports this kind of sequence/pattern structure out of the box, perhaps some adjustments to the data loader are needed.

Re: Ear Shaver questions and concerns

I couldn't get it to ever work, but that's OK.  I'm just exploring each of the music engines to see what is appropriate for my game.  There's quite a few choices, but I'm starting to lean toward nanobeep2, which sounds pretty good with a good savings in memory.

BTW, I'm writing the game in Z88dk compiling using SDCC.  So there is a bit of code conversion to make it work proper in the build environment I'm using.

10

Re: Ear Shaver questions and concerns

As much as I'd advocate trying some of the newer beeper engines, the most convenient for you would be to use Tritone, as it's natively supported in z88dk.

Also, don't worry too much about size. Once you use compression (and only unpack into a buffer when you need it), data size doesn't really matter that much. I think z88dk has zx7 compressor build in, which works fairly well on music data.