{"action":"opened","issue":{"url":"https://api.github.com/repos/flamewing/mdtools/issues/1","repository_url":"https://api.github.com/repos/flamewing/mdtools","labels_url":"https://api.github.com/repos/flamewing/mdtools/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/flamewing/mdtools/issues/1/comments","events_url":"https://api.github.com/repos/flamewing/mdtools/issues/1/events","html_url":"https://github.com/flamewing/mdtools/issues/1","id":294216859,"number":1,"title":"SMPS2ASM not preserving FM voice TL high bit","user":{"login":"Clownacy","id":7667009,"avatar_url":"https://avatars1.githubusercontent.com/u/7667009?v=4","gravatar_id":"","url":"https://api.github.com/users/Clownacy","html_url":"https://github.com/Clownacy","followers_url":"https://api.github.com/users/Clownacy/followers","following_url":"https://api.github.com/users/Clownacy/following{/other_user}","gists_url":"https://api.github.com/users/Clownacy/gists{/gist_id}","starred_url":"https://api.github.com/users/Clownacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clownacy/subscriptions","organizations_url":"https://api.github.com/users/Clownacy/orgs","repos_url":"https://api.github.com/users/Clownacy/repos","events_url":"https://api.github.com/users/Clownacy/events{/privacy}","received_events_url":"https://api.github.com/users/Clownacy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-04T18:05:28Z","updated_at":"2018-02-04T18:05:28Z","closed_at":null,"author_association":"NONE","body":"I was noticing an issue with some Sonic CD SFX that I ran through a modified SMPS2ASM build, and it had to do with SMPS2ASM inserting high-bits in the TL bytes that weren't meant to be there.\r\n\r\nSMPS2ASM currently inserts TL high-bits based on the voice's algorithm setting. There are some voices that don't follow this rule, and I've seen the tool properly handle a few of these. For example, voice 3 of Sonic 2's title screen music has an extra bit.\r\n\r\n```\r\n;\tVoice $03\r\n;\t$39\r\n;\t$06, $60, $30, $01, \t$3F, $3F, $5F, $5F, \t$11, $0F, $13, $09\r\n;\t$05, $04, $04, $03, \t$2F, $2F, $2F, $2F, \t$27, $2C, $97, $80\r\n\tsmpsVcAlgorithm     $01\r\n\tsmpsVcFeedback      $07\r\n\tsmpsVcUnusedBits    $00\r\n\tsmpsVcDetune        $00, $03, $06, $00\r\n\tsmpsVcCoarseFreq    $01, $00, $00, $06\r\n\tsmpsVcRateScale     $01, $01, $00, $00\r\n\tsmpsVcAttackRate    $1F, $1F, $3F, $3F\r\n\tsmpsVcAmpMod        $00, $00, $00, $00\r\n\tsmpsVcDecayRate1    $09, $13, $0F, $11\r\n\tsmpsVcDecayRate2    $03, $04, $04, $05\r\n\tsmpsVcDecayLevel    $02, $02, $02, $02\r\n\tsmpsVcReleaseRate   $0F, $0F, $0F, $0F\r\n\tsmpsVcTotalLevel    $00, $97, $2C, $27\r\n```\r\nsmpsVcTotalLevel retains this bit, so there's no problem. This only works for songs with _extra_ bits, however. Where the problem does start is when a voice has _fewer_ bits than the algorithm byte indicates, such as Sonic CD's SFX 0xDF.\r\n\r\n```\r\n;\tVoice $00\r\n;\t$07\r\n;\t$04, $04, $05, $04, \t$1F, $1F, $15, $15, \t$00, $00, $00, $00\r\n;\t$00, $00, $00, $00, \t$1F, $1F, $1F, $1F, \t$7F, $7F, $80, $80\r\n\tsmpsVcAlgorithm     $07\r\n\tsmpsVcFeedback      $00\r\n\tsmpsVcUnusedBits    $00\r\n\tsmpsVcDetune        $00, $00, $00, $00\r\n\tsmpsVcCoarseFreq    $04, $05, $04, $04\r\n\tsmpsVcRateScale     $00, $00, $00, $00\r\n\tsmpsVcAttackRate    $15, $15, $1F, $1F\r\n\tsmpsVcAmpMod        $00, $00, $00, $00\r\n\tsmpsVcDecayRate1    $00, $00, $00, $00\r\n\tsmpsVcDecayRate2    $00, $00, $00, $00\r\n\tsmpsVcDecayLevel    $01, $01, $01, $01\r\n\tsmpsVcReleaseRate   $0F, $0F, $0F, $0F\r\n\tsmpsVcTotalLevel    $00, $00, $7F, $7F\r\n```\r\n\r\nAs you can see, the original TL bytes are `$7F, $7F, $80, $80`, but this will assemble to `$FF, $FF, $80, $80` because of the algorithm byte.\r\n\r\nPersonally, I think SMPS2ASM should just stop automatically managing TL bits, since the inconsistent pattern of so many Sonic voices makes me think they were all added manually."}}
{"actor":{"display_login":"Clownacy"}}